Reading WATERMARK Soil Moisture Sensors
Basic Overview
The
WATERMARK Soil Moisture Sensor measures electrical resistance inside of a granular matrix to determine soil water tension. Originally developed in the 1980's, many different methods and devices have been used to read the sensor both by IRROMETER as well as others.
To measure resistance inside the sensor, typically a voltage divider circuit is used. The circuit uses a known input voltage, output voltage, and series resistor value to calculate the value of another resistor (the sensor). Figure 1 is a simple example using a digital pin for power and an analog input to read and measure the resistance of the sensor.
Figure 1.
R=7870*(Vs-A1)/A1
Once the resistance is known, the value is calibrated to soil water tension via a series of equations or referencing look-up tables.
The WATERMARK sensor can be read by analog to digital devices such as Arduino/ Raspberry Pi etc., provided some guidelines are maintained with the reading circuitry and program.
Sensor Power
AC is the preferred excitation for reading WATERMARK sensors, as the alternating polarity prevents building a charge which both offsets the reading and degrades the electrodes over time. In cases where it is impractical to supply AC excitation, there are two options:
-
1. Pseudo-AC Short Pulse (preferred)
A "pseudo AC" created by alternating the current direction of a brief DC excitation for equal amounts of time. Output pins are alternated and isolated, with the second reading reversing the charge of the previous. This leaves the sensor with no accumulated potential, immediately ready for subsequent readings. The alternation can be done via switching the source and ground using additional hardware or by using a pin set low as the ground and switching the state of the two pins back and forth. As with the short pulse method, excitation should not exceed 50ms total and the measurement should be taken within 100us.
-
2. DC Short Pulse
If DC current is applied without alternating the polarities, excitation should not exceed 50ms and the reading should be taken 100us after the excitation is applied. Delaying the reading beyond 100us with a DC source will build a charge offset on the sensor, changing the measured resistance and reducing the life of the electrodes. After reading, the leads should be shorted together or the powered side shorted to ground for 30 seconds to remove any accumulated DC potential in the sensor.
Sensor Isolation
Devices reading WATERMARK sensors must isolate the sensor reading circuit from any earth ground. Mains powered devices will need transformer isolation to prevent a loop to ground through nearby equipment, and any communication line intended to be permanently connected to another grounded device will require optical isolation. If a ground loop exists, the readings will be wrong and current leakage may quickly destroy the sensor electrodes. Battery powered devices are more isolated by nature, but grounds for lightning protection etc. can cause the same problem.
In addition to general device isolation from ground, when reading multiple sensors the circuit must be designed to accommodate isolating sensors from each other. The wet soil in which sensors are installed creates a common conductive path between sensors. In effect, without isolation a device can be reading partially or fully between electrodes in different sensors rather than between electrodes inside each sensor.
Sensors must be powered individually, and the ground must be isolated from sensor to sensor. Even if powered individually, an open ground path to another un-powered sensor can't be allowed. This is best accomplished using multiplexers to open and close the appropriate channels.
Caution: Since WATERMARK sensors provide a direct path from earth to any device, protection via Zener or TVS diodes should be included on all sensor lines. In the interest of simplicity these are not included in any of examples to follow, but are highly recommended. Any such components will influence the measured readings and will have to be factored in to the reading program.
Figure 2 shows a sample schematic reading two WATERMARK sensors via the DC Short Pulse method using two 74HC4051 multiplexers, one to switch the power side and the other to isolate the ground. Four outputs are used to control the multiplexers (digital IO 2-5) and one (output-Vs) is used to provide excitation for the sensor while the measurement is made on an analog input. Only two sensors are shown, but six more could be accommodated by the same design.
Figure 2.
Calibration
The Rx value is based on the amount of moisture inside of the sensor, but an additional calibration is necessary to relate the resistance to soil water tension. The most commonly used calibration equation is the one developed by Dr. Clinton Shock in 1998:
kPa= (-3.213*R - 4.093) / (1 - 0.009733*R - 0.01205*T)
where R is resistance in kOhms and T is temp centigrade. This calibration covers the range of 10 to 100 kPa. Typically linear extrapolations are used below 10 and above 100 kPa. Note that a fully wet sensor measures 550 Ohms.
The measured resistance in the sensor is affected by temperature. A default temperature of 24 C can be used in the absence of temperature data, but a temperature sensor input can be used for increased accuracy.
The calibration used in IRROMETER devices is based on this equation, and a table can be downloaded at the end of this document for reference. The sample program provided for the example below also contains an example calibration method.
Example Implementation:
This example is Arduino MEGA based and capable of reading up to eight resistive sensors, in this case two WATERMARK sensors, one temperature sensor, and one 10K reference resistor. The reference resistor is included for development purposes to measure any offset in the reading circuit and would not normally be used in a final product. This example employs the pseudo-AC reading method by switching the state of PWM 5 and PWM 11.
The MEGA has sufficient analog and digital IO, but does not include the multiplexer capability required. Breakout boards are available for an off the shelf solution.
Ten PWM pins will be used to supply excitation to the sensors and to control the multiplexers and an analog pin will be used for sensor measurements. Two 74HC4051 multiplexers are used to provide isolation of both power and ground. The sensors will be read with PWM 5 set high and PWM 11 set low, then read again with PWM 5 set low and PWM 11 set high. The readings will be averaged and then be converted to soil water tension using the measured soil temperature via our calibration equation.
For the sake of illustration and flexibility in the design, all of the sensors are read with the same isolation, though in practice the temperature sensor would not require the same isolation as it is an encapsulated thermistor with no soil contact.
Figure 3.
Reading WM_1- Direction 1:
1. PWM 6 set LOW to enable multiplexers
2. PWM 11 is set LOW as GND
3. PWM 2,3, and 4 are set LOW, HIGH, and LOW
4. PWM 5 is set HIGH for sensor excitation
5. A1 is read to measure resistance
6. PWM 5 is set LOW to end the reading
Direction 2:
1. PWM 11 is set HIGH for excitation
2. A1 is read to measure resistance
3. PWM 11 is set LOW to end the reading
4. PWM 6 set HIGH to disable multiplexers
The same steps are repeated for each sensor, with the states of PWM 2,3,4 set as appropriate via the MUX truth tables to select the sensor to be measured.
The resistance can be calculated for each channel by reading the analog pin, converting the reading to volts using the appropriate formula for the direction of excitation, and solving for the unknown resistance using the known resistance (7.87K).
resistance_direction1 = 7870 * (Vs - average_of_A1_readings_direction1) / average_of_A1_readings_direction1 - any_resistance_added_by_MUX_pair
resistance_direction2 = 7870 * average_of_A1_readings_direction2 / (Vs - average_of_A1_readings_direction2) - any_resistance_added_by_MUX_pair
resistance = average of resistance_direction1, resistance_direction2
The resistance is then converted to centibars using three different equations depending on the value:
Resistance < 550 Ohms: CB=0
Resistance < 1000 Ohms: CB =(WM1_Resistance/1000*23.156-12.736)*-(1+0.018*(TempC-24)) *note- updated Aug 2021
Resistance > 1000 Ohms, but < 8000 Ohms: CB=(-3.213*(WM1_Resistance/1000.00)-4.093)/(1-0.009733*(WM1_Resistance/1000.00)-0.01205*(TempC))
Resistance > 8000 Ohms: CB=-2.246-5.239*(WM1_Resistance/1000.00)*(1+.018*(TempC-24.00))-.06756*(WM1_Resistance/1000.00)*(WM1_Resistance/1000.00)*((1.00+0.018*(TempC-24.00))*(1.00+0.018*(TempC-24.00)))
Optionally the equation above 8000 can be ignored and the >1000 equation used to full scale. This will deviate somewhat from our standard tables but still provide a good relative indication.
Download the code for this design as well as a simplified, single sensor Arduino Uno R3 example
here
Download the calibration look-up table
here