Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Project Documentation

Arduino UNO-Based Smart Plant Watering System with LCD Display

Image of Arduino UNO-Based Smart 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 high-power devices.
    • 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 for watering plants.
    • 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

Wiring Details

Arduino UNO

  • 5V: Connected to VCC (5V) of I2C LCD 16x2 Screen, VCC of Humidity YL-69, and power of 1-Channel Relay.
  • GND: Connected to GND of I2C LCD 16x2 Screen, GND of Humidity YL-69, and ground of 1-Channel Relay.
  • D2: Connected to signal of 1-Channel Relay.
  • A0: Connected to A0 of Humidity YL-69.
  • A4: Connected to SDA of I2C LCD 16x2 Screen.
  • A5: Connected to SCL of I2C LCD 16x2 Screen.

Humidity YL-69

  • VCC: Connected to 5V of Arduino UNO.
  • GND: Connected to GND of Arduino UNO.
  • A0: Connected to A0 of Arduino UNO.

1-Channel Relay (5V 10A)

  • power: Connected to 5V of Arduino UNO.
  • ground: Connected to GND of Arduino UNO.
  • signal: Connected to D2 of Arduino UNO.
  • C: Connected to 5V of 5V Adapter.
  • NO: Connected to VCC of Mini Water Pump.

I2C LCD 16x2 Screen

  • VCC (5V): Connected to 5V of Arduino UNO.
  • GND: Connected to GND of Arduino UNO.
  • SDA: Connected to A4 of Arduino UNO.
  • SCL: Connected to A5 of Arduino UNO.

Mini Water Pump

  • VCC: Connected to NO of 1-Channel Relay.
  • GND: Connected to GND of 5V Adapter.

5V Adapter

  • 5V: Connected to C of 1-Channel Relay.
  • GND: Connected to GND of Mini Water Pump.

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.