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

Arduino UNO-Based Smart Irrigation System with Soil Moisture and Water Level Sensors

View and Edit Project In Cirkit DesignerImage of Arduino UNO-Based Smart Irrigation System with Soil Moisture and Water Level Sensors

Circuit Documentation

Summary

This circuit is designed to monitor soil moisture levels and control a water pump using a relay. It also provides visual feedback using LEDs to indicate the moisture level. The circuit uses an Arduino UNO as the main microcontroller, interfacing with a soil moisture sensor, a water sensor, a relay, a DC motor (acting as a water pump), and three LEDs (green, yellow, and red) to indicate different moisture levels.

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. Soil Moisture Sensor

    • Description: Sensor to measure the moisture level in the soil.
    • Pins: VCC, GND, SIG
  3. Soil Moisture Module

    • Description: Module to interface with the soil moisture sensor.
    • Pins: positive, negative, Analog, Digital, Ground, VCC
  4. 5V Relay

    • Description: Relay module to control high voltage devices.
    • Pins: Normally Open, Common terminal, Normally Closed, In, GND, VCC
  5. 9V Battery

    • Description: Power source for the DC motor.
    • Pins: +, -
  6. DC Motor

    • Description: Motor to act as a water pump.
    • Pins: pin 1, pin 2
  7. Water Sensor

    • Description: Sensor to detect the presence of water.
    • Pins: Signal, VCC, GND
  8. LED: Two Pin (red)

    • Description: Red LED for visual indication.
    • Pins: cathode, anode
  9. LED: Two Pin (green)

    • Description: Green LED for visual indication.
    • Pins: cathode, anode
  10. LED: Two Pin (yellow)

    • Description: Yellow LED for visual indication.
    • Pins: cathode, anode
  11. Resistor (330 Ohms)

    • Description: Resistor to limit current through LEDs.
    • Pins: pin1, pin2

Wiring Details

Arduino UNO

Soil Moisture Sensor

Soil Moisture Module

5V Relay

9V Battery

DC Motor

Water Sensor

LED: Two Pin (red)

LED: Two Pin (green)

LED: Two Pin (yellow)

Resistor (330 Ohms)

Documented Code

int water; //random variable 
int value;

void setup() {
  pinMode(3, OUTPUT); //output pin for relay board, this will send signal to the relay
  pinMode(6, INPUT); //input pin coming from soil sensor
  pinMode(A0, INPUT);
  pinMode(13, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(11, OUTPUT);
}

void loop() { 
  water = digitalRead(6);  // reading the coming signal from the soil sensor
  if(water == HIGH) // if water level is full then cut the relay 
  {
    digitalWrite(3, LOW); // low is to cut the relay
  }
  else
  {
    digitalWrite(3, HIGH); //high to continue providing signal and water supply
  }
  delay(400); 
  value = analogRead(A0);
  if(value <= 300)
  {
    digitalWrite(13, 1); // Green
    digitalWrite(12, 0); // Yellow
    digitalWrite(11, 0); // Red
  }
  else if(value <= 400)
  {
    digitalWrite(13, 0); // Green
    digitalWrite(12, 1); // Yellow
    digitalWrite(11, 0); // Red
  }
  else
  {
    digitalWrite(13, 0); // Green
    digitalWrite(12, 0); // Yellow
    digitalWrite(11, 1); // Red
  }
}

This code initializes the pins for the relay, soil sensor, and LEDs. In the loop, it reads the soil moisture level and controls the relay accordingly. It also reads the water sensor value and lights up the appropriate LED based on the moisture level.