Smart Irrigation System
Learning Objectives
- Read capacitive soil moisture sensor data and interpret dry/wet thresholds
- Measure temperature and humidity using a DHT11 sensor
- Control a relay module to switch a water pump on and off
- Implement automated decision logic based on multiple sensor inputs
- Log sensor readings over time and analyze trends
Overview
India loses billions of litres of water annually to inefficient irrigation. Your Smart Irrigation System uses a soil moisture sensor, a DHT11 climate sensor, and a relay-controlled pump to water a plant automatically — only when the soil is dry and temperature conditions are suitable.
Good to Know
Commercial smart irrigation products like the Rachio and B-Hyve use this exact principle but connect to weather APIs via Wi-Fi to skip watering on rainy days. Your project is the foundational prototype of this ₹5,000-crore market.
Components Required
| Component | Qty | Notes |
|---|---|---|
| Arduino Uno R3 | 1 | _ |
| Capacitive Soil Moisture Sensor v1.2 | 1 | Preferred over resistive (no corrosion) |
| DHT11 Temperature & Humidity Sensor | 1 | ±2 °C, ±5% RH accuracy |
Safety Notice
Good to Know
Relay and Water Safety: The relay module in this project switches a low-voltage DC pump (safe). Never use this relay to switch mains (230 V AC) electricity unless you are trained and supervised by a qualified electrician. Water and high voltage are extremely dangerous. Keep all electronics away from standing water.
Circuit Wiring
| Sensor Pin | Arduino Pin | |-----------|-------------| | VCC | 3.3 V (NOT 5 V — protects the sensor) | | GND | GND | | AOUT | A0 |
| DHT11 Pin | Arduino Pin | |-----------|-------------| | VCC | 5 V | | GND | GND | | DATA | Pin 7 |
Add a 10 kΩ pull-up resistor between DATA and VCC.
| Relay Pin | Arduino Pin | |----------|-------------| | VCC | 5 V | | GND | GND | | IN | Pin 8 |
Connect the pump's positive wire to the relay's COM terminal and the relay's NO (Normally Open) terminal back to the pump power supply positive.
Arduino Sketch
Install the DHT sensor library by Adafruit from Library Manager first.
// Smart Irrigation System
#include <DHT.h>
#define DHTPIN 7
#define DHTTYPE DHT11
#define SOIL_PIN A0
#define RELAY_PIN 8
DHT dht(DHTPIN, DHTTYPE);
// Thresholds (calibrate for your soil type)
const int DRY_THRESHOLD = 600; // ADC value — adjust after calibration
const int WET_THRESHOLD = 300;
Calibrating the Soil Sensor
Two-Point Soil Calibration
- Record the ADC reading from dry soil (leave unpotted soil out overnight). Note the value — this is your
DRY_THRESHOLD. - Fully soak the same soil with water and record the ADC reading. This is your
WET_THRESHOLD. - Update the constants in the sketch. The pump should turn on only when soil crosses the dry threshold.
Data Analysis
Watering Cycle Analysis
Run the system for 24 hours with a potted plant. Copy Serial Monitor data to a spreadsheet. Plot soil moisture (ADC) vs. time. Identify:
- How long after watering does the soil reach
WET_THRESHOLD? - How long does it take to dry back to
DRY_THRESHOLD? - How does temperature affect the drying rate?
