To kick-start my longstanding ambition of getting back into electronics, I decided to try and make a device that measures the soil moisture of potted plants to determine whether they need to be watered. The aim for the first incarnation is to have a led that shows the plant's current water level (add water is red!), but of course I have wild plans for self-watering plants down the road.
My first stab was based on the Garduino instructable, specifically this circuit here:
It is a simple voltage divider using a known resistor and two copper wire electrodes stuck in the soil as measuring device. The voltage measured at
A0 using the ADC on my Teensy++ is proportional to the ratio of the resistances, and I can work back to the actual soil resistance.
However, in practice the soil resistance turned out to be subject to a very large drift. Almost immediately after turning on the device, the measured soil resistance started dropping. (This also happens if you stick a multimeter in the plant.) After a few days of measurement, I could find no usable connection between the measurements and the moisture level. Removing the probe and inspecting it revealed considerable tarnish on the anode. To me, this indicates that some sort of chemical reaction is taking place (electrolysis?). A multimeter measures a voltage differential of a few tens of millivolts: I have turned my plant into a battery!
To avoid this problem I moved to a probe constructed out of stainless steel screws. As they are considerably less reactive than copper, the oxidation should be less of a problem. Also, to avoid "charging" the soil, i have put the voltage divider between two digital output pins of the Teensy. The measurement happens as follows:
- Both pins are kept low when no measurement is taking place.
- I drive one pin high. I wait one millisecond and I measure the voltage at the center of the divider.
- I invert the pin voltages (high<->low), wait one millisecond and measure again. I should now measure the complement of the first measurement.
- Both pins are brought low again and the device sleeps until the next measurement.
This does reduce the oxidation problem, but the measured soil resistance still seems to start dropping as soon as I start measuring.
- Can anyone recommend a robust method to measure soil moisture?
- Can anyone explain what is really going on here?