Project Overview
This project automatically waters plants based on soil moisture level. It also measures temperature and humidity using the DHT11 sensor and displays the temperature on an I2C LCD display.
Features
- Automatic irrigation based on soil moisture
- Temperature and humidity monitoring
- LCD display output
- Water pump control using relay
- Low-cost and beginner-friendly IoT/agriculture project
Components Required
| Component | Quantity |
|---|---|
| Arduino UNO | 1 |
| Soil Moisture Sensor | 1 |
| DHT11 Temperature & Humidity Sensor | 1 |
| 16×2 I2C LCD Display | 1 |
| Relay Module (5V) | 1 |
| Mini Water Pump | 1 |
| Jumper Wires | As needed |
| Breadboard | 1 |
| Power Supply | 1 |
Working Principle
The soil moisture sensor measures the moisture level in the soil.
- If soil becomes dry:
- Arduino turns ON the relay
- Relay activates the water pump
- Plants get watered
- If soil is wet:
- Pump remains OFF
The DHT11 sensor continuously measures:
- Temperature
- Humidity
The temperature is displayed on the I2C LCD module.
Circuit Connections
1. Soil Moisture Sensor Connections
| Sensor Pin | Arduino Pin |
|---|---|
| VCC | 5V |
| GND | GND |
| AO | A0 |
2. DHT11 Sensor Connections
| DHT11 Pin | Arduino Pin |
|---|---|
| VCC | 5V |
| GND | GND |
| DATA | D2 |
3. I2C LCD Connections
| LCD Pin | Arduino Pin |
|---|---|
| VCC | 5V |
| GND | GND |
| SDA | A4 |
| SCL | A5 |
4. Relay Module Connections
| Relay Pin | Arduino Pin |
|---|---|
| VCC | 5V |
| GND | GND |
| IN | D7 |
5. Water Pump Connections
- Pump Positive → Relay NO terminal
- Pump Negative → Battery Negative
- Relay COM → Battery Positive
Arduino Libraries Required
Install these libraries from Arduino IDE Library Manager:
- DHT sensor library
- Adafruit Unified Sensor
- LiquidCrystal_I2C
Complete Arduino Code
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <DHT.h>
// DHT Sensor Setup
#define DHTPIN 2
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
// LCD Setup
LiquidCrystal_I2C lcd(0x27, 16, 2);
// Soil Moisture Sensor
int soilPin = A0;
int soilValue = 0;
// Relay Setup
int relayPin = 7;
// Threshold value
int threshold = 500;
void setup() {
Serial.begin(9600);
// Initialize DHT sensor
dht.begin();
// Initialize LCD
lcd.init();
lcd.backlight();
// Relay Pin
pinMode(relayPin, OUTPUT);
// Initially turn OFF pump
digitalWrite(relayPin, HIGH);
lcd.setCursor(0,0);
lcd.print("Smart Irrigation");
delay(2000);
lcd.clear();
}
void loop() {
// Read Soil Moisture
soilValue = analogRead(soilPin);
// Read Temperature and Humidity
float temperature = dht.readTemperature();
float humidity = dht.readHumidity();
// Display on Serial Monitor
Serial.print("Soil Moisture: ");
Serial.println(soilValue);
Serial.print("Temperature: ");
Serial.println(temperature);
Serial.print("Humidity: ");
Serial.println(humidity);
// Display on LCD
lcd.setCursor(0,0);
lcd.print("Temp: ");
lcd.print(temperature);
lcd.print((char)223);
lcd.print("C ");
lcd.setCursor(0,1);
// Soil Condition Logic
if (soilValue > threshold) {
lcd.print("Soil Dry PumpON");
// Turn ON Pump
digitalWrite(relayPin, LOW);
} else {
lcd.print("Soil Wet PumpOFF");
// Turn OFF Pump
digitalWrite(relayPin, HIGH);
}
delay(2000);
}
How to Upload the Code
- Open Arduino IDE
- Connect Arduino UNO
- Select:
- Board → Arduino UNO
- Port → Correct COM Port
- Paste the code
- Click Upload
Testing the Project
Dry Soil Test
- Remove sensor from wet soil
- Pump should turn ON
Wet Soil Test
- Insert sensor into wet soil
- Pump should turn OFF
Applications
- Smart agriculture
- Home gardening
- Greenhouse monitoring
- Water-saving systems
- Automatic plant watering
Advantages
- Saves water
- Reduces human effort
- Low cost
- Easy to build
- Energy efficient
Future Improvements
You can upgrade this project by adding:
- WiFi monitoring using ESP8266
- Mobile app control
- IoT dashboard
- Rain sensor
- Solar power supply
- Automatic fertilizer system
Troubleshooting
LCD Not Displaying
- Check I2C address
- Try:
0x27 or 0x3F
Pump Not Working
- Check external power supply
- Verify relay connections
Incorrect Sensor Readings
- Ensure proper wiring
- Avoid loose jumper wires
Conclusion
This Smart Irrigation System is an excellent beginner Arduino project that demonstrates automation in agriculture. It helps conserve water by watering plants only when needed and provides real-time environmental monitoring using the DHT11 sensor and LCD display.
It is a practical project for students, hobbyists, and IoT beginners.