I'm trying to build a wheatstone bridge using only resistors for now (I will use strain gauges once I fix this issue). I've attached an image with my setup here:
I'm using an HX711 connected to the 5V and GND ports of an Arduino UNO and four 220 ohm resistors for the Wheatstone bridge; the measured excitation voltage of the HX711 is around 4.15 V. First, to see if the connections are correct I have directly measured voltages in different points of the circuit, and even used different values of resistors and they seem alright. However, when I try to obtain a voltage from the readings of the DT and SCK ports of the HX711, there seems to be a problem. This the code I'm using:
#define GAIN_128 25
#define GAIN_64 27
const int doutPin = 4;
const int sckPin = 5;
void setup() {
Serial.begin(57600);
pinMode(doutPin, INPUT);
pinMode(sckPin, OUTPUT);
}
void loop() {
unsigned long raw = readHX711();
Serial.println(raw);
delay(500);
}
unsigned long readHX711(){
unsigned long data = 0;
uint8_t dout;
while(digitalRead(doutPin)){} // wait until value is available
for (uint8_t i=0; i<GAIN_128; i++){ //highest Gain
digitalWrite(sckPin, 1);
digitalWrite(sckPin, 0);
if (i < (24)){
dout = digitalRead(doutPin);
data = (data << 1) | dout;
}
}
data = data ^ 0x800000; // flip bit 23
return data;
}
void powerDown(){
digitalWrite(sckPin, LOW);
digitalWrite(sckPin, HIGH);
}
void powerUp(){
digitalWrite(sckPin, LOW);
}
The readings I obtain are in two complements, being '16,777,215' the maximum value, '0' the minimum value, and '8,388,608' the two complements zero. I have assumed that these values are proportional to the measured voltage between the A+ and A- connections, like this: [(Vmax-Vmin)/(2^24bits)]*reading+Vmin, being Vmax=4.15 V and Vmin=-4.15 V.
When A+ and A- measure the voltage difference between the excitation points E+ and E-, I do obtain a reading I expected of either '16,777,215' or '0' (+4.3 V or -4.3 V respectively, I suppose), and when A+ and A- are not connected to the breadboard I get '8,388,608' (I assume an expected value of 0V). However, when I connect A+ and A- to the wheatstone bridge, the values I read are mainly either '16,777,215' or '0', irrespectively of whether I change the value of one of the resistor or not.
What may be the problem? I'd appreciate any kind of help.
Thank you in advance,
L.

