← Back to Course
Soil Moisture Sensors - Types and Calibration
💧 Soil Moisture Sensors - Complete Guide for Smart Irrigation
💧 What You'll Learn:
- 📊 Choose between resistive, capacitive, and professional sensors
- 💰 Save 30-40% of water while improving crop yields
- 🔌 Wire sensors correctly to ESP32/ESP8266/Pico
- 📏 Calibrate sensors for accurate moisture readings
Soil moisture sensors are essential for smart irrigation, saving 30-40% of water while improving crop yields. A $10 sensor can save thousands of liters annually!
📊 Types of Soil Moisture Sensors
| Type | Price | Pros | Cons | Lifespan |
|---|---|---|---|---|
| Resistive | $2-3 | Very cheap, simple | Corrodes quickly | 3-6 months |
| Capacitive | $8-12 | Long lasting, no corrosion | More expensive | Years |
| Professional | $50-200 | High accuracy | Very expensive | Years |
🌟 Recommendation for African Farmers:
Capacitive sensors are best value - they last years without corroding. Resistive sensors fail in 3-6 months.
🔌 Wiring (Capacitive Sensor)
Capacitive Sensor → ESP32 / ESP8266 / Pico W
VCC (3.3-5V) → 3.3V (or 5V for ESP8266)
GND → GND
AO (Analog Out) → GPIO32 (ESP32) / A0 (ESP8266) / GP26 (Pico)
⚠️ ESP8266 WARNING: A0 only accepts 0-1.0V! Use voltage divider:
3.3V ──┬── 10kΩ ──┬── A0 (ESP8266)
│ │
└── 20kΩ ──┴── GND
📊 Calibration Process (CRITICAL!)
// Step 1: Find DRY VALUE - sensor in dry air for 1 minute
// Step 2: Find WET VALUE - sensor in water for 1 minute
// Step 3: Update code with YOUR values
const int DRY_VALUE = 3800; // ← YOUR dry reading
const int WET_VALUE = 1500; // ← YOUR wet reading
int raw = analogRead(SOIL_PIN);
int moisture = map(raw, DRY_VALUE, WET_VALUE, 0, 100);
moisture = constrain(moisture, 0, 100);
Serial.printf("Soil Moisture: %d%%\n", moisture);
📖 Ideal Moisture Levels by Crop
| Crop | Ideal Moisture | Water Below | Saturation Above |
|---|---|---|---|
| 🌽 Maize/Corn | 60-75% | 50% | 85% |
| 🍅 Tomatoes | 65-80% | 55% | 85% |
| 🥬 Vegetables | 70-85% | 60% | 90% |
| 🌾 Wheat | 55-70% | 45% | 80% |
| 🥔 Potatoes | 60-75% | 50% | 85% |
💡 Pro Tips:
- Read sensors every 15-60 minutes (not constantly)
- Install at root depth (10-20cm) for accurate readings
- Use 3-5 sensors per zone and average the readings
- Clean capacitive sensors occasionally - dirt affects readings
⚠️ Common Mistakes:
- ❌ Not calibrating - every sensor is different!
- ❌ Buying resistive sensors - they corrode in months
- ❌ ESP8266 without voltage divider - damages ADC pin
- ❌ Installing too shallow - reading surface moisture only
📖 Success Story - Nigeria:
A vegetable farm installed capacitive sensors on 10 acres. Results after 3 months:
- 💧 38% reduction in water usage
- 📈 32% increase in crop yields
- 💰 $200/month saved on water bills
🎉 Key Takeaways:
- ✅ Capacitive sensors last YEARS (resistive fails in months)
- ✅ Always calibrate your specific sensor
- ✅ ESP8266 users need voltage divider for A0
- ✅ Read every 15-60 minutes - not constantly
💡 Key Takeaways:
- Apply these concepts directly to your farm or project.
- Take notes on important details for the quiz.
- Use the button below to track your progress.
×