Blog

Capacitive Soil Moisture Sensor – Complete Guide

Capacitive Soil Moisture Sensor

Capacitive Soil Moisture Sensor

Corrosion-Resistant Analog Soil Moisture Measurement

Older resistive soil moisture sensors work by passing a small current directly through the soil between two exposed metal probes and measuring the resulting resistance - simple, but the constant current flow through soil and probe metal drives electrolysis and corrosion, which measurably degrades a resistive probe within weeks of continuous use. Capacitive soil moisture sensors avoid this failure mode by measuring differently: the probe body itself is an insulated capacitor plate, and rather than passing current through the soil, an onboard oscillator circuit measures how the soil's dielectric properties - which change with moisture content - shift the capacitor's oscillation frequency, converting that into an analog voltage, with wetter soil consistently reading as a lower voltage on most breakout designs and drier soil as a higher one. Because no bare metal is ever in continuous electrical contact carrying current through the soil, capacitive sensors last dramatically longer in the ground than their resistive counterparts, at the cost of being somewhat more sensitive to needing a proper calibration between your specific sensor unit's dry-air and wet-soil readings rather than trusting a generic threshold.

Capacitive
Sensing Method
Analog Voltage
Output
Corrosion-Resistant
Durability

Key features

Corrosion-Resistant Design

No exposed metal carrying current through the soil, unlike resistive probes.

Long Service Life

Lasts months to years buried in soil rather than weeks.

Simple Analog Output

A single voltage reading, easy to read on any microcontroller ADC.

Wide Voltage Support

Runs from 3.3V to 5.5V, compatible with most boards.

Fast Response

Reacts quickly enough for real-time irrigation control loops.

Low Cost

An inexpensive way to add automated watering logic to a project.

Technical specifications

Supply Voltage 3.3V – 5.5V
Output Analog voltage (inversely related to moisture on most designs)
Sensing Method Capacitive (oscillator frequency shift)
Interface Single analog pin (3-pin module)
Probe Length ~98mm (varies by supplier)
Operating Current <20mA
Corrosion Resistance High - no bare current-carrying metal in soil
Response Time Near-instant analog reading
Package PCB probe with onboard oscillator/regulator board

Pinout

PinFunction
VCC Power supply
GND Ground
AOUT Analog output

Applications

Automated plant watering systems Greenhouse and grow-tent soil monitoring Garden irrigation controllers Agricultural soil-moisture logging Houseplant "needs water" alert projects Soil-moisture-triggered relay pumps

What's in the box

1x capacitive soil moisture sensor probe

Downloads

Datasheet (PDF) Arduino Soil-Moisture Example Sketch
🔌
Pin Connections
1 Table
Pin Connections Table 1
BoardSensor PinConnection
Soil SensorVCC/GND/AOUT3.3-5V / GND / board analog pin
📟
Capacitive Soil Moisture Sensor
7 Examples • C/C++ | Boards: Arduino Uno, Arduino Nano, Arduino Mega, ESP32, ESP8266, STM32, Raspberry Pi Pico
Capacitive Soil Moisture Sensor - Arduino Uno
Capacitive Soil Moisture Sensor - Arduino Nano
Capacitive Soil Moisture Sensor - Arduino Mega
Capacitive Soil Moisture Sensor - ESP32
Capacitive Soil Moisture Sensor - ESP8266
Capacitive Soil Moisture Sensor - STM32
Capacitive Soil Moisture Sensor - Raspberry Pi Pico
📄 File: capacitive_soil_moisture_sensor_-_arduino_uno.inoArduino Uno
538 characters
1//ekostra.com
2//electronics store in egypt
3//+201008896258
4
5// Analog pin A0 on Arduino Uno. Lower reading = wetter soil (less resistance between probes).
6#define SOIL_PIN A0
7
8void setup() {
9 Serial.begin(115200);
10}
11
12void loop() {
13 int raw = analogRead(SOIL_PIN);
14 float voltage = raw * 5.0 / 1023.0;
15
16 Serial.print("Soil moisture raw: "); Serial.print(raw);
17 Serial.print(" Voltage: "); Serial.print(voltage);
18 Serial.println(raw < 500 ? " -> Wet" : " -> Dry"); // calibrate threshold for your own soil/probe
19
20 delay(1000);
21}
📄 File: capacitive_soil_moisture_sensor_-_arduino_nano.inoArduino Nano
539 characters
1//ekostra.com
2//electronics store in egypt
3//+201008896258
4
5// Analog pin A0 on Arduino Nano. Lower reading = wetter soil (less resistance between probes).
6#define SOIL_PIN A0
7
8void setup() {
9 Serial.begin(115200);
10}
11
12void loop() {
13 int raw = analogRead(SOIL_PIN);
14 float voltage = raw * 5.0 / 1023.0;
15
16 Serial.print("Soil moisture raw: "); Serial.print(raw);
17 Serial.print(" Voltage: "); Serial.print(voltage);
18 Serial.println(raw < 500 ? " -> Wet" : " -> Dry"); // calibrate threshold for your own soil/probe
19
20 delay(1000);
21}
📄 File: capacitive_soil_moisture_sensor_-_arduino_mega.inoArduino Mega
539 characters
1//ekostra.com
2//electronics store in egypt
3//+201008896258
4
5// Analog pin A0 on Arduino Mega. Lower reading = wetter soil (less resistance between probes).
6#define SOIL_PIN A0
7
8void setup() {
9 Serial.begin(115200);
10}
11
12void loop() {
13 int raw = analogRead(SOIL_PIN);
14 float voltage = raw * 5.0 / 1023.0;
15
16 Serial.print("Soil moisture raw: "); Serial.print(raw);
17 Serial.print(" Voltage: "); Serial.print(voltage);
18 Serial.println(raw < 500 ? " -> Wet" : " -> Dry"); // calibrate threshold for your own soil/probe
19
20 delay(1000);
21}
📄 File: capacitive_soil_moisture_sensor_-_esp32.inoESP32
532 characters
1//ekostra.com
2//electronics store in egypt
3//+201008896258
4
5// Analog pin 34 on ESP32. Lower reading = wetter soil (less resistance between probes).
6#define SOIL_PIN 34
7
8void setup() {
9 Serial.begin(115200);
10}
11
12void loop() {
13 int raw = analogRead(SOIL_PIN);
14 float voltage = raw * 3.3 / 4095.0;
15
16 Serial.print("Soil moisture raw: "); Serial.print(raw);
17 Serial.print(" Voltage: "); Serial.print(voltage);
18 Serial.println(raw < 500 ? " -> Wet" : " -> Dry"); // calibrate threshold for your own soil/probe
19
20 delay(1000);
21}
📄 File: capacitive_soil_moisture_sensor_-_esp8266.inoESP8266
534 characters
1//ekostra.com
2//electronics store in egypt
3//+201008896258
4
5// Analog pin A0 on ESP8266. Lower reading = wetter soil (less resistance between probes).
6#define SOIL_PIN A0
7
8void setup() {
9 Serial.begin(115200);
10}
11
12void loop() {
13 int raw = analogRead(SOIL_PIN);
14 float voltage = raw * 3.3 / 1023.0;
15
16 Serial.print("Soil moisture raw: "); Serial.print(raw);
17 Serial.print(" Voltage: "); Serial.print(voltage);
18 Serial.println(raw < 500 ? " -> Wet" : " -> Dry"); // calibrate threshold for your own soil/probe
19
20 delay(1000);
21}
📄 File: capacitive_soil_moisture_sensor_-_stm32.inoSTM32
534 characters
1//ekostra.com
2//electronics store in egypt
3//+201008896258
4
5// Analog pin PA0 on STM32. Lower reading = wetter soil (less resistance between probes).
6#define SOIL_PIN PA0
7
8void setup() {
9 Serial.begin(115200);
10}
11
12void loop() {
13 int raw = analogRead(SOIL_PIN);
14 float voltage = raw * 3.3 / 4095.0;
15
16 Serial.print("Soil moisture raw: "); Serial.print(raw);
17 Serial.print(" Voltage: "); Serial.print(voltage);
18 Serial.println(raw < 500 ? " -> Wet" : " -> Dry"); // calibrate threshold for your own soil/probe
19
20 delay(1000);
21}
📄 File: capacitive_soil_moisture_sensor_-_raspberry_pi_pico.inoRaspberry Pi Pico
544 characters
1//ekostra.com
2//electronics store in egypt
3//+201008896258
4
5// Analog pin 26 on Raspberry Pi Pico. Lower reading = wetter soil (less resistance between probes).
6#define SOIL_PIN 26
7
8void setup() {
9 Serial.begin(115200);
10}
11
12void loop() {
13 int raw = analogRead(SOIL_PIN);
14 float voltage = raw * 3.3 / 4095.0;
15
16 Serial.print("Soil moisture raw: "); Serial.print(raw);
17 Serial.print(" Voltage: "); Serial.print(voltage);
18 Serial.println(raw < 500 ? " -> Wet" : " -> Dry"); // calibrate threshold for your own soil/probe
19
20 delay(1000);
21}
Capacitive (corrosion-resistant) analog soil moisture sensor.
Don't trust generic ”dry/wet” threshold numbers found online - dip the specific sensor in a cup of water for a wet reference and let it sit in open air for a dry reference, then set your own thresholds between those two real readings, since output varies noticeably between individual units and soil types. Insert the probe only up to the marked fill line, up to where the electronics board begins - the bare PCB electronics portion is not meant to be buried or submerged, only the sensing probe section is. And while far more corrosion-resistant than resistive probes, no soil sensor lasts forever fully submerged - periodically wiping it clean and checking readings against a fresh calibration keeps long-term automated watering systems accurate.