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

Arduino UNO Based Soil Moisture Monitoring and Water Pump Control System

View and Edit Project In Cirkit DesignerImage of Arduino UNO Based Soil Moisture Monitoring and Water Pump Control System

Circuit Documentation

Summary

This circuit is designed to monitor soil moisture levels using a YL-69 soil moisture sensor and control a 5V mini water pump via a KY-019 relay module based on the moisture data. The Arduino UNO serves as the central processing unit, reading the sensor data, driving the relay, and displaying information on an I2C LCD 16x2 screen. The system is powered by a 9V battery, and the relay module interfaces with the water pump to turn it on or off depending on the soil's moisture content.

Component List

Arduino UNO

KY-019 Relay Module 1 Channel

YL-69 Soil Moisture Sensor (Sonda)

YL-83 Module LM393

I2C LCD 16x2 Screen

9V Battery

5V Mini Water Pump

Wiring Details

Arduino UNO

KY-019 Relay Module 1 Channel

YL-69 Soil Moisture Sensor (Sonda)

YL-83 Module LM393

I2C LCD 16x2 Screen

9V Battery

5V Mini Water Pump

Documented Code

#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27,16,2);

int sensor_pin = A0;
int relay_pin = 7;

void setup() {
  Serial.begin(9600);
  lcd.begin(16,2);
  lcd.backlight();
  lcd.setBacklight(HIGH);

  pinMode(sensor_pin,INPUT);
  pinMode(relay_pin,OUTPUT);

}

void loop() {
  int sensor_data = analogRead(sensor_pin);
  Serial.print("Sensor_data: ");
  Serial.print(sensor_data);
  Serial.print("\t | ");

  if(sensor_data > 950){
    Serial.print("No Moisture, Soil is Dry");
    digitalWrite(relay_pin, HIGH);

    lcd.setCursor(0,0);
    lcd.print("Soil is Dry");
    lcd.setCursor(0,1);
    lcd.print("Motor On");
  }
  else if(sensor_data >= 400 && sensor_data <=950){
    Serial.print("There is Some Moisture, Soil is Stable");
    digitalWrite(relay_pin, LOW);

    lcd.setCursor(0,0);
    lcd.print("Soil is Stable");
    lcd.setCursor(0,1);
    lcd.print("Motor Off");
  }
  else if(sensor_data < 400){
    Serial.print("Soil is Wet");
    digitalWrite(relay_pin, LOW);

    lcd.setCursor(0,0);
    lcd.print("Soil is Wet");
    lcd.setCursor(0,1);
    lcd.print("Motor Off");
  }

  delay(100);

}

This code is designed to run on the Arduino UNO. It initializes the LCD screen and sets up the sensor and relay pins. In the main loop, it reads the moisture sensor data and prints it to the serial monitor. Depending on the moisture level, it updates the LCD display and controls the relay to turn the water pump on or off.