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

Arduino-Controlled Soil Moisture Monitoring and Water Pump System

View and Edit Project In Cirkit DesignerImage of Arduino-Controlled Soil Moisture Monitoring and Water Pump System

Circuit Documentation

Summary

This circuit is designed to monitor soil moisture levels and control a water pump accordingly. It uses an Arduino UNO as the central microcontroller to read data from a soil moisture sensor and then drives a relay to turn on or off a 5V mini water pump based on the moisture level. The system also includes an I2C LCD 16x2 Screen to display the status of the soil moisture and the water pump.

Component List

1 Channel 5V Relay Module

5V Mini Water Pump

Arduino UNO

9V Battery

Soil Moisture Module

Soil Moisture Sensor

I2C LCD 16x2 Screen

Wiring Details

1 Channel 5V Relay Module

5V Mini Water Pump

Arduino UNO

9V Battery

Soil Moisture Module

Soil Moisture Sensor

I2C LCD 16x2 Screen

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.println(sensor_data);

    if(sensor_data > 950){
        Serial.println("No moisture, Soil is dry");
        digitalWrite(relay_pin, HIGH);
        lcd.setCursor(0,0);
        lcd.print("Soil Dry");
        lcd.setCursor(0,1);
        lcd.print("Water Pump ON");
    }
    else if(sensor_data >= 500 && sensor_data <= 700){
        Serial.println("Little Moisture is Present");
        digitalWrite(relay_pin, LOW);
        lcd.setCursor(0,0);
        lcd.print("Soil MEDIUM");
        lcd.setCursor(0,1);
        lcd.print("Water Pump OFF");
    }
    else if(sensor_data <= 400){
        Serial.println("Soil is Wet. Moisture is Maximum.");
        digitalWrite(relay_pin, LOW);
        lcd.setCursor(0,0);
        lcd.print("Soil WET");
        lcd.setCursor(0,1);
        lcd.print("Water Pump OFF");
    }
}

This code is responsible for reading the moisture level from the soil moisture sensor and controlling the relay to power the water pump. It also updates the LCD display with the current soil moisture status and the state of the water pump.