Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO-Based Automated Plant Watering System with LCD Display

View and Edit Project In Cirkit DesignerImage of Arduino UNO-Based Automated Plant Watering System with LCD Display

Circuit Documentation

Summary

This circuit is designed to monitor soil moisture levels and automatically water a plant when the soil is dry. It uses an Arduino UNO microcontroller to read data from a moisture sensor and control a water pump via a relay. An I2C LCD screen is used to display the moisture level and the status of the watering process.

Component List

  1. 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
  2. Humidity YL-69

    • Description: A soil moisture sensor.
    • Pins: A0, D0, GND, VCC
  3. 1-Channel Relay (5V 10A)

    • Description: A relay module used to control the water pump.
    • Pins: NC, signal, C, power, NO, ground
  4. I2C LCD 16x2 Screen

    • Description: A 16x2 character LCD screen with I2C interface.
    • Pins: SCL, SDA, VCC (5V), GND, VDD, VO, RS, RW, E, D0, D1, D2, D3, D4, D5, D6, D7, BLA, BLK
  5. Mini Water Pump

    • Description: A small water pump used to water the plant.
    • Pins: VCC, GND
  6. 5V Adapter

    • Description: A power adapter providing 5V output.
    • Pins: AC In 1, AC In 2, 5V, GND
  7. Adafruit JTAG 2x10 to SWD 2x5

    • Description: A JTAG to SWD adapter.
    • Pins: RESET, NC, SW0, SWDCLK, SWDIO, GND, VCC
  8. 2ch relay

    • Description: A 2-channel relay module.
    • Pins: NC, COM, NO, VCC, IN2, IN1, GND

Wiring Details

Arduino UNO

Humidity YL-69

1-Channel Relay (5V 10A)

I2C LCD 16x2 Screen

Mini Water Pump

5V Adapter

Code Documentation

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

// Initialize the LCD with I2C address 0x27 and 16x2 dimensions
LiquidCrystal_I2C lcd(0x27, 16, 2);

int moisturePin = A0;     // Moisture sensor connected to A0
int relayPin = 7;         // Relay signal connected to digital pin 7
int moistureValue = 0;    // Variable to store moisture sensor value
int threshold = 500;      // Moisture level threshold (adjust as needed)

void setup() {
  // Initialize the LCD
  lcd.begin();
  lcd.backlight();
  
  // Initialize the relay pin as an output
  pinMode(relayPin, OUTPUT);
  
  // Ensure the relay is off initially
  digitalWrite(relayPin, HIGH); // Relay is LOW-active, so HIGH means OFF
  
  // Begin serial communication for debugging (optional)
  Serial.begin(9600);
  
  // Welcome message on the LCD
  lcd.setCursor(0, 0);
  lcd.print("Plant Monitor");
  delay(2000);
  lcd.clear();
}

void loop() {
  // Read moisture sensor value (analog)
  moistureValue = analogRead(moisturePin);
  
  // Display moisture level on the LCD
  lcd.setCursor(0, 0);
  lcd.print("Moisture: ");
  lcd.print(moistureValue);

  // Determine if soil is dry or wet
  if (moistureValue < threshold) {
    // Soil is dry, activate the water pump
    digitalWrite(relayPin, LOW);  // Turn ON the pump (relay is LOW-active)
    lcd.setCursor(0, 1);
    lcd.print("Watering Plant");
  } else {
    // Soil is wet, turn off the pump
    digitalWrite(relayPin, HIGH); // Turn OFF the pump
    lcd.setCursor(0, 1);
    lcd.print("Soil is Moist   ");
  }

  // Optional: print sensor values to Serial Monitor for debugging
  Serial.print("Moisture: ");
  Serial.println(moistureValue);

  // Small delay before next reading
  delay(1000);
}

This code initializes the LCD and sets up the relay and moisture sensor. In the loop function, it reads the moisture sensor value, displays it on the LCD, and controls the water pump based on the moisture level. The pump is activated when the soil is dry and deactivated when the soil is moist.