Hi everyone,
I'm working on a project involving the XIAO ESP32-C3, the HX711 load cell amplifier, and a 10KG load cell. Here's my setup and problem details:
Setup:
- ESP Board: XIAO ESP32-C3, powered via USB from a PC.
- CPU Frequency: 80 MHz (WiFi).
- Library: https://github.com/RobTillaart/HX711
- Load Cell: 10KG.
- Capacitors:
- 0.1 µF and 10 µF connected to 3.3V and GND of the ESP32-C3.
- 0.1 µF and 10 µF connected to E+ and E- of the HX711.
Circuit:
The Issue:
Even with capacitors, I'm not getting consistent or precise readings, especially when there's no load. Someone in this Reddit thread (reddit thread) mentioned achieving good results with capacitors using an ESP32-C3, but I'm unable to replicate their success. What am I doing wrong?
Code:
#include <HX711.h>
HX711 scale;
uint8_t dataPin = D5;
uint8_t clockPin = D6;
int32_t offset = 45585;
float_t factor = 188.233414;
void setup() {
Serial.begin(115200);
delay(1000);
scale.begin(dataPin, clockPin);
scale.set_offset(offset);
scale.set_scale(factor);
scale.tare(20);
}
void loop() {
delay(100);
if (scale.is_ready()) {
float avg_units = scale.get_units(10);
Serial.printf("%f g.\n", avg_units);
}
}
Tests:
With capacitors and no load:
0.428719 g
0.277311 g
0.213560 g
...
-2.236045 g
-1.089073 g
0.134412 g
Without capacitors and no load:
-0.107849 g
-0.166287 g
-0.262432 g
...
-0.768722 g
-0.750128 g
-0.882942 g
With capacitors and 202g load:
202.807251 g
203.085083 g
203.389526 g
...
200.256149 g
199.649475 g
198.550827 g
Without capacitors and 202g load:
206.890991 g.
207.609268 g.
208.448654 g.
...
212.362427 g.
212.087204 g.
213.532761 g.
