Collection: Soil Moisture & Water Sensors

Soil moisture and water sensors power plant-watering systems, tank alarms and leak detectors.

Soil sensors come in two kinds:

  • Resistive probes pass current through two bare prongs. They are cheap but corrode in the soil within weeks.
  • Capacitive sensors (such as the v2.0 boards) measure through a coated surface, so they last far longer. They are the better choice for anything left in a pot.

Both give an analog voltage that you must calibrate. Note the reading in dry air and in water, and do not assume which end reads higher until you have measured it.

For water, a resistive water-level board reports wet versus dry, which is fine for a leak alarm. The XKC-Y25 senses water through a plastic or glass tank wall up to 20 mm thick, so nothing goes inside the tank.

How to choose:

  • Pick capacitive for soil.
  • Pick a sensor plate for leaks.
  • Pick the XKC-Y25 for tanks.

On an ESP32, read analog sensors on ADC1 pins (such as GPIO34 or 35), because ADC2 stops working while Wi-Fi is on. The XKC-Y25 runs from 5-24V, so its output needs a diode or level shifter before an ESP32 pin.

Frequently asked questions

Capacitive or resistive soil sensor?

Capacitive. Resistive probes corrode within weeks, and capacitive ones last.

How do I calibrate a soil sensor?

Record the reading in air and in water, then map your readings between those two values.

Which ESP32 pin should I use?

An ADC1 pin such as GPIO34 or 35, which keeps working with Wi-Fi on.

Does the XKC-Y25 work on a metal tank?

No. It senses through plastic or glass walls up to 20 mm thick.

Guides

Reference pages on soldr.ai

Describe your build on Soldr and it picks the parts, writes and compiles the code, and shows how to wire them. Sign in and get 100 credits free.