I placed the weights on the load cell and recorded the analogue readings. The results are given in the table below. The reading I took when there was no weight on the load cell is called the offset. We need to subtract this from the output reading to create the calibration line.
To complete the calibration I need a mathematical expression that relates the analogue output reading to a mass in kilograms. To do this I take my results above a plot a graph of load against output reading (minus the offset). This should be a straight line. I can then use the equation of this line to estimate the mass
of any load from the analogue reading. The graph of my results is shown below and I’ve used excel to generate a linear trend-line. The equation of this line gives me the relationship between the reading and the load. Those of you that are interested in statistics will note that the correlation coefficient is 1.0, i.e. there is a perfect fit of the data for this range of weights.
The x-axis is the analogue reading, therefore if my Arduino reads 250 the mass on the load cell is 1.93kg, as the weight of the tray is 0.119kg.
I am just going to do one more check. I am going to compare the loads estimated from the equation to those actually on the scale. The results are in the table below. They look pretty good, but remember if you want to weigh items outside of this range (i.e. less than 0.5kg and greater than 4.0kg) you should re-calibration the equipment. For values less than 0.5kg I suggest using a different resistor to adjust the gain.
The final part of this project for now is to extend the code to include the calibration line and provide an output reading as a weight. This can be downloaded from github, but don’t forget to replace the slope variable with your own value.
In this example the scale doesn’t return to zero when there is no weight on it. It is possible to zero it but not without compromising of the accuracy.