-->
Page 1 of 1

HX711 and load cell calibration with NodeMCU ESP8266

PostPosted: Mon Jun 07, 2021 1:50 pm
by cocotajobs
Hey guys, I'm currently developing a weighting scale with a NodeMCU and a HX711, but I'm not being able to calibrate my load cells using a standard code, once it keeps reseting and displaying the following message:

ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 3584, room 16
tail 0
chksum 0xb0
csum 0xb0
v2843a5ac
~ld

Here is my code:

#include "HX711.h"

#define DOUT 5
#define CLK 4

//Change this calibration factor as per your load cell once it is found you many need to vary it in thousands
HX711 scale(DOUT, CLK);
float calibration_factor = -109525;

//=============================================================================================
// SETUP
//=============================================================================================
void setup() {

delay(0);
Serial.begin(9600);
Serial.println("HX711 Calibration");
Serial.println("Remove all weight from scale");
Serial.println("After readings begin, place known weight on scale");
Serial.println("Press a,s,d,f to increase calibration factor by 10,100,1000,10000 respectively");
Serial.println("Press z,x,c,v to decrease calibration factor by 10,100,1000,10000 respectively");
Serial.println("Press t for tare");
scale.set_scale();
delay(0);
scale.tare(); //Reset the scale to 0
delay(0);
long zero_factor = scale.read_average(); //Get a baseline reading
Serial.print("Zero factor: "); //This can be used to remove the need to tare the scale. Useful in permanent scale projects.
Serial.println(zero_factor);
delay(0);
}

//=============================================================================================
// LOOP
//=============================================================================================
void loop() {

ESP.wdtFeed();
delay(0);
scale.set_scale(calibration_factor); //Adjust to this calibration factor

Serial.print("Reading: ");
Serial.print(scale.get_units(), 3);
delay(0);
Serial.print(" kg");
Serial.print(" calibration_factor: ");
delay(1);
Serial.print(calibration_factor);
Serial.println();
ESP.wdtFeed();
delay(0);
if(Serial.available())
{
char temp = Serial.read();
if(temp == '+' || temp == 'a')
calibration_factor += 10;
else if(temp == '-' || temp == 'z')
calibration_factor -= 10;
else if(temp == 's')
calibration_factor += 100;
else if(temp == 'x')
calibration_factor -= 100;
else if(temp == 'd')
calibration_factor += 1000;
else if(temp == 'c')
calibration_factor -= 1000;
else if(temp == 'f')
calibration_factor += 10000;
else if(temp == 'v')
calibration_factor -= 10000;
else if(temp == 't')
scale.tare(); //Reset the scale to zero
}
delay(50);
}



If anyone has a suggestion or a solution I would really appreciate it