To get accurate readings from a monitor/irrigator device the soil moisture sensor readings need to be calibrated.
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.
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.
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.
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);
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):
Submerge the soil moisture sensor into completely dry soil and the "Raw sensor value" might look something like this (ie. 970):
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":
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.
Submerge the soil moisture sensor into wet soil and the "Raw sensor value" might look something like this (ie. 411):
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":
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.
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.