Hello,
I am using the HX711 module and load cell with an arduino uno for force measurements.
I am using this library.
[Paste this link in your browser](https://github.com/olkal/HX711_ADC)
I first use the example "Calibration" code for calibration with a 200 g weight.
Then I save the calibration constant to the eeprom (choosing yes on the serial monitor).
After that, the load cell is able to measure weights accurately.
After that I remove the weight from the load cell and run this code after uncommenting the last line of this part of the code:
LoadCell.begin();
//LoadCell.setReverseOutput(); //uncomment to turn a negative output value to positive
float calibrationValue; // calibration value (see example file "Calibration.ino")
calibrationValue = 696.0; // uncomment this if you want to set the calibration value in the sketch
#if defined(ESP8266)|| defined(ESP32)
//EEPROM.begin(512); // uncomment this if you use ESP8266/ESP32 and want to fetch the calibration value from eeprom
#endif
EEPROM.get(calVal_eepromAdress, calibrationValue); // uncomment this if you want to fetch the calibration value from eeprom
The weights are measured accurately.
But when before powering the arduino, if I keep a weight on the load cell that weight is taken to be 0.
What change do I need to make to the code to prevent this problem?
I want to keep a weight on the load cell. After that power up the arduino. Then the weight already on the load cell should read the actual weight not 0.
Alternate Statement:
In other words, I want to use the HX711 module with the arduino and a load cell.
Before powering up the arduino I will keep a weight on the load cell. After powering up the weight value should be the absolute value instead of making the Weight Null.
@johnwasser Its not working.
I am using this code (I only change anything in the void setup() part the other parts are left untouched as in the examples from the library):
void setup() {
Serial.begin(57600); delay(10);
Serial.println();
Serial.println("Starting...");
LoadCell.begin();
//LoadCell.setReverseOutput(); //uncomment to turn a negative output value to positive
float calibrationValue; // calibration value (see example file "Calibration.ino")
calibrationValue = 696.0; // uncomment this if you want to set the calibration value in the sketch
#if defined(ESP8266)|| defined(ESP32)
//EEPROM.begin(512); // uncomment this if you use ESP8266/ESP32 and want to fetch the calibration value from eeprom
#endif
EEPROM.get(calVal_eepromAdress, calibrationValue); // uncomment this if you want to fetch the calibration value from eeprom
unsigned long stabilizingtime = 2000; // preciscion right after power-up can be improved by adding a few seconds of stabilizing time
boolean _tare = false; //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");
while (1);
}
else {
LoadCell.setCalFactor(calibrationValue); // set calibration value (float)
Serial.println("Startup is complete");
}
}
For this I am getting the following output (Note: The following output is obtained on startup when there is/there is no weight on the load cell):