HX711 calibration

I apologize for 'banging on' about this, but I've tried may examples of this subject and don't seem to be getting anywhere.

From examples in the Arduino IDE I have copied and amended the following code. It seems simple even to me but there's a big problem with it. Each time its run I get a different result!

Can anyone tell me why please?

What I'm trying to do is weigh a flower pot filled with absorbant material in the dry state (tare) and in the wet state (set_scale) The intention is to produce a maximum scale figure of 100 (to use as a 'percentage' rather than a weight.

#include "HX711.h"

#define DOUT  11
#define CLK  12
byte yesPin=0;
HX711 scale(DOUT, CLK);

float calibration_factor = 7050; //-7050 worked for my 440lb max scale setup

//================================================================

void setup() {

  Serial.begin(9600);

  scale.set_scale();
  scale.tare();

}
//================================================================

void loop() {

  Serial.println("Place weight 1 ");  
  delay(10000);
  scale.tare();
  
  Serial.println("Place weight 2 ");
  delay(10000);
  scale.set_scale(calibration_factor); //Adjust to this calibration factor
  
  Serial.print("Reading: ");
  Serial.print(scale.get_units(), 1);
  delay(400);
  //Serial.print(" lbs"); //Change this to kg and re-adjust the calibration factor if you follow SI units like a sane person
  Serial.print(" calibration_factor: ");
  Serial.print(calibration_factor);
  Serial.println();

while(yesPin==0){}
}

The bogde HX711 library has these instructions:

How to Calibrate Your Scale

    Call set_scale() with no parameter.
    Call tare() with no parameter.
    Place a known weight on the scale and call get_units(10).
    Divide the result in step 3 to your known weight. You should get about the parameter you need to pass to set_scale.
    Adjust the parameter in step 4 until you get an accurate reading.

If exactly following that doesn't give you satisfactory results, I'd suggest rolling your own calibration with raw readings to help you understand what's going on.

Put your dry pot on the scale, call read_average(); that raw value is equivalent to your "0 percent." Then put your reference weight on and do the same; that's your "100 percent" (or whatever percent your reference weight is...)

The remainder of the task - to convert any subsequent raw reading to a number between zero and 100 - is simple algebra. You will end up with the equation for a straight line that passes through the point (raw read at zero, 0%) and the point (raw read at reference weight, 100%). That is, y=mx+b where x=raw read, y=percentage, m=slope of the line, b=intercept; you will need to solve for m and b, using the values for those two points.

Due to various factors inherent in load cell design and operation, you probably will not get exactly 0% every time you put the dry pot on, and you probably will not get exactly 100% every time you put the reference weight on.

To demonstrate variability over time to yourself, try calling read() once a minute for an hour or three with your dry pot on and then do the same with the reference weight, or some other weight, on the scale. I bet that you will see the raw reads vary considerably.

And, if, once a day for a month, say, you turn your device on, put on the dry pot or reference weight, and call read_average(), you will probably not get exactly the same read_average() that you got on previous days.

There is much literature available on the WWW on load cell design and the problems to be overcome.

Thanks DaveEvans. I imagined that once set the reading would always be the same. You've given me a

headache now. I was thinking of trying out a 1NA125 but if the variation comes from the load cell itself .....

Plainly I'm going to have to do a deal of experimentation to satisfy my self that my idea is usable.

It shouldn’t be hard to get +/- 1% repeatability and precision with a DIY scale with the HX711, or maybe even one part in 1000. From here it seems like that ought to be good enough if you’re “just” filling flower pots, but only you know your project requirements.

Okay! So I tried a 1NA125, and discovered one or two things, firstly a breadboard is one of the most annoying things in this world, next I had the load cell upside down thinking the arrow printed on it meant the way of mounting and not the position of the weight it was to measure and thirdly it seems to want a preload although I thought its rating of 1kg would put it in the 500g range.

The pre-load itself appears to need to be about 500g! Less than this means there is no measurable variation in the output BUT I am planning on at a 'tare' weight less than this (about 325g) and a maximum weight of about 500g.

The question is how do I pre-load a load cell.