Automatic Irrigation System
Using Arduino UNO
A smart farming solution that waters plants automatically based on real-time soil moisture levels — no manual effort needed.
🌱 Introduction
The Automatic Irrigation System is a smart farming solution that waters plants automatically based on soil moisture levels. The Arduino UNO continuously monitors soil conditions and drives a relay-controlled water pump — no manual intervention needed.
🔧 Components Required

🔌 Circuit Diagram
This diagram shows how all components are wired together. The soil sensor feeds analog data to Arduino A0, and Arduino Pin 7 controls the relay which switches the pump on/off.
📌 Pin Connections
🌱 Soil Moisture Sensor
Sensor Pin Connect To
VCC Arduino 5V
GND Arduino GND
A0 Arduino A0
⚡ Relay Module
Relay Pin Connect To
IN Arduino Pin 7
VCC Arduino 5V
GND Arduino GND
Important: Never power the water pump directly from Arduino. Always use an external power supply connected through the relay module to protect your board.
⚙️ Working Principle
The system runs a continuous monitoring loop. Here's the logic flow:
🟢 System Start
📡 Read Soil Sensor (Analog A0)
🤔 Moisture Value > Threshold?
▼
YES (Dry)
💧 Pump ON
digitalWrite LOW
▼
NO (Wet)
🛑 Pump OFF
digitalWrite HIGH
▼
⏱️ Wait 1 second (delay 1000ms)
▼
↩
← Loop repeats continuously
Step-by-Step Build Guide
1
Gather All Components
Collect the Arduino UNO, soil moisture sensor, relay module, DC water pump, jumper wires, breadboard (optional), and an external 5–12V power supply for the pump.
2
Wire the Soil Moisture Sensor
Connect sensor VCC → Arduino 5V, sensor GND → Arduino GND, and sensor A0 → Arduino analog pin A0. Insert the metal probes into the soil you want to monitor.
3
Connect the Relay Module
Connect relay IN → Arduino digital pin 7, relay VCC → Arduino 5V, relay GND → Arduino GND. The relay switches the pump's external power circuit — never route pump current through Arduino directly.
4
Connect the Water Pump via Relay
Connect the pump to the relay's COM and NO (Normally Open) terminals. Wire the external power supply (+) through the relay COM terminal, and pump's negative wire to the power supply (−).
5
Upload the Arduino Sketch
Open the Arduino IDE, paste the code below, and upload it to your board via USB. Open Serial Monitor (9600 baud) to watch live moisture readings and calibrate your threshold value.
6
Calibrate the Threshold
Observe the sensor reading in Serial Monitor when soil is dry vs. moist. Set the threshold variable accordingly (default is 500 — adjust based on your sensor and soil type).
7
Test & Deploy
Power everything on. Dry the soil or add water to verify the pump turns ON/OFF correctly. Place the water outlet pipe near the plant roots and you're done!
💻 Arduino Code
Upload this sketch to your Arduino UNO. Adjust the threshold value based on your sensor calibration.
ARDUINO C++
// Automatic Irrigation System
// makemindz.com
int soilPin = A0;
int relayPin = 7;
int threshold = 500; // Adjust based on calibration
void setup() {
pinMode(relayPin, OUTPUT);
Serial.begin(9600);
Serial.println("Irrigation System Starting...");
}
void loop() {
int moistureValue = analogRead(soilPin);
// Print value to Serial Monitor for calibration
Serial.print("Moisture: ");
Serial.println(moistureValue);
if (moistureValue > threshold) {
// Soil is DRY — turn pump ON
digitalWrite(relayPin, LOW); // Active LOW relay
Serial.println("Status: PUMP ON 💧");
} else {
// Soil is WET — turn pump OFF
digitalWrite(relayPin, HIGH); // Pump OFF
Serial.println("Status: PUMP OFF 🛑");
}
delay(1000); // Check every 1 second
}
Relay type note: The code uses Active LOW logic (LOW = pump ON). If your relay module is Active HIGH, swap LOW and HIGH in the digitalWrite calls.
🖥️ Try the Simulation
Test this circuit virtually on Tinkercad before building the real thing — no hardware required.
Open in Tinkercad
Interact with a live simulation of the Automated Plant Watering System — tweak values, test the code, explore the circuit.
↗
✨ Features & Advantages
Fully Automatic
No manual intervention — the system monitors soil and acts in real time.
Water Saving
Prevents overwatering by turning off as soon as moisture is detected.
Healthier Plants
Maintains optimal soil moisture for consistent plant growth.
Low Power
Arduino + relay uses minimal energy; pump only runs when needed.
Easy to Build
Simple wiring with common, low-cost components available everywhere.
Expandable
Add IoT, LCD, weather data, or multiple sensor zones easily.
🚀 Future Upgrades
IoT monitoring with mobile alerts
LCD display for moisture percentage
Timer-based irrigation scheduling
Weather API integration
Data logging to SD card or cloud
Solar-powered operation
Multi-zone crop irrigation
Blynk / MQTT dashboard
🗂️ More Arduino Projects
🔌 Circuit Diagram
This diagram shows how all components are wired together. The soil sensor feeds analog data to Arduino A0, and Arduino Pin 7 controls the relay which switches the pump on/off.
📌 Pin Connections
| Sensor Pin | Connect To |
|---|---|
| VCC | Arduino 5V |
| GND | Arduino GND |
| A0 | Arduino A0 |
| Relay Pin | Connect To |
|---|---|
| IN | Arduino Pin 7 |
| VCC | Arduino 5V |
| GND | Arduino GND |
⚙️ Working Principle
The system runs a continuous monitoring loop. Here's the logic flow:
digitalWrite LOW
digitalWrite HIGH
Step-by-Step Build Guide
Gather All Components
Collect the Arduino UNO, soil moisture sensor, relay module, DC water pump, jumper wires, breadboard (optional), and an external 5–12V power supply for the pump.
Wire the Soil Moisture Sensor
Connect sensor VCC → Arduino 5V, sensor GND → Arduino GND, and sensor A0 → Arduino analog pin A0. Insert the metal probes into the soil you want to monitor.
Connect the Relay Module
Connect relay IN → Arduino digital pin 7, relay VCC → Arduino 5V, relay GND → Arduino GND. The relay switches the pump's external power circuit — never route pump current through Arduino directly.
Connect the Water Pump via Relay
Connect the pump to the relay's COM and NO (Normally Open) terminals. Wire the external power supply (+) through the relay COM terminal, and pump's negative wire to the power supply (−).
Upload the Arduino Sketch
Open the Arduino IDE, paste the code below, and upload it to your board via USB. Open Serial Monitor (9600 baud) to watch live moisture readings and calibrate your threshold value.
Calibrate the Threshold
Observe the sensor reading in Serial Monitor when soil is dry vs. moist. Set the threshold variable accordingly (default is 500 — adjust based on your sensor and soil type).
Test & Deploy
Power everything on. Dry the soil or add water to verify the pump turns ON/OFF correctly. Place the water outlet pipe near the plant roots and you're done!
💻 Arduino Code
Upload this sketch to your Arduino UNO. Adjust the threshold value based on your sensor calibration.
// Automatic Irrigation System
// makemindz.com
int soilPin = A0;
int relayPin = 7;
int threshold = 500; // Adjust based on calibration
void setup() {
pinMode(relayPin, OUTPUT);
Serial.begin(9600);
Serial.println("Irrigation System Starting...");
}
void loop() {
int moistureValue = analogRead(soilPin);
// Print value to Serial Monitor for calibration
Serial.print("Moisture: ");
Serial.println(moistureValue);
if (moistureValue > threshold) {
// Soil is DRY — turn pump ON
digitalWrite(relayPin, LOW); // Active LOW relay
Serial.println("Status: PUMP ON 💧");
} else {
// Soil is WET — turn pump OFF
digitalWrite(relayPin, HIGH); // Pump OFF
Serial.println("Status: PUMP OFF 🛑");
}
delay(1000); // Check every 1 second
}
LOW and HIGH in the digitalWrite calls.
🖥️ Try the Simulation
Test this circuit virtually on Tinkercad before building the real thing — no hardware required.
Interact with a live simulation of the Automated Plant Watering System — tweak values, test the code, explore the circuit.
✨ Features & Advantages
No manual intervention — the system monitors soil and acts in real time.
Prevents overwatering by turning off as soon as moisture is detected.
Maintains optimal soil moisture for consistent plant growth.
Arduino + relay uses minimal energy; pump only runs when needed.
Simple wiring with common, low-cost components available everywhere.
Add IoT, LCD, weather data, or multiple sensor zones easily.
Comments
Post a Comment