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

Arduino UNO Based Soil Moisture Monitoring and Alert System with I2C LCD and Relay-Controlled Buzzer

View and Edit Project In Cirkit DesignerImage of Arduino UNO Based Soil Moisture Monitoring and Alert System with I2C LCD and Relay-Controlled Buzzer

Circuit Documentation

Summary of the Circuit

This circuit is designed to monitor soil moisture levels and activate a buzzer and relay based on the moisture content. It features an Arduino UNO as the central microcontroller, interfaced with a 16x2 I2C LCD for display, a soil moisture module paired with a SparkFun Soil Moisture Sensor for detecting moisture levels, a 5V relay to control power to the buzzer, and a buzzer for audible alerts. The system is powered by two 9V batteries, with a rocker switch to control the power supply to the Arduino.

Component List

Arduino UNO

16x2 I2C LCD

5V Relay

Buzzer

Rocker Switch

9V Batteries (x2)

Soil Moisture Module

SparkFun Soil Moisture Sensor

Wiring Details

Arduino UNO

16x2 I2C LCD

5V Relay

Buzzer

Rocker Switch

Soil Moisture Module

SparkFun Soil Moisture Sensor

Documented Code

#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("IRRIGATION");
  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, HIGH);
    lcd.setCursor(0, 0);
    lcd.print("BUZZER is OFF ");
  } else {
    digitalWrite(2, LOW);
    lcd.setCursor(0, 0);
    lcd.print("BUZZER is ON");
  }

  if (value < 500) {
    lcd.setCursor(0, 1);
    lcd.print("Moisture : HIGH");
  } else if (value > 500 && 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 and sets up the Arduino to read the analog value from the soil moisture sensor. Depending on the moisture level, it activates or deactivates the relay (which controls the buzzer) and updates the display with the moisture status.