Hi,

This article I want to dedicate scale sensor calibration issues. Why? Firstly – we have to convert a raw values from sensor to final (metric or imperial units), secondly we should correct possible errors related to non-linearity and eventual temporary dependencies. Last, but not least - in this article we start a series of our YouTube tutorials.

## Calibration

I presume, you don't have access to specialised workshop for load scale calibration (like me). Why, I asked? Because steps described bellow are more-less compromise for the person who do not have it.

1. Prepare a set of weights with known mass that cover load interval, used during measurement. For example I suppose weight of my beehive 100 kg. I have a sensor with capacity 50-150 kg. I prepared set of "calibration" weigths:

- 50 kg - 1 pc.
- 25 kg - 4 pcs.

2. Good idea is to use like weights sealable small containers or jerricans fill by the water. With accurate scale adjust exact mass of your weights.

3. Install sensors adjusted to the platforms together with tx unit in the environment with constant temperature. Ideally with temperature that correlates more less with temperature when beehive will be placed (for instance 20 degrees fo Celsius). **Remember this temperature. You need it for the next step.**

4. Remember - place of installation should not be exposed by vibrations or blasts of wind.

5. Download on our Github our small calibration routine ScaleCalibration.ino.

6. Compile and run it on tx unit and start first phase of calibration.

7. Prepare your excel sheet or something similar for writing of results. The final result should be table with two columns - WEIGHT and SIGNAL

8. Realize set of measurement with order:

- 0 kg
- 50 kg
- 75 kg
- 100 kg
- 125 kg
- 150 kg
- 125 kg
- 100 kg
- 75 kg
- 50 kg
- 0 kg

9. Pause between measurement should be longer than recovery period of the sensor. I used period 5 minutes.

10. At the end of measurement we have set of arranged couples WEIGHT-SIGNAL that provide us determine weighth based on known signal. Write it to the spreadsheet program. Microsoft Excel is the better choice - we will use it for next calculations.

11. In order to determine weight from the unknown signal we have to prepare mathematic model that expresses dependency WEIGHT - SIGNAL. For that goal we will use polynomial regression model of the third order:

**y = a _{0} + a_{1}x + a_{2}x^{2} + a_{3}x^{3}**

where

**y** is wanted weight, **x** is measured signal **a0**, **a1**, **a2**, **a3 **are variables that should be calculated by the polynomial regression (overall information see here).

12. Now download Excel file with calculator template from our Github CalibrationCalcTemplate.xlsx and follow our first YouTube tutorial.

## Temperature correction

The last step is calculation of correction coefficient. I preffered strategy where correction factor is depending on the difference between ACTUAL TEMPERATURE and TEMPRATURE OF CALIBRATION. As well I presume linear dependency of temperature error. So I start from formula:

**w _{C} = w_{M}_{ }- (t_{R }- t_{M})* slope**

where:

**w**_{C }is desired final weight after correction

**w**_{M }is weight obtain from calibration formula (see previous step)

**t _{R}** is temperature of sensor calibration (from previous step)

**t**_{M }is temperature of measurement

**slope** is coefficient that determines steepness of temperature dependency.

I have content of all variables except of slope. Here I use my old friend Excel again:

1. You have log of your measurement in this form:

2. Insert them into Excel and create X Y (Scatter) chart:

3. Then add to the chart linear trend-line by this action:

4. Finally tell to Excel add regression formula for regression expression of the trend-line:

5. The x multiplicator from the equation is desired output - the *slope*.

6. Finally place values of calibration temperature and the slope to the relevant part of tx source code:

It was our final step.

Stay tuned.

Tomas.