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

Arduino UNO-Based Smart Irrigation System with Soil Moisture Sensor and LCD Display

View and Edit Project In Cirkit DesignerImage of Arduino UNO-Based Smart Irrigation System with Soil Moisture Sensor and LCD Display

Circuit Documentation

Summary

This circuit is designed to monitor soil moisture levels and control a water pump based on the moisture readings. It also measures temperature and humidity using a DHT11 sensor and displays the readings on an LCD display. The circuit includes three LEDs (red, yellow, and green) to indicate the soil moisture status.

Component List

  1. Arduino UNO

    • Description: 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. DHT11 Humidity and Temperature Sensor

    • Description: Sensor for measuring temperature and humidity.
    • Pins: VDD, DATA, NULL, GND
  3. LED: Two Pin (green)

    • Description: Green LED.
    • Pins: cathode, anode
  4. LED: Two Pin (yellow)

    • Description: Yellow LED.
    • Pins: cathode, anode
  5. LED: Two Pin (red)

    • Description: Red LED.
    • Pins: cathode, anode
  6. LCD Display (16 pin)

    • Description: 16x2 character LCD display.
    • Pins: VSS, VDD, VO, RS, R_W, E, DB0, DB1, DB2, DB3, DB4, DB5, DB6, DB7, A, K
  7. Resistor

    • Description: 200 Ohms resistor.
    • Pins: pin1, pin2
  8. SparkFun Soil Moisture Sensor

    • Description: Sensor for measuring soil moisture.
    • Pins: VCC, GND, SIG
  9. 1 Channel Relay 5V

    • Description: Relay module for controlling high voltage devices.
    • Pins: VCC, GND, IN, NC, COM, NO
  10. 5V Battery

    • Description: 5V power supply.
    • Pins: +, -
  11. Water Pump

    • Description: Pump for watering plants.
    • Pins: VCC, GND

Wiring Details

Arduino UNO

DHT11 Humidity and Temperature Sensor

LED: Two Pin (green)

LED: Two Pin (yellow)

LED: Two Pin (red)

LCD Display (16 pin)

Resistor

SparkFun Soil Moisture Sensor

1 Channel Relay 5V

5V Battery

Water Pump

Code Documentation

#include <DHT.h>
#include <LiquidCrystal.h>

// Define DHT11 pin and type
#define DHTPIN 5
#define DHTTYPE DHT11

// Create DHT11 instance
DHT dht(DHTPIN, DHTTYPE);

// Define LCD pins
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

// Define pins for soil moisture and LEDs
const int sensorPin = A0;
const int pumpPin = 6;
const int redLEDPin = 2;
const int yellowLEDPin = 3;
const int greenLEDPin = 4;

// Define threshold values
const int dryThreshold = 300;
const int wetThreshold = 700;

void setup() {
  // Initialize serial communication
  Serial.begin(9600);

  // Initialize DHT11 sensor
  dht.begin();

  // Initialize LCD
  lcd.begin(16, 2);

  // Define pin modes
  pinMode(sensorPin, INPUT);
  pinMode(pumpPin, OUTPUT);
  pinMode(redLEDPin, OUTPUT);
  pinMode(yellowLEDPin, OUTPUT);
  pinMode(greenLEDPin, OUTPUT);
}

void loop() {
  // Read soil moisture value
  int sensorValue = analogRead(sensorPin);
  Serial.print("Soil Moisture Value: ");
  Serial.println(sensorValue);

  // Read temperature and humidity from DHT11
  float temperature = dht.readTemperature();
  float humidity = dht.readHumidity();

  // Check if readings are valid
  if (isnan(temperature) || isnan(humidity)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }

  Serial.print("Temperature: ");
  Serial.print(temperature);
  Serial.println(" °C");

  Serial.print("Humidity: ");
  Serial.print(humidity);
  Serial.println(" %");

  // Display values on LCD
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Soil: ");
  lcd.print(sensorValue);
  lcd.setCursor(0, 1);
  lcd.print("Temp: ");
  lcd.print(temperature);
  lcd.print("C Hum: ");