Hi,
I am currently in the process of calibrating my load cell, and initially I decided to calibrate with a 1kg mass. I got a calibration factor of around 48400, however, I noticed that if I start adding more weight it begins to deviate from the true value.
The calibration factor for 2kg is 50500, and 51500 for 3kg.
Is there a reason for this deviation, and is there anything I can do to avoid it from happening?
I would run the hx711 library example code first to check basic operation ..
How the weight is connected to the load cell is important as the geometry may affect linearity .
You also need to calibrate with a weight that is at least 50% of its span value .
Need drawings /picture and wiring diagram
A calibration involves 2 known points to obtain gain nd offset. You have only one. Make another point for 3kg. Apply the gain and offset in the equation to know the actual weight of the unknown mass. You may try the following sketch:
/* This program takes 10 samples from LC + HX711B at
2-sec interval and then computes the average.
*/
unsigned long x = 0, y=0;
unsigned long dataArray[10];
int j = 0;
void setup()
{
Serial.begin(9600);
pinMode(A1, INPUT); //data line //Yellow cable
pinMode(A0, OUTPUT); //SCK line //Orange cable
}
void loop()
{
for (int j = 0; j < 10; j++)
{
digitalWrite(A0, LOW);//SCK is made LL
while (digitalRead(A1) != LOW) //wait until Data Line goes LOW
;
{
for (int i = 0; i < 24; i++) //read 24-bit data from HX711
{
clk(); //generate CLK pulse to get MSB-it at A1-pin
bitWrite(x, 0, digitalRead(A1));
x = x << 1;
}
clk(); //25th pulse
Serial.println(x, HEX);
y = x;
x = 0;
delay(1000);
}
dataArray[j] = y;
}
Serial.println("===averaging process=========");
unsigned long sum = 0;
for (j = 0; j < 10; j++)
{
sum += dataArray[j];
}
Serial.print("Average Count = ");
sum = sum / 10;
Serial.println(sum, HEX);
// float W = (float)0.90*(sum-901002)/946560 + 0.75;//0.005331 * sum - 1146.176;
//W = (float)W / 1000.00;
// Serial.println(W, 2);
}
void clk()
{
digitalWrite(A0, HIGH);
digitalWrite(A0, LOW);
}
Do you want to claim that the said load cell (the input device as a whole) is a pseudo ideal system whose gain is unity?
All practical devices are real devices (majority of them are linear) and they need to be artificially aligned (calibrated response, Fig-1) along the response line of an ideal system through 2-point calibration.
OK, a 2 and 3kg on a 1kg load cell would be out of spec, and could push it out of the linear range so a simple, linear, two-point calibtration isn't accurate. I'd calibrate it with your 1kg weight.
If you want to experiment with overloading it, I'd leave it calibrated with the 1kg, measure the 3kg, and then see if the 1kg still reads 1.000kg, and the 3kg measures whatever it does repeatably. If the numbers are repeatable, you could use a fancier/higher-order calibration to interpolate between the values.
The load is practically linear and can be easily verified by plotting the responses at known 3 or more known points (0 gm, C0; 250 gm, C1; 500 gm, C2; 1000 gm, C3) through the execution of the sketch of post #4. You simply find the gain and offset and place them in y = mx + k equation.
I used R, per the snippets of transcripts in #13. Instead, one could use Excel, add a couple X^2 and X^3 columns and use the Data Analysis/Regression tool.
How could be that I could not conceive this method though I was trained in 1979 at the age of 25 by a British Training Engineer (P.J. Erret at GEC Kidsgrove, UK) to think in a "simple way"?
Having looked at "0 as raw reading (post #13)" and then seeing "pow(raw, 2)" in your equation, my mind immediately recalled its learning that "something will be raised to the power of 2"; but, 0 is not something; so, how 02 would be evaluated?
I have verified that the expression pow(0, 2) is evaluated to 0, and (probably) it follows your opinion (0 x 0) which agrees with the "argument combination" of the referred file of GitHub.