Hello everyone. I'm trying to connect an Arduino Uno with an HX711. However, whatever I do the result is that the reading keeps drifting. I used two kinds of 3-wire load cells. Several types of HX711 amplifier (on green and purple laminate). I have connected the whole system several times, always following the schematic, and always after connecting I checked that the resistances were correct.
I set different baud rates, starting from 1200 and ending with 115200. I tried replacing the Arduino with an ESP8266. I always used this library GitHub - bogde/HX711: An Arduino library to interface the Avia Semiconductor HX711 24-Bit Analog-to-Digital Converter (ADC) for Weight Scales.
I also deleted the library several times and loaded it again. None of these steps helped get rid of the drifting result. Today I made a makeshift wheatstone bridges.
For the input I gave ~3.3V. Since the resistors were not perfectly the same value, they were about 1000Ω +/- 10Ω, the output was about 6.5mV
Unfortunately, the result is as adrift as before.
I do not know where I can look for the cause of this behavior and how to solve the problem. Any ideas? I would be grateful for any : )
At a wild guess because I don't know how you are obtaining your readings (No Code Posted). I would say try slowing down your sampling rate with millis and see is that makes a difference. Post a copy of your code and at least a picture of your wiring.
?
Why didn't you use the regulated and ratiometric E+ excitation voltage the HX711 provides.
Good HX711 boards provide regulated 4.3volt on E+
Did you measure the resistance between E- and gnd of the HX711.
It should be close to zero ohms.
There are boards out there without a bottom ground plane, where E- is not connected to ground.
That can be corrected by soldering a wire between E- and gnd of the HX711.
Did you use metalfilm resistors for the missing part of the bridge.
Your last image shows an ESP32.
Common HX711 boards can't be used with a 3.3volt processor.
For that you need a board with a 5volt analogue supply and a 3.3volt digital supply.
Sparkfun is AFAIK the only seller who was clever enough to realise that.
Did you already do what I asked in post#5.
Measure the resistance between E- and gnd.
Leo..
Photo from my last post show ESP + makeshift bridge. I wanted to see if if I put a constant voltage on A+A- what the readings would be on HX711.
It turned out that although the voltage did not fluctuate, the reading was garbage, drifting.
What you are calling "drift" is probably just normal random noise.
Since you aren't setting "scale" to any particular value, your output is the raw reading minus the tare. Full scale raw readings vary from about +8,390,000 to -8,390,000.
So a no-load output fluctuation of, say, +/- 500, means you have a zero value fluctuation that is about +/-1 part in 16,800 of full scale (8,390,000 / 500 = 16,800), which isn't horrible.
Also, setting the tare every time through loop will also cause some variation in the output, as the tare value itself will have some random fluctuations, too.
For a clearer view, try this simpler code with your Uno (not the ESP). It shows the raw readings.
#include "HX711.h"
// HX711 circuit wiring
const int LOADCELL_DOUT_PIN = 2;
const int LOADCELL_SCK_PIN = 3;
HX711 scale;
void setup() {
Serial.begin(9600);
scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
}
void loop() {
if (scale.is_ready()) {
long reading = scale.read();
Serial.print("HX711 reading: ");
Serial.println(reading);
} else {
Serial.println("HX711 not found.");
}
delay(1000);
}
PS: there is no point in calling scale.set_scale() unless you set it to something by putting a number between the (). And typically that is done just once, in setup(), not every time through loop. If you don't call .set_scale(), the default is 1.0, just as if you call .set_scale() with empty ().
What you are calling "drift" is probably just normal random noise.
Maybe yes, maybe no. But before that, the result was going crazy. As I used your code, from the last post it is much better!
I just changed the code to yours and now the readings look like this (readings from ESP8266 that is 3.3V but it was similar on Arduino Uno)
Thank you very much. I am getting closer to solving this problem. If I want to stay at 3.3V, will the SparkFun Load Cell Amplifier - HX711 be the right choice?