Right, so I’ve come close to losing my mind with this simple task.
Baffled at how poor my results are. Huge drift to the point that I wouldn’t even call it drift. Very noisy readings, too, but I don’t know what could be the noise source.
I have a simple, isolated setup:
https://i.stack.imgur.com/yINVg.pngHere, I have some readings taken shortly after power on.
https://i.stack.imgur.com/QENrR.pngHere, I have some readings taken maybe two minutes later. I am aware temperature plays an effect, but not like this. 200k drift, basically, within minutes. 200000/(2^24)=1.1%. Catastrophic.
https://i.stack.imgur.com/TYMwe.pngHere is my code. It couldn’t be much simpler.
#include "HX711.h" //https://github.com/bogde/HX711
#include "BufferedOutput.h" //https://github.com/PowerBroker2/SafeString
// #include "MovingAverageFloat.h"
// HX711 circuit wiring
#define LOADCELL_DOUT_PIN A0
#define LOADCELL_SCK_PIN A2
HX711 scale;
createBufferedOutput(BufferedOut, 80, DROP_UNTIL_EMPTY); //for non-blocking printing
void setup() {
Serial.begin(9600);
while(!Serial) {}
BufferedOut.connect(Serial);
scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
delay(500);
}
void loop() {
// if (scale.wait_ready_timeout(500)) { //nonblocking?
if (scale.is_ready()) BufferedOut.println(scale.read());
// }
delay(500);
}
I’m using Sparkfun’s reputable HX711 module. Here is its circuit schematic:
https://i.stack.imgur.com/VeDHK.pngI’ve grounded the load cell’s aluminum body–I’ve checked that there is continuity. Here is its datasheet: [link. 100g load cell (also from Sparkfun, purchased from RobotShop UK) because I am looking for 10mg accuracy or better (I found [this scholarly article saying they’ve gotten to 5mg accuracy without temperature compensation and using the same components I’m using, so I’m not being unreasonable with my expectations for the hardware).
I have checked my excitation voltage with an oscilloscope. 100MHz bandwidth, AC coupling. Apparently, 27mV ripple peak-to-peak. Not good. I was expecting a (few) hundred microvolts. (My oscilloscope: [link)
https://i.stack.imgur.com/M9oig.png
Not sure what else to do here. I know I could order some braided copper sheath for the cables to help with radiative noise, but I consider that a final touch. Am I using my oscilloscope incorrectly? Am I using the Arduino repository incorrectly?
I’d really, really appreciate help here. I’m afraid I’ve reached my limit.](https://www.amazon.co.uk/HANMATEK-Handheld-Digital-Oscilloscope/dp/B0BCDMQY4J?th=1)](https://www.researchgate.net/publication/342528818_Open-Source_Digitally_Replicable_Lab-Grade_Scales)](https://cdn.sparkfun.com/assets/9/9/a/f/3/TAL221.pdf?_gl=1*1exqlb*_ga*MTY1NjY0NDYwMC4xNjc5OTM5NzQ0*_ga_T369JS7J9N*MTY4OTU4OTAzOC40LjAuMTY4OTU4OTAzOC4wLjAuMA)