SMART IRRIGATION PROJECT USING ARDUINO UNO WITH CIRCUIT AND CODE

Automatic Irrigation System Using Arduino UNO | MakeMindz
Intermediate Project

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.

Arduino UNO Soil Moisture Sensor Relay Module Water Pump Smart Farming

🌱 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.

💧 Soil is dry? — Moisture value exceeds threshold → Motor turns ON
🛑 Soil is wet? — Moisture value below threshold → Motor turns OFF

🔧 Components Required

🧠
Arduino UNO
× 1
🌡️
Soil Moisture Sensor
× 1
⚙️
DC Motor / Water Pump
× 1
🔌
Relay Module (5V)
× 1
🔗
Jumper Wires
as needed
💦
Pipe / Water Source
1 set
🔋
External Power Supply
for pump


🔌 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.

AUTOMATIC IRRIGATION SYSTEM — CIRCUIT DIAGRAM Arduino UNO 5V GND A0 5V GND D7 USB Soil Moisture Sensor probes into soil VCC GND A0 Relay Module ⚡ COIL IN VCC GND Water Pump External Power Supply switched power 5V GND A0 D7 5V GND Legend: 5V GND Signal Pump circuit

📌 Pin Connections

🌱 Soil Moisture Sensor
Sensor PinConnect To
VCCArduino 5V
GNDArduino GND
A0Arduino A0
⚡ Relay Module
Relay PinConnect To
INArduino Pin 7
VCCArduino 5V
GNDArduino 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

© 2026 MakeMindz.com — Arduino & Robotics Projects for Students

Comments

try for free