Monitor/Irrigator Sensor Calibration

To get accurate readings from a monitor/irrigator device the soil moisture sensor readings need to be calibrated.

Calibration Principles

Percentage Conversion

The soil moisture sensor outputs a value from 0 to 1023 because this is the resolution of the arduino analog input pins. To make it easier for humans to read this value needs to be converted to a percentage from 0 to 100.

Limited Range

While the soil moisture sensor outputs a value between 0 and 1023 it may never actually reach either of those values when submerged in soil even if it's bone dry or totally saturated. This means the percentage output would never reach (or even get close to) 0% or 100% as it should, unless properly calibrated.

Soil Conductivity Differences

Different types of soil have different levels of conductivity when dry and when wet. Calibration settings for one device may not be right for another, and therefore accurate calibration settings can't be provided by default.

Calibration addresses this by identifying the raw soil moisture sensor value when soil is wet, as well as the value when the soil is dry, and using these to properly calibrate the percentage output.

Calibration Process

Once the upper and lower (wet and dry) limits of the soil moisture sensor readings are known, the raw sensor value is mapped to a calibrated value between those two limits.

This is the mapping code from the SoilMoistureSensor.cpp file:

return map(soilMoistureSensorReading, drySoilMoistureCalibrationValue, wetSoilMoistureCalibrationValue, 0, 100);

How to Calibrate

Linear MQTT Dashboard

The Linear MQTT Dashboard mobile application can be used to calibrate the GreenSense monitor/irrigator devices.

To set up the GreenSense systems with support for Linear MQTT Dashboard follow the network walkthroughs.

Open the Linear MQTT Dashboard:

Select the tab corresponding to the device you want to calibrate (eg. Monitor1 or Irrigator1):

Dry Soil Calibration

Submerge the soil moisture sensor into completely dry soil and the "Raw sensor value" might look something like this (ie. 970):

  • Note: Don't worry if you get a different raw value to the one shown below.

In this system a "Soil Moisture" value of 5% when dry could be close enough to leave it as is. But it can be made even more accurate.

If the number is above 5% then calibration is necessary.

Move the "Dry" calibration slider to almost match the "Raw sensor value":

  • Note: Setting the dry calibration value slightly higher than the raw sensor value is recommended (eg. 10-20 points). This is to allow for natural fluctuations in the resistance of the analog sensor, wiring, soil, etc. to ensure the raw sensor value never exceeds the calibration limits. The example below uses 984 as the dry calibration setting instead of 974. This is intentional and recommended, as it's close enough while having a small margin of error.

The "Soil Moisture" value should update to be somewhere between 0% and 5%. It doesn't have to be exactly 0% or 1% for it to work.

Wet Soil Calibration

Submerge the soil moisture sensor into wet soil and the "Raw sensor value" might look something like this (ie. 411):

  • Note: Don't worry if you get a different raw value to the one shown below.

Notice that the "Soil Moisture" value is not even close to 100% as it should be. Calibration will fix this.

Move the "Wet" calibration slider to almost match the "Raw sensor value":

  • Note: Setting the wet calibration value slightly lower than the raw sensor value is recommended (eg. 10-20 points). This is to allow for natural fluctuations in the resistance of the analog sensor, wiring, soil, etc. to ensure the raw sensor value never exceeds the calibration limits. The example below uses 351 as the dry calibration setting instead of 367. This is intentional and recommended, as it's close enough while having a small margin of error.

Notice the "Soil Moisture" value is closer to 100%. It doesn't need to be exactly 100%, as long as it's above 95% it's close enough.

Use the Device

Submerge the soil moisture sensor into soil that you want to monitor/irrigate and view the "Soil Moisture" value at the top:

It should now more accurately reflect the soil moisture level.

Note: Despite calibrating the system there will always be variability and fluctuations in resistance. Even something as small as moving the soil moisture sensor may change the final output. Some experimentation may be required to find the correct calibration values, and the system may need to be re-calibrated after some time if the soil structure and therefore conductivity changes.