Arduino UNO-Based Smart Irrigation System with LCD Display and Relay-Controlled Water Pump
View and Edit Project In Cirkit Designer
Smart Irrigation System Documentation
Summary
This document provides a detailed overview of a smart irrigation system designed using an Arduino UNO microcontroller. The system includes a 16x2 LCD display, a DHT11 temperature and humidity sensor, a soil moisture sensor, a 1-channel relay, a water pump, and a 18650 Li-Ion battery. The system monitors soil moisture levels and environmental conditions, displaying the data on the LCD and controlling the water pump based on the soil moisture readings.
Component List
Arduino UNO
- Description: A microcontroller board based on the ATmega328P.
- Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
16x2 LCD
- Description: A 16x2 character LCD display.
- Pins: VSS, VDD, V0, RS, RW, E, D1, D0, D2, D3, D4, D6, D5, D7, A, K
1-Channel Relay (5V 10A)
- Description: A relay module for controlling high voltage devices.
- Pins: NC, signal, C, power, NO, ground
18650 Li-Ion
- Description: A rechargeable lithium-ion battery.
- Pins: Positive, Negative
DHT11
- Description: A temperature and humidity sensor.
- Pins: DATA, GND, VCC
Soil Moisture Module
- Description: A module for measuring soil moisture levels.
- Pins: VCC, GND, D0, A0
Resistor
- Description: A 10k Ohm resistor.
- Pins: pin1, pin2
- Properties: Resistance: 10k Ohms
Soil Moisture Sensor
- Description: A sensor for detecting soil moisture.
- Pins: positive, negative
Water Pump
- Description: A small water pump.
- Pins: positive, negative
Wiring Details
Arduino UNO
5V connected to:
- 16x2 LCD (VDD, RW, A)
- Soil Moisture Module (VCC)
- DHT11 (VCC)
- 1-Channel Relay (power)
GND connected to:
- Resistor (pin1)
- 16x2 LCD (VSS, K)
- Soil Moisture Module (GND)
- DHT11 (GND)
- 1-Channel Relay (ground)
D6 connected to:
- 16x2 LCD (RS)
D7 connected to:
- 16x2 LCD (E)
D8 connected to:
- 16x2 LCD (D4)
D9 connected to:
- 16x2 LCD (D5)
D10 connected to:
- 16x2 LCD (D6)
D11 connected to:
- 16x2 LCD (D7)
D12 connected to:
- DHT11 (DATA)
D13 connected to:
- 1-Channel Relay (signal)
A0 connected to:
- Soil Moisture Module (A0)
16x2 LCD
VDD connected to:
- Arduino UNO (5V)
VSS connected to:
- Arduino UNO (GND)
V0 connected to:
- Resistor (pin2)
RS connected to:
- Arduino UNO (D6)
RW connected to:
- Arduino UNO (5V)
E connected to:
- Arduino UNO (D7)
D4 connected to:
- Arduino UNO (D8)
D5 connected to:
- Arduino UNO (D9)
D6 connected to:
- Arduino UNO (D10)
D7 connected to:
- Arduino UNO (D11)
A connected to:
- Arduino UNO (5V)
K connected to:
- Arduino UNO (GND)
1-Channel Relay (5V 10A)
power connected to:
- Arduino UNO (5V)
ground connected to:
- Arduino UNO (GND)
signal connected to:
- Arduino UNO (D13)
C connected to:
- Water Pump (positive)
NO connected to:
- 18650 Li-Ion (Positive)
18650 Li-Ion
Positive connected to:
- 1-Channel Relay (NO)
Negative connected to:
- Water Pump (negative)
DHT11
VCC connected to:
- Arduino UNO (5V)
GND connected to:
- Arduino UNO (GND)
DATA connected to:
- Arduino UNO (D12)
Soil Moisture Module
VCC connected to:
- Arduino UNO (5V)
GND connected to:
- Arduino UNO (GND)
A0 connected to:
- Arduino UNO (A0)
Resistor
pin1 connected to:
- Arduino UNO (GND)
pin2 connected to:
- 16x2 LCD (V0)
Soil Moisture Sensor
positive connected to:
- Soil Moisture Module
negative connected to:
- Soil Moisture Module
Water Pump
positive connected to:
- 1-Channel Relay (C)
negative connected to:
- 18650 Li-Ion (Negative)
Code Documentation
#include <DHT.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(6, 7, 8, 9, 10, 11);
#define DHT11_PIN 12
#define DHTTYPE DHT11
DHT dht(DHT11_PIN, DHTTYPE);
int moisturePin = A0;
int moistureValue;
int relayPin = 13;
void setup() {
lcd.begin(16, 2);
pinMode(moisturePin, INPUT);
pinMode(relayPin, OUTPUT);
dht.begin();
lcd.setCursor(5, 0);
lcd.print("Smart ");
lcd.setCursor(0, 1);
lcd.print("IrrigationSystem");
delay(1500);
lcd.clear();
}
void loop() {
float temperature = dht.readTemperature();
float humidity = dht.readHumidity();
lcd.setCursor(0, 0);
lcd.print("Temp: ");
lcd.print(temperature);
lcd.print((char)223);
lcd.print("C");
lcd.setCursor(0, 1);
lcd.print("Humidity: ");
lcd.print(humidity);
lcd.print("%");
delay(2000);
lcd.clear();
moistureValue = analogRead(moisturePin);
moistureValue = map(moistureValue, 1023, 0, 0, 100);
lcd.setCursor(0, 0);
if (moistureValue <= 20) {
lcd.print("Moisture : HIGH");
} else if (moistureValue > 20 && moistureValue <= 80) {
lcd.print("Moisture : MID ");
} else if (moistureValue > 80) {
lcd.print("Moisture : LOW ");
}
lcd.setCursor(0, 1);
if (moistureValue <= 20) {
digitalWrite(relayPin, LOW);
lcd.print("Motor ON");
} else {
digitalWrite(relayPin, HIGH);
lcd.print("Motor OFF");
}
delay(1500);
lcd.clear();
}
This code initializes the LCD, DHT11 sensor, and soil moisture sensor. It reads temperature, humidity, and soil moisture levels, displaying the data on the LCD. Based on the soil moisture readings, it controls the water pump via the relay.