Arduino UNO Based Automated Garden Monitoring and Watering System
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
The circuit in question is designed to monitor environmental conditions such as soil moisture, ambient light, temperature, and humidity. It utilizes an Arduino UNO as the central microcontroller to process sensor data and control peripherals like a relay module and an LCD display. The system is capable of reading soil moisture levels using a Soil Moisture Sensor, ambient light using an LDR module, and temperature and humidity using a DHT11 sensor. Based on the sensor readings, the Arduino can trigger relays to control external devices, and it displays the sensor data on an LCD screen with I2C communication.
Component List
Arduino UNO
- Microcontroller board based on the ATmega328P
- Used as the main controller for interfacing with sensors and modules
Soil Moisture Sensor
- Detects the moisture level in the soil
- Provides a digital or analog signal indicating moisture level
DHT11 Humidity and Temperature Sensor
- Measures ambient humidity and temperature
- Provides digital signal output with temperature and humidity data
Module LDR (Light-Dependent Resistor)
- Senses the level of ambient light
- Provides digital and analog outputs corresponding to light intensity
4 Channel Relay Module
- Allows the Arduino to control high power devices
- Contains four relays with Normally Open (N.O.) and Normally Closed (N.C.) contacts
LCD Screen 16x2 I2C
- Displays text on a 16x2 character screen
- Uses I2C communication for interfacing with the Arduino
Wiring Details
Arduino UNO
5VandGNDpins provide power to all other componentsA0connected to Soil Moisture Sensor signal pinA4(SDA) andA5(SCL) connected to LCD I2C pinsD2connected to DHT11 data pinD3connected to LDR digital output pinD5,D6,D7connected to relay module input pinsIN 1,IN 2,IN 3respectively
Soil Moisture Sensor
VCCconnected to Arduino5VGNDconnected to ArduinoGNDSIGconnected to ArduinoA0
DHT11 Humidity and Temperature Sensor
VDDconnected to Arduino5VDATAconnected to ArduinoD2GNDconnected to ArduinoGND
Module LDR
VCCconnected to Arduino5VGNDconnected to ArduinoGNDDOconnected to ArduinoD3
4 Channel Relay Module
VCC+connected to Arduino5VVCC- (GND)connected to ArduinoGNDIN 1,IN 2,IN 3connected to ArduinoD5,D6,D7respectively
LCD Screen 16x2 I2C
SCLconnected to ArduinoA5SDAconnected to ArduinoA4VCCconnected to Arduino5VGNDconnected to ArduinoGND
Documented Code
#include<LiquidCrystal_I2C.h>
#include "DHT.h"
#define DHTPIN 2
#define DHTTYPE DHT11
int a;
int ldr= 3;
int moist_sensor = A0 ;
int relaymoist = 5 ;
int relaydht = 6;
int relayldr = 7;
DHT dht(DHTPIN, DHTTYPE);
LiquidCrystal_I2C lcd(0x27,16,2);
void setup()
{
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);
pinMode(7,OUTPUT);
Serial.begin(9600);
dht.begin();
lcd.begin(16,2);
lcd.backlight();
lcd.setBacklight(HIGH);
lcd.setCursor(0,0);
lcd.print("Water");
lcd.setCursor(6,0);
lcd.print("Temp");
lcd.setCursor(11,0);
lcd.print("Humid");
}
void loop()
{
delay(500);
float h = dht.readHumidity();
float t = dht.readTemperature();
int intensity = digitalRead(ldr);
int moisture = analogRead(moist_sensor);
lcd.setCursor(6,1);
lcd.print(t);
lcd.setCursor(12,1);
lcd.print(h);
if (intensity == LOW){
digitalWrite(relayldr,HIGH);
}
else if(intensity == HIGH ){
digitalWrite(relayldr,LOW);
}
if(t>=30){
digitalWrite(relaydht,LOW);
}
else if(t<30){
digitalWrite(relaydht,HIGH);
}
if (moisture>=900)
{
digitalWrite(relaymoist, LOW );
lcd.setCursor(2,1);
lcd.print("1 ");
Serial.print("1 ");
}
else if(moisture>=850 && moisture<900)
{
digitalWrite(relaymoist, LOW );
lcd.setCursor(2,1);
lcd.print("2 ");
Serial.print("2 ");
}
else if(moisture>=800 && moisture<850)
{
digitalWrite(relaymoist, LOW );
lcd.setCursor(2,1);
lcd.print("3 ");
Serial.print("3 ");
}
else if(moisture>=750 && moisture<800)
{
digitalWrite(relaymoist, LOW );
lcd.setCursor(2,1);
lcd.print("4 ");
Serial.print("4");
}
else if(moisture>=700 && moisture<750)
{
digitalWrite(relaymoist, LOW );
lcd.setCursor(2,1);
lcd.print("5 ");
Serial.print("5");
}
else if(moisture>=650 && moisture<700)
{
digitalWrite(relaymoist, LOW );
lcd.setCursor(2,1);
lcd.print("6 ");
Serial.print("6");
}
else if(moisture>=550 && moisture<650)
{
digitalWrite(relaymoist, HIGH );
lcd.setCursor(2,1);
lcd.print("7 ");
Serial.print("7");
}
else if(moisture>=500 && moisture<550)
{
digitalWrite(relaymoist, HIGH );
lcd.setCursor(2,1);
lcd.print("8 ");
Serial.print("8");
}
else if(moisture>=450 && moisture<500)
{
digitalWrite(relaymoist, HIGH );
lcd.setCursor(2,1);
lcd.print("9 ");
Serial.print("9");
}
else if(moisture>=400 && moisture<450)
{
digitalWrite(relaymoist, HIGH );
lcd.setCursor(2,1);
lcd.print("10");
Serial.print("10");
}
Serial.print("|");
Serial.print(t);
Serial.print("C");
Serial.print("|");
Serial.print(h);
Serial.print("%");
Serial.println("|");
}
This code is responsible for initializing the sensors and LCD, reading sensor data, and controlling the relay module based on the sensor inputs. It also displays the moisture level, temperature, and humidity on the LCD screen and outputs the data to the serial monitor.