I’m trying to develop a FOSS coffee scale, but I’m stuck at the first hurdle. Getting an accurate reading.
In case the issue was the USB as a power source, I’ve also run this off a 9V battery via the barrel plug, outputting the readings to an SH1107 and this variance is also present there.
I’ve logged the readings from the load cell both at zero and with a 113g load. I tried using get_units(1) with plans to average them myself, but I also tried using get_units(10) as that’s what I’ve seen in examples. The variance is also present there as can be seen in the graphs below.
I’m not sure where the issue lies here. It seems other people have been able to get an accuracy down to 0.02 grams with a 5kg load cell. Is this down to a bunk hx711? An issue with the load cell itself? Arduino’s voltage supply being dodgy?
Here’s a simplified version of the code I’m using:
#include "HX711.h"
HX711 loadCell;
const int LOADCELL_DOUT_PIN = 6;
const int LOADCELL_SCK_PIN = 7;
const int LOADCELL_OFFSET = 4294940633;
const float LOADCELL_SCALE = 391.300445;
void setup(){
Serial.begin(115200);
loadCell.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
loadCell.set_offset(LOADCELL_OFFSET);
loadCell.set_scale(LOADCELL_SCALE);
delay(2000);
loadCell.tare(10);
}
void loop(){
// Either going to log 1 or 10 readings
Serial.println(loadCell.get_units(10));
}
Thanks for any help anyone can give!
I tried bypassing the voltage in for the HX711 attaching it directly to the battery, and making a common ground between the battery, hx711, and arduino.
I similarly tried to power the load cell itself, but this seems to be a wrong way about it. I’m not fully sure on what I’m doing here, I only deal with software, electronics is utterly confusing!