# IoT water tank telemetry project – part 2

## Calibration of the 4-20mA input

This article is a tutorial on calibrating the 4-20mA input which is designed for flexibility that is achieved through exploitation of the calibration.

The input device for this tutorial is a Pt100 RTD temperature sensor and inexpensive Chinese Pt100 – 4-20mA converter (loosely) calibrated for -50-150°. The Pt100, the converter, the load resistor, the divider resistors on the MCU board, and the MCu voltage reference all introduce error which is compensated in this end to end calibration procedure.

For this demonstration, two scenarios are measured:

1. probe in still air whose temperature is captured with an accurate thermometer; and
2. probe in boiling water whose temperature is calculated from known altitude and barometric pressure.

Another option would be to use a container of water filled with ice to obtain close to 0° for scenario 1… you don’t need a triple point cell for the end system stability and accuracy.

## Temperature of boiling water

No, we are not boiling an egg, but the results include the temperature of the boiling water under current altitude and pressure.

## Calculate calibration constants

The calibration constants are stored in config.lua.

Using http://owenduffy.net/calc/4-20cal.htm :

Set initial meas_slope=1 and meas_intercept=0 on the target, and entering the input and result data for the two scenarios:

Above, we have the new calibration constants to enter into config.lua.

You can of course achieve the same results using the formulas given in the README.md for the project, but the calculator is convenient and less likely to have uncaught errors.

Whilst the example here is not of a water tank, it demonstrates the wider application of the input circuit and processing. The whole project could equally well be used with a K thermocouple and 0-1300° 4-20mA converter to provide a remote monitor of say a pottery kiln, including historical graphical display.