FC-28 soil moisture sensor
The resistive soil moisture sensor: a two-pronged fork in the soil and an LM393 board, with AO falling and DO going low as the soil gets wetter.
The fork is on a lead to the same comparator board the rain sensor has. Aliases: FC-28, YL-69, YL-38, soil hygrometer, resistive soil moisture sensor.
The fork's prongs are bare traces with nothing joining them but the soil, so the fork
is a resistor whose value is the soil's: dry soil barely conducts, wet soil conducts
well. The board puts the fork under a 10 k pull-up, so AO reads the full supply in
the air and lower as the soil gets wetter, and the comparator pulls DO low and
lights its lamp when AO falls under the trimmer.
Pins
| Pin | What it does |
|---|---|
VCC |
Supply, 3.3 V to 5 V. Best powered from a digital pin, see below. |
GND |
Ground. |
DO |
Low when the soil is wet enough. Open collector with a 10 k pull-up. |
AO |
The fork under its pull-up: lower means wetter. |
Properties
threshold is the trimmer as a fraction of the supply, 0.5 by default.
While it runs
Drag the slider from the air (0%) through dry and wet soil to a glass of water (100%). The soil darkens as it gets wetter. It starts at 15%, dry soil.
What the model gets right
The fork's resistance falls as the square of the moisture, 3.15 k x (100 / m)^2, and
it is open in the air. The square is borrowed from Archie's law, the rule soil
scientists use for how the conductivity of a porous material goes with how much water
is in it (a power close to 2 for most soils). On a 5 V Arduino that reads 1023 in the
air, 992 at 10% and 908 at 20% (dry soil), 400 at 70% and 337 at 80% (wet soil) and
245 in water, which is where the tutorials quote them. An unpowered board drives
nothing at all, which matters because of the advice below.
What it does not model
That curve is a shape, not a measurement of this fork: what a fork reads depends on the salts in the soil water as much as on the amount of water (fertilized potting mix reads far wetter than rain-washed sand), and on how deep it is pushed in, so every project calibrates its own. The fork corroding is not modeled: a DC current through wet soil is electrolysis, and a fork powered all the time plates away and drifts in weeks. Nor are the soil's own polarization (a real reading creeps for a moment after power-on), temperature, or how long soil takes to dry. The comparator has no hysteresis, as on the real board.
Common mistakes
Powering it all the time. Power VCC from a digital pin, switch it on, wait a few
milliseconds, read, and switch it off again; the fork lasts far longer that way.
Expecting a percentage. The reading is a resistance under a pull-up, and it goes
down as the soil gets wetter. Measure your own dry and wet numbers and map()
between them.
Using it for a long-term plant project. The capacitive stake (soilmoisture) has no
metal in the soil and does not corrode.
See it in action
Soil moisture meter powers the fork from pin 7 only while it reads, and shows dry, just right or wet on an I2C LCD. Open it at /templates.