

The circuit in question is designed to monitor soil moisture using a Humidity YL-69 sensor and control a 5V mini water pump based on the moisture level. An Arduino UNO serves as the central microcontroller, interfacing with the sensor and an LCD I2C display to provide real-time feedback on the system status and soil moisture level. A relay module is used to control the power to the water pump, and a 12V battery provides the power supply for the system.
5V connected to Humidity YL-69 VCC, Relay Module V+, and LCD I2C Display VCCGND connected to Humidity YL-69 GND, Relay Module V-, and LCD I2C Display GNDVin connected to the positive terminal of the 12V batteryA0 connected to Humidity YL-69 A0 for analog moisture readingsA4 (SDA) connected to LCD I2C Display SDA for I2C dataA5 (SCL) connected to LCD I2C Display SCL for I2C clockD2 connected to Relay Module trigger for controlling the relayVCC connected to Arduino UNO 5VGND connected to Arduino UNO GNDA0 connected to Arduino UNO A0VCC connected to Arduino UNO 5VGND connected to Arduino UNO GNDSDA connected to Arduino UNO A4 (SDA)SCL connected to Arduino UNO A5 (SCL)+ connected to Arduino UNO Vin- connected to Arduino UNO GNDV+ connected to Arduino UNO 5VV- connected to Arduino UNO GNDcommon contact connected to the positive terminal of the 12V batterynormally open connected to the positive pin of the 5V mini water pumptrigger connected to Arduino UNO D2positive pin connected to Relay Module normally opennegative pin connected to the negative terminal of the 12V battery#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
Serial.begin(9600);
lcd.init();
lcd.backlight();
lcd.clear();
pinMode(2, OUTPUT);
digitalWrite(2, HIGH);
delay(1000);
lcd.setCursor(0, 0);
lcd.print("Rithunand's");
lcd.setCursor(0, 1);
lcd.print("SYSTEM IS ON ");
lcd.print("");
delay(3000);
lcd.clear();
}
void loop() {
int value = analogRead(A0);
Serial.println(value);
if (value > 950) {
digitalWrite(2, LOW);
lcd.setCursor(0, 0);
lcd.print("Water Pump is ON ");
} else {
digitalWrite(2, HIGH);
lcd.setCursor(0, 0);
lcd.print("Water Pump is OFF");
}
if (value < 300) {
lcd.setCursor(0, 1);
lcd.print("Moisture : HIGH");
} else if (value > 300 && value < 950) {
lcd.setCursor(0, 1);
lcd.print("Moisture : MID ");
} else if (value > 950) {
lcd.setCursor(0, 1);
lcd.print("Moisture : LOW ");
}
}
This code initializes the LCD display and sets up the Arduino to read the moisture level from the Humidity YL-69 sensor. Depending on the moisture level, it controls the relay to turn the water pump on or off and updates the display with the system status and moisture level.