A drip irrigation controller built with Arduino can save Indian farmers up to 60% of water consumption while improving crop yields by delivering precisely the right amount of water to plant roots. Whether you are growing tomatoes in Maharashtra, grapes in Nashik, or chilies in Andhra Pradesh, this automated watering system eliminates the guesswork from irrigation scheduling and works even when you are away from the field.
Table of Contents
- Why Automate Drip Irrigation
- Components Required
- Wiring the System
- Arduino Code for Irrigation Control
- Soil Moisture Sensor Calibration
- Solenoid Valve and Relay Control
- Time-Based and Sensor-Based Scheduling
- Frequently Asked Questions
- Conclusion
Why Automate Drip Irrigation
India faces a severe water crisis with groundwater levels dropping in 60% of districts. Traditional flood irrigation wastes 40-50% of water to evaporation and runoff. Drip irrigation already saves water, but manual timer-based systems still overwater because they do not account for actual soil conditions, recent rainfall, or crop growth stage.
An Arduino-based automated controller reads soil moisture in real time and opens solenoid valves only when water is actually needed. Benefits include:
- 30-50% additional water savings over timer-based drip systems
- Reduced electricity costs for borewell pumps
- Consistent soil moisture prevents crop stress and improves quality
- Remote monitoring via GSM module for farmers managing distant plots
Components Required
| Component | Quantity | Approx. Price (₹) |
|---|---|---|
| Arduino Uno R3 | 1 | 450 |
| Capacitive Soil Moisture Sensor v1.2 | 3-4 | 100 each |
| 12V Solenoid Valve (1/2 inch) | 2-4 | 300 each |
| 4-Channel Relay Module (5V) | 1 | 180 |
| DS3231 RTC Module | 1 | 120 |
| 16×2 LCD with I2C Adapter | 1 | 200 |
| 12V 2A Power Adapter | 1 | 150 |
| DHT22 Sensor (optional) | 1 | 250 |
| Waterproof Enclosure (IP65) | 1 | 200 |
Total cost: approximately ₹2,500-3,500 depending on the number of zones.
Wiring the System
// Arduino Uno Wiring
// Soil Moisture Sensor 1: VCC→5V, GND→GND, AOUT→A0
// Soil Moisture Sensor 2: VCC→5V, GND→GND, AOUT→A1
// Soil Moisture Sensor 3: VCC→5V, GND→GND, AOUT→A2
// Relay Module: VCC→5V, GND→GND, IN1→D7, IN2→D8, IN3→D9, IN4→D10
// DS3231 RTC: VCC→5V, GND→GND, SDA→A4, SCL→A5
// LCD I2C: VCC→5V, GND→GND, SDA→A4, SCL→A5
// DHT22: VCC→5V, GND→GND, DATA→D4 (10kΩ pull-up)
Connect each solenoid valve to a relay channel. The relay provides the 12V switching required for solenoid valves while isolating the Arduino’s 5V logic from the higher voltage. Always use a flyback diode (1N4007) across the solenoid coil to suppress voltage spikes when the relay switches off.
Arduino Code for Irrigation Control
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <RTClib.h>
#define SOIL_1 A0
#define SOIL_2 A1
#define SOIL_3 A2
#define RELAY_1 7
#define RELAY_2 8
#define RELAY_3 9
// Moisture thresholds (calibrate for your soil)
#define DRY_THRESHOLD 40 // Below this = needs water
#define WET_THRESHOLD 70 // Above this = stop watering
LiquidCrystal_I2C lcd(0x27, 16, 2);
RTC_DS3231 rtc;
int readMoisture(int pin) {
int raw = analogRead(pin);
// Capacitive sensor: lower value = wetter
return map(raw, 600, 280, 0, 100);
}
void setup() {
Serial.begin(9600);
lcd.init(); lcd.backlight();
rtc.begin();
pinMode(RELAY_1, OUTPUT);
pinMode(RELAY_2, OUTPUT);
pinMode(RELAY_3, OUTPUT);
// Relays OFF at startup (active LOW)
digitalWrite(RELAY_1, HIGH);
digitalWrite(RELAY_2, HIGH);
digitalWrite(RELAY_3, HIGH);
}
void loop() {
DateTime now = rtc.now();
int m1 = readMoisture(SOIL_1);
int m2 = readMoisture(SOIL_2);
int m3 = readMoisture(SOIL_3);
// Only irrigate between 6 AM and 6 PM
if (now.hour() >= 6 && now.hour() < 18) {
digitalWrite(RELAY_1, m1 < DRY_THRESHOLD ? LOW : HIGH);
digitalWrite(RELAY_2, m2 < DRY_THRESHOLD ? LOW : HIGH);
digitalWrite(RELAY_3, m3 < DRY_THRESHOLD ? LOW : HIGH);
} else {
// Night: all valves off
digitalWrite(RELAY_1, HIGH);
digitalWrite(RELAY_2, HIGH);
digitalWrite(RELAY_3, HIGH);
}
lcd.setCursor(0, 0);
lcd.print("M1:" + String(m1) + " M2:" + String(m2));
lcd.setCursor(0, 1);
lcd.print("M3:" + String(m3) + " " + String(now.hour()) + ":" + String(now.minute()));
delay(60000); // Check every minute
}
Soil Moisture Sensor Calibration
Calibration is essential because different soil types in India have vastly different moisture characteristics. Red soil in Karnataka retains less water than black cotton soil in Vidarbha. To calibrate:
- Note the sensor reading in dry air (this is your 0% value)
- Submerge the sensor in water (this is your 100% value)
- Use the map() function to convert raw ADC readings to percentage
- Verify against known field capacity values for your soil type (available from your local Krishi Vigyan Kendra)
Solenoid Valve and Relay Control
Use 12V DC normally-closed solenoid valves for fail-safe operation: if the Arduino loses power, all valves close automatically and prevent water wastage. The relay module controls the 12V supply to each valve. Key considerations:
- Size valves for your drip line flow rate (typically 1/2″ for small farms, 3/4″ for larger plots)
- Install a mesh filter before the solenoid to prevent clogging from well water sediment
- Use a separate 12V supply for valves, sharing only ground with Arduino
- Add indicator LEDs on each relay output for visual confirmation in the field
Time-Based and Sensor-Based Scheduling
The best approach combines both methods. Use the RTC module for time windows (only irrigate between 6 AM and 6 PM to reduce evaporation) and soil moisture sensors for actual need detection within those windows. For the monsoon season (June-September), increase the DRY_THRESHOLD to avoid any irrigation during naturally wet periods. For peak summer (April-May), decrease it to trigger irrigation earlier as water stress is more damaging.
Frequently Asked Questions
Can this work with a borewell pump instead of municipal water?
Yes. Add a water level sensor in your storage tank and a relay to control the pump. Programme the Arduino to fill the tank when it drops below 30% and stop at 90% to prevent overflow. The irrigation valves draw from this tank.
How do I protect electronics from monsoon rain?
Use an IP65 rated enclosure with cable glands for wire entry. Mount it above ground level to avoid flooding. Apply conformal coating on the PCB for additional moisture protection. Most failures come from connector corrosion, so use quality waterproof connectors.
What happens during a power cut?
Normally-closed solenoid valves shut automatically when power is lost. The DS3231 RTC has a coin cell battery backup that keeps time accurate for years. When power returns, the Arduino resumes normal operation without any intervention.
Can I add GSM remote monitoring?
Yes. A SIM800L module costs around ₹350 and lets you receive SMS alerts for low moisture, valve activation, and system faults. You can also send SMS commands to override automatic controls when needed.
Conclusion
An Arduino-based drip irrigation controller is an affordable and practical upgrade for Indian farms. With components costing under ₹3,500, you can build a multi-zone system that saves water, reduces electricity costs, and improves crop yields. Start with a single zone, calibrate your sensors for local soil conditions, and expand as you see results. Find all the components you need at Zbotic’s online store with fast shipping across India.
Add comment