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
}