Soil Moisture Sensor
What is a Soil Moisture Sensor?
A soil moisture sensor estimates how much water is available around plant roots by measuring the electrical behavior of soil. It is one of the most useful sensors for smart irrigation, plant monitoring, greenhouse dashboards, and ESP32 IoT projects.
Resistive probes are cheap but corrode over time because current flows through exposed metal. Capacitive probes are usually better for long-term projects because they sense dielectric changes through a protected PCB surface.
Key Features
Plant Health Feedback
Tracks dry, moist, and saturated soil states so watering can respond to actual conditions.
Analog Output
Provides a variable voltage that can be mapped to a calibrated moisture percentage.
Smart Irrigation
Pairs naturally with relays, pumps, valves, and IoT dashboards for automated watering.
Calibration Friendly
Dry-air and wet-soil readings can be captured and mapped for your exact soil type.
Low Duty Cycle Ready
Power the probe only during measurements to reduce corrosion and save battery.
Beginner Useful
Great first analog sensor because changes are easy to observe in real projects.
Pin Configuration
VCC
Power input. Use 3.3V for ESP32 ADC compatibility or 5V for Arduino Uno modules that expect it.
GND
Ground reference connected to the microcontroller ground.
AO
Analog moisture signal. Connect to an ADC pin and calibrate dry and wet readings in code.
DO
Optional digital threshold output on comparator modules. Adjust trigger level with the onboard potentiometer.
How It Works
The Science Behind It
Resistive soil sensors measure how easily current flows between two exposed electrodes. Wet soil conducts better than dry soil, so the output changes with water content and dissolved minerals.
Capacitive soil sensors form part of an oscillator or RC circuit. Water changes the soil dielectric constant around the probe, which shifts the circuit output without requiring exposed metal electrodes.
Basic Calibration:
Dry reading = ADC value in air or dry soil
Wet reading = ADC value in saturated soil
Moisture % = map(reading, dry, wet, 0, 100)
Always calibrate for your soil and probe. Potting mix, garden soil, fertilizer, and salt content can shift readings.
Wiring Tips & Best Practices
Prefer Capacitive Probes
Use capacitive sensors for permanent plant projects because exposed resistive probes corrode faster.
Switch Sensor Power
Power the probe from a GPIO or transistor only while measuring to reduce corrosion and drift.
Average Readings
Take 10-20 ADC samples and average them to smooth noise from long wires and soil contact changes.
Watch Soil Chemistry
Fertilizer and salts affect conductivity, so do not treat raw ADC values as universal moisture values.
Place Near Roots
Insert the probe at root depth and avoid touching the pot wall for more meaningful readings.
Waterproof the Electronics
Only the probe area belongs in soil. Keep connectors and comparator boards dry.