HX711 data crash after a minute or two

I try to read MPS20N0040D air pressure with the HX710B and the library for the hx711. The first minute the data looks normal bud after a while the data crashed en only after power loss of te HX710B the data comes normal.
I have used the library’s HX711 HX711_Arduino_library and the HX_ADC library. All did the same. Crash after a minute or so. I tride a Arduino Nano and a Arduino Uno.
Some one a idee where the data crash is comming from and how I cane fix it?

post the code

GCJR thanks for reply.

I understand your question bud its the latest example TESTING, HX711_basic and kitching_scale code from the library’s called above. Just a example sketch from the library. Differend examples and differend library’s.

Hi,

What do you mean by “data crashed”?
Please post the code you are using?

Look at this link and try their code, they use a different library.

Thanks… Tom… :grinning: :+1: :coffee: :australia:

Used sketch TESTING:
/*

HX711_ADC
Arduino library for HX711 24-Bit Analog-to-Digital Converter for Weight Scales
Olav Kallhovd sept2017

*/

/*
Settling time (number of samples) and data filtering can be adjusted in the config.h file
For calibration and storing the calibration value in eeprom, see example file “Calibration.ino”

The update() function checks for new data and starts the next conversion. In order to acheive maximum effective
sample rate, update() should be called at least as often as the HX711 sample rate; >10Hz@10SPS, >80Hz@80SPS.
If you have other time consuming code running (i.e. a graphical LCD), consider calling update() from an interrupt routine,
see example file “Read_1x_load_cell_interrupt_driven.ino”.

This is an example sketch on how to use this library
*/

#include <HX711_ADC.h>
#if defined(ESP8266)|| defined(ESP32) || defined(AVR)
#include <EEPROM.h>
#endif

//pins:
const int HX711_dout = 6; //mcu > HX711 dout pin
const int HX711_sck = 7; //mcu > HX711 sck pin

//HX711 constructor:
HX711_ADC LoadCell(HX711_dout, HX711_sck);

const int calVal_calVal_eepromAdress = 0;
unsigned long t = 0;

void setup() {
Serial.begin(57600); delay(10);
Serial.println();
Serial.println(“Starting…”);

float calibrationValue; // calibration value
calibrationValue = 696.0; // uncomment this if you want to set this value in the sketch
#if defined(ESP8266) || defined(ESP32)
//EEPROM.begin(512); // uncomment this if you use ESP8266 and want to fetch this value from eeprom
#endif
//EEPROM.get(calVal_eepromAdress, calibrationValue); // uncomment this if you want to fetch this value from eeprom

LoadCell.begin();
unsigned long stabilizingtime = 2000; // tare preciscion can be improved by adding a few seconds of stabilizing time
boolean _tare = true; //set this to false if you don’t want tare to be performed in the next step
LoadCell.start(stabilizingtime, _tare);
if (LoadCell.getTareTimeoutFlag()) {
Serial.println(“Timeout, check MCU>HX711 wiring and pin designations”);
}
else {
LoadCell.setCalFactor(calibrationValue); // set calibration factor (float)
Serial.println(“Startup is complete”);
}
while (!LoadCell.update());
Serial.print("Calibration value: ");
Serial.println(LoadCell.getCalFactor());
Serial.print("HX711 measured conversion time ms: ");
Serial.println(LoadCell.getConversionTime());
Serial.print(“HX711 measured sampling rate HZ: “);
Serial.println(LoadCell.getSPS());
Serial.print(“HX711 measured settlingtime ms: “);
Serial.println(LoadCell.getSettlingTime());
Serial.println(“Note that the settling time may increase significantly if you use delay() in your sketch!”);
if (LoadCell.getSPS() < 7) {
Serial.println(”!!Sampling rate is lower than specification, check MCU>HX711 wiring and pin designations”);
}
else if (LoadCell.getSPS() > 100) {
Serial.println(”!!Sampling rate is higher than specification, check MCU>HX711 wiring and pin designations”);
}
}

void loop() {
static boolean newDataReady = 0;
const int serialPrintInterval = 500; //increase value to slow down serial print activity

// check for new data/start next conversion:
if (LoadCell.update()) newDataReady = true;

// get smoothed value from the dataset:
if (newDataReady) {
if (millis() > t + serialPrintInterval) {
float i = LoadCell.getData();
Serial.print("Load_cell output val: ");
Serial.println(i);
newDataReady = 0;
t = millis();
}
}

// receive command from serial terminal, send ‘t’ to initiate tare operation:
if (Serial.available() > 0) {
char inByte = Serial.read();
if (inByte == ‘t’) LoadCell.tareNoDelay();
}

// check if last tare operation is complete:
if (LoadCell.getTareStatus() == true) {
Serial.println(“Tare complete”);
}

}

And then…
I mean with data crash:
Load_cell output val: -8.68
Load_cell output val: -8.75
Load_cell output val: -8.87
Load_cell output val: -8.98
Load_cell output val: -9.02
Load_cell output val: -9.08
Load_cell output val: -9.04
Load_cell output val: -9.06
Load_cell output val: -9.03
Load_cell output val: -9.06
Load_cell output val: -9.16
Load_cell output val: -9.29
Load_cell ⸮utput val: -9.40
⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮сم⸮遵⸮r⸮⸮jR⸮Load_cell ⸮-⸮⸮ ⸮X[’⸮⸮⸮⸮⸮:*⸮Load_cell ⸮-⸮t :,⸮⸮U9⸮⸮SH⸮Load_cell 7/it ⸮⸮v9V⸮WH⸮Load_cell w]]⸮⸮ñ5PKN⸮f⸮+⸮&⸮⸮⸮⸮⸮Z]HW⸮T9VMLC⸮Load_cell K⸮⸮⸮с⸮,:h)
wjR⸮Load_cell a]]H⸮⸮⸮$h⸮5⸮⸮
I wil now try library 4

FYI: This should be:
if (millis() - t > serialPrintInterval) {
That way the unsigned long math works across the roll-over (every 40+ days so it’s probably not causing your immediate problem)

Hi,
How are you powering your project?
Can you please post an image of your project so we can see your component layout?

Thanks… Tom… :grinning: :+1: :coffee: :australia:

Tom, thanks for replay.
Powering at this moment with USB power

It looks like the string constant is getting written over. Try keeping the string constant in FLASH to see if that helps:
Serial.print(F("Load_cell output val: "));


Pure basic. The pipe goos into the water and the pressure I want to now.
Bud before I do so, the pipe is besite the water and I just wait for a minute.

I get as result:
image

John thanks for reply,
Its not the answer:

Tom, thanks for the idee.
I did, its not a library from the Arduino library. I did used it and…:
image
Data crash

Serial.begin(57600);

Try;

Serial.begin(115200);

OR go the other way;

Serial.begin(9600);

Tom… :grinning: :+1: :coffee: :australia:

Indeed, out of the box, same sketch from HX711 library kitchen_scale works on a ESP8266. Strange bud is ok to me.
Thanks to you all for tips…
Peter

After a long try out:
I use library QUEUETUE HX711 it give’s a long number range. the left 4 numbers ar useful. When the weather chanches, also the range of the pressure from the HX711 chanche. You need a calibration pressure HX711 beside the sample reader.
When the hardware is missing or bad connection, the ESP8266 NodeMcu crashes.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.