HX711 Variables Cause Breathing Green, Disconnect from Cloud

Hi All,

I am working with the HX711ADC library and I continue to get disconnected from the cloud and my photon begins breathing green immediately after I call on the variables valRight or valLeft. As you can see from the code below, I have two load cells set up to the photon and I am trying to get readings from both. I think it has something to do with either my void loop() or the power_up()/ power_down() call sequence. Thanks in advance for the help!

#include "application.h"
#include "HX711ADC/HX711ADC.h"

int valueRight = 0;
int valueLeft = 0;

HX711ADC scaleRight(D5, D0);    // parameter "gain" is ommited; the default value 128 is used by the library
HX711ADC scaleLeft(D6, D1);

void setup(){
    Particle.variable("valRight", valueRight);
    Particle.variable("valLeft", valueLeft);

void loop(){
    valueRight = scaleRight.read();
    valueLeft = scaleLeft.read();

The problem portion of the library is here

long HX711ADC::read() {
	// wait for the chip to become ready
	while (!is_ready());  // <-- here should at least be a call to Particle.process()

You code gets stuck in there and loses cloud connection.
There should be a timeout and graceful return instead.

But you can at least stay connected when you add SYSTEM_THREAD(ENABLED) at the top of your sketch.

The reason why your code gets stuck there is that DOUT never goes LOW.

1 Like

Thanks for the quick response!! Particle.process() fixed it. Now I am having trouble getting a dynamic reading. When I print out the variable in the loop I get the same number. However, I know the load cell is working because when stop the program and rerun it, I get a different number but still just repeating. Any ideas?

Never mind… It’s working. I was using python to read in the variable and was just a debugging error on my part within the python script. Thanks again for the quick help!

1 Like