I've started a project using two load cells and an HX711 but the output is unreliable. I'm using code from this forum - it sometimes works but often just reads out a fixed value - putting pressure on the load cells makes no difference. I'm pretty sure the code and wiring are correct and am leaning towards the HX711 board having a fault.
#include <HX711.h>
#define DOUT 3
#define CLK 2
HX711 scale;
float calibration_factor = -3000;
void setup()
{
Serial.begin(9600);
Serial.println("HX711 calibration sketch");
Serial.println("After readings begin add known mass to scale.");
Serial.println("Adjust calibration_factor using a & z till scale reads correct weight");
scale.begin(DOUT, CLK);
scale.set_scale();
scale.tare();
long zero_factor = scale.read_average();
Serial.println(zero_factor);
}
void loop()
{
scale.set_scale(calibration_factor);
Serial.print("Reading: ");
Serial.print(scale.get_units(), 1);
Serial.print(" kg");
Serial.print(" calibration_factor: ");
Serial.print(calibration_factor);
Serial.println();
if(Serial.available())
{
char temp = Serial.read();
if(temp == 'a') calibration_factor += 10;
else if(temp == 'z') calibration_factor -= 10;
}
}
Is there anything I've got wrong or should I get a new HX711?
I think that the way you have connected your load cells to the HX711 is the problem.
I think that several (maybe 4) of the items with 3 wires, that you have called a load cell need to be combined to form a Wheatstone bridge. This then needs to be connected to the excitation pins (E+ and E-) of the HX711, and to the inputs A+ and A-.
A second Wheatstone bridge arrangement can be connected to E+, E-, B+ and B-.
Sorry if the diagram is confusing, I just did it on MS paint. The colour of the wires was supposed to make it easier to see what went where...
I was under the impression that I could make this work with just 2 of the load cells, not needing all 4. The cells themselves are from a bathroom scales where there would be 4 used, I actually only need 1 for my project but what I've read suggests that would not work well.
Following this wiring diagram it still doesn't seem to work - I am right in thinking that with the above code if I change the load on the 4 strain gauges the output value will change?
OK, given that the red wires are the "middle" wires; the common to both resistive elements in the load cell, that diagram is correct. It most certainly would respond to pressure on just one load cell. The only error might be that if the wiring was not right, an equal pressure on two load cells may cancel out.
To use two of these load cells only, you connect the black of one to the white of another and one of each such pairs to the "E" terminals, the red or "middle" wires go to the "A" terminals. That appears to correspond to your first diagram if the brown wires are actually the "middle" wires. You can figure out which is the "middle" wire using a multimeter, it will show the same resistance to either of the others and double the resistance from one "end" wire to the other.
If the gauge wiring is correct, the fault must be elsewhere!