Hx710b x 2. Odd behaviour. Any ideas?

I'm just playing with these sensors with a view to employing them in an insect habitat controller to warn me that the evaporation pool needs filling with fresh distilled H²O.
Now, to my odd behaviour, not my behaviour but the 2 hx710 barometric sensors. I'm using 2 identical modules, the red, Chinese (not Red Chinese!) made ones. one for ambient pressure and one for the water level. Attached to a mega2560 (genuine Arduino) I've instantiated 2 hx710s ps1 and ps2. I'm able to read both and have applied offsets for each at a pressure of 1010mb. At precisely 1010mb they both behave themselves gong up and down 1 or 2 mb, but! Oddly, hx710 1 goes down and hx710 2 goes up and i cannot see anything wrong in my very simple serial sketch. Anyone experimented with 2 of these side by side and had similar problems? For what it's worth here is my tiny code. I hope I got the tags correct. it has been a while since I used them last


#include "HX710.h"

const int DOUT1 = 5;
const int PD_SCK1 = 4;
const int DOUT2 = 3;
const int PD_SCK2 = 2;

HX710 ps1,ps2;

void setup() {
    Serial.begin( 115200 );
    ps1.initialize( PD_SCK1 , DOUT1 );
    ps2.initialize( PD_SCK2 , DOUT2 );

}

void loop() {
    int32_t value1,value2;
    
    while( !ps1.isReady() );
    ps1.readAndSelectNextData( HX710_DIFFERENTIAL_INPUT_40HZ );
    value1 = ps1.getLastDifferentialInput();
    
    while( !ps2.isReady() );
    ps2.readAndSelectNextData( HX710_DIFFERENTIAL_INPUT_40HZ );
    value2 = ps2.getLastDifferentialInput();
    Serial.print( "differential input 1: " );
    Serial.println((value1/1000)+2813);
    Serial.print( "differential input 2: " );
    Serial.println((value2/1000)+1113);

    delay(5000); // Because who needs to read pressure that fast?
    // I'll have a counter later to reduce the runs of the function to something slower
}

Ok. As is oft the case, it was a power/creep issue. I physically seperated them on a plastic substrate and the problem went away, mostly. I was up till 0500 last night working this out. I ended up with my 2 x hx710s being powered via 4 digital pins, obviously with one set low for -0v and one high for 5v. Besides the fact that digital outputs are better regulated this way I can switch one hx710 off while I read the other etc. As they work in the mV ranges stray voltage will always cause issues!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.