Summary
Efficient water management is an important part of plant care, but fixed watering schedules do not always reflect actual soil conditions. Soil moisture can change throughout the day due to sunlight, temperature, and plant water consumption. This often results in plants receiving either too much or too little water.
In this project, we will build a Smart Irrigation System using Arduino Uno that automatically waters plants based on soil moisture levels. Using a soil moisture sensor, relay module, water pump, and LCD display, the system continuously monitors the soil and activates irrigation only when it is needed.

Components Required
To build this project, you will need:
- Arduino Uno board – This is the brain of the entire setup. It reads the moisture sensor data and decides when the water pump needs to be switched on or off.
- Soil moisture sensor module – This sensor sits in the soil and keeps checking how much moisture is present.
- 20x4 I2C LCD display – The LCD lets us see moisture readings, soil condition, and pump status directly on the project.
- Relay module – Since the Arduino cannot drive a water pump directly, we'll use a relay module as a switch to control the pump safely.
- Mini DC water pump – This is the component that actually delivers water to the plant whenever the soil becomes dry.
- Battery – The water pump requires its own power source, so a battery is used to provide the necessary power.
- Jumper wires – These help connect all the components together and make the circuit easier to assemble.
- Water container – Acts as the water reservoir from which the pump draws water.
- Plant pot – This is where the moisture sensor is placed and where the system monitors the soil conditions.
How the Project Works
Before building the circuit, let’s understand the basic working principle behind this project.
The soil moisture sensor is placed inside the soil and continuously measures the moisture content around its probes. The sensor sends an analog signal to the Arduino Uno, which compares the reading against a predefined threshold value.
When the soil becomes dry, the Arduino activates the relay module. The relay then switches on the water pump and starts supplying water to the plant. Once the moisture level increases beyond the threshold, the Arduino turns the relay off and stops the pump.
To make monitoring easier, the LCD display shows the current moisture value, soil condition, and pump status in real time.
Circuit Connections
Connect all the components as shown below.
Soil Moisture Sensor Connections
- Soil Moisture Sensor VCC → Arduino 5V
- Soil Moisture Sensor GND → Arduino GND
- Soil Moisture Sensor AO → Arduino A0
Relay Module Connections
- Relay Module VCC → Arduino 5V
- Relay Module GND → Arduino GND
- Relay Module IN → Arduino D7
LCD Display Connections
- LCD VCC → Arduino 5V
- LCD GND → Arduino GND
- LCD SDA → Arduino A4
- LCD SCL → Arduino A5
Water Pump Connections
- Water Pump (+) → Relay NO
- Relay COM → Battery (+)
- Water Pump (-) → Battery (-)
NOTE: Connect all grounds together, including the Arduino GND, relay GND, LCD GND, sensor GND, and battery negative terminal.
Building the Circuit
Start by connecting the soil moisture sensor to the Arduino Uno. Once the sensor wiring is complete, connect the relay module and LCD display according to the connections listed above.

Next, connect the water pump through the relay contacts. The relay acts as an electrically controlled switch, allowing the Arduino to control the pump safely without supplying motor current directly.
After completing the wiring, place the water pump inside a water container and insert the moisture sensor probes into the soil near the plant roots.
Before powering the circuit, double-check all power and ground connections.
Uploading the Arduino Code
After assembling the hardware, open the Arduino IDE and upload the following program.
#include
#include
LiquidCrystal_I2C lcd(0x27, 20, 4);
int sensorPin = A0;
int relayPin = 7;
int threshold = 500;
void setup() {
pinMode(relayPin, OUTPUT);
Serial.begin(115200);
lcd.init();
lcd.backlight();
lcd.setCursor(0,0);
lcd.print("SMART IRRIGATION");
delay(2000);
lcd.clear();
}
void loop() {
int moisture = analogRead(sensorPin);
Serial.print("Value: ");
Serial.println(moisture);
lcd.setCursor(0,0);
lcd.print("Moisture: ");
lcd.print(moisture);
lcd.print(" ");
if(moisture > threshold)
{
digitalWrite(relayPin, HIGH);
Serial.println("PUMP ON");
lcd.setCursor(0,1);
lcd.print("Soil : DRY ");
lcd.setCursor(0,2);
lcd.print("Pump : ON ");
}
else
{
digitalWrite(relayPin, LOW);
Serial.println("PUMP OFF");
lcd.setCursor(0,1);
lcd.print("Soil : WET ");
lcd.setCursor(0,2);
lcd.print("Pump : OFF ");
}
delay(1000);
}
Understanding the Code
Let's quickly look at what the program is doing behind the scenes.
The LCD libraries are initialized first so the display can communicate with the Arduino.
#include <wire.h>
#include <LiquidCrystal_I2C.h>
Inside the main loop, the Arduino continuously reads the moisture sensor value.
int moisture = analogRead(sensorPin)
The reading is then compared with a threshold value.
if(moisture > threshold)
If the soil is dry, the Arduino activates the relay.
digitalWrite(relayPin, HIGH);
This turns on the water pump and begins irrigation.
When sufficient moisture is detected again, the relay is switched off and the pump stops running.
At the same time, the LCD display updates the moisture reading and system status, allowing you to monitor the operation without opening the Serial Monitor.
Calibrating the Moisture Sensor
Different soil types can produce different sensor readings, so it is worth spending a few minutes calibrating the threshold value.
Start by observing the sensor reading in wet soil and then compare it with readings from dry soil. Based on these values, adjust the threshold in the code if required.
int threshold = 500;
A lower threshold will make the pump activate sooner, while a higher threshold will delay irrigation until the soil becomes drier.
Testing the System
Once the code is uploaded, place the sensor in moist soil and observe the LCD display.
The display should indicate that the soil is wet, and the pump should remain off.
Next, place the sensor in drier soil or allow the soil to dry naturally. As the moisture reading crosses the threshold value, the relay should activate and the water pump should start running.
The LCD will also update the soil condition and pump status, making it easy to verify that the system is responding correctly.
Expanding the Project
Once the basic system is working, there are several ways to add more functionality.
You can integrate:
- ESP32 development boards for wireless monitoring
- Water level sensors for tank monitoring
- Multiple soil moisture sensors
- Mobile app connectivity
- Cloud dashboards
- Solar-powered operation
These additions can turn a simple irrigation project into a more advanced smart agriculture system.
Final Thoughts
In this project, we built a Smart Irrigation System using Arduino Uno that automatically waters plants based on soil moisture levels. The project combines sensor monitoring, relay control, and automation into a practical application that can be used in gardens, indoor plants, and small farming setups.
Beyond the irrigation application itself, the project also provides a solid introduction to working with sensors, controlling external devices using relays, and building automated systems using Arduino.






