A Capacitive Soil Moisture Sensor is an electronic sensor used to measure the moisture level in soil without direct electrical contact between the sensing element and the soil. It works based on the change in capacitance caused by variations in soil moisture content.
How It Works
- The sensor has a capacitor-like structure with a PCB coating.
- When the soil moisture increases, the dielectric constant around the sensor changes.
- This change alters the capacitance, which is converted into an analog or digital signal.
- The output can be read by a microcontroller (e.g., Arduino, ESP8266, NodeMCU).
Advantages Over Resistive Sensors
- No corrosion: Capacitive sensors have no exposed metal, so they last longer.
- Stable readings: Less affected by soil salinity.
- More accurate for long-term use.
Output Types
- Analog (0–3.3V or 0–5V) → Represents soil moisture level.
- Digital (with comparator IC) → HIGH or LOW based on set threshold.
Pin Configuration
- VCC → Power supply (3.3V or 5V depending on model)
- GND → Ground
- AO → Analog output (moisture value)
- DO → Digital output (dry/wet signal, optional)
Applications
- Smart Irrigation Systems
- Greenhouse Monitoring
- Agricultural Automation
- IoT-Based Plant Care Systems
Wiring Connections
- Capacitive Sensor → NodeMCU
- VCC → 3.3V
- GND → GND
- AO → A0
Arduino Code
// Capacitive Soil Moisture Sensor with NodeMCU
const int soilPin = A0; // Analog pin
int soilValue = 0; // Variable to store moisture value
float moisturePercent = 0;
void setup() {
Serial.begin(115200);
Serial.println("Capacitive Soil Moisture Sensor Reading");
}
void loop() {
soilValue = analogRead(soilPin); // Read sensor value (0-1023)
// Convert to percentage (calibration may be required)
moisturePercent = map(soilValue, 1023, 300, 0, 100);
if (moisturePercent > 100) moisturePercent = 100;
if (moisturePercent < 0) moisturePercent = 0;
Serial.print("Raw Value: ");
Serial.print(soilValue);
Serial.print(" | Moisture: ");
Serial.print(moisturePercent);
Serial.println("%");
delay(1000); // Read every 1 second
}
How It Works
- analogRead(A0) reads values between 0–1023.
- map() converts this to 0–100% moisture level.
- Calibration is needed because soil type affects readings:
- Dry soil → near 1023
- Wet soil → near 300 (approx.)
Package includes: 1xSensor





















