Table of Contents

Play Video

SMART IRRIGATION

Smart Irrigation System monitors soil moisture levels using a sensor and measures distance with an ultrasonic sensor. It displays the data on an I2C LCD and controls a water pump via a relay, ensuring plants receive adequate water. An LED provides a visual indicator of the pump's status. The system automates irrigation, enhancing plant care efficiency, conserving water, and reducing manual effort.

The Smart Irrigation System, an innovative automated solution, efficiently manages water usage in gardening and farming. By leveraging sensors and Arduino control, this system autonomously waters plants according to their specific moisture needs, ensuring optimal growth and conserving water resources. Additionally, it employs data analytics to analyze soil moisture trends and weather patterns, further optimizing watering schedules and enhancing crop yield. This technology not only simplifies irrigation tasks but also serves as an educational tool for students, demonstrating the principles of efficient resource management and sustainable agricultural practices in a practical and accessible manner.

Components/Circuit:

  • Soil Moisture Sensor: Measures soil moisture levels to determine watering needs.
  • Ultrasonic Sensor: Measures distance to detect plant proximity for efficient watering.
  • Arduino Board: Controls the irrigation system based on sensor data.
  • Water Pump: Dispenses water to plants as directed by the Arduino.
  • Relay Module: Enables Arduino to control the water pump.
  • LED with Current-Limiting Resistor (220 ohms): Provides a visual indication of the water pump’s status (on/off). The resistor is used to limit the current through the LED to prevent damage.
  • I2C LCD Display (e.g., 16×2): Displays text messages, such as the status of the water pump (“Water Pump On” or “Water Pump Off”), to provide feedback to the user.

How it Works:

  1. Sensing Moisture and Distance: Sensors detect soil moisture levels and plant proximity.
  2. Decision Making: Arduino processes sensor data to determine optimal watering times and amounts.
  3. Water Dispensing: The relay activates the water pump to deliver the right amount of water to plants.

Code

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <NewPing.h>

// Define pins for the ultrasonic sensor
#define TRIGGER_PIN  3
#define ECHO_PIN     2
#define MAX_DISTANCE 200 // Maximum distance to measure (in cm)

// Define pins for other components
#define SOIL_MOISTURE_PIN A3
#define LED_PIN 5
#define RELAY_PIN 4

// I2C address for the LCD
LiquidCrystal_I2C lcd(0x27, 16, 2);

// Create an instance of the NewPing library
NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE);

void setup() {
  pinMode(SOIL_MOISTURE_PIN, INPUT);
  pinMode(LED_PIN, OUTPUT);
  pinMode(RELAY_PIN, OUTPUT);

  // Initialize the LCD
  lcd.init();
  lcd.backlight();

  // Print initial message
  lcd.setCursor(0, 0);
  lcd.print("Soil Moisture:");
  lcd.setCursor(0, 1);
  lcd.print("Water Pump: OFF");
}

void loop() {
  // Read soil moisture level
  int moistureLevel = analogRead(SOIL_MOISTURE_PIN);
  
  // Map the analog reading to a percentage (0-100%)
  int moisturePercent = map(moistureLevel, 1023, 0, 0, 100);

  // Read distance from ultrasonic sensor
  unsigned int distance = sonar.ping_cm();

  // Update LCD with soil moisture percentage
  lcd.setCursor(13, 0);
  lcd.print(moisturePercent);
  lcd.print("% ");

  // Check soil moisture level and control water pump
  if (moisturePercent < 30) { // If moisture level is less than 30%
    digitalWrite(RELAY_PIN, HIGH); // Turn on relay (and pump)
    digitalWrite(LED_PIN, HIGH);   // Turn on LED
    lcd.setCursor(12, 1);
    lcd.print("ON ");
  } else {
    digitalWrite(RELAY_PIN, LOW); // Turn off relay (and pump)
    digitalWrite(LED_PIN, LOW);   // Turn off LED
    lcd.setCursor(12, 1);
    lcd.print("OFF");
  }

  // Display distance from ultrasonic sensor
  lcd.setCursor(0, 1);
  lcd.print("Dist: ");
  lcd.print(distance);
  lcd.print(" cm");

  delay(1000); // Wait for 1 second before the next reading
}

Benefits:

  • Water Conservation: Prevents over-watering by watering plants only when necessary, conserving water resources.
  • Plant Health: Ensures plants receive adequate water for optimal growth and health.
  • Automation: Reduces manual effort in watering tasks, freeing up time for other gardening activities.
  • Efficiency: Smart control optimizes water usage, promoting sustainable gardening and farming practices.

Application: Ideal for home gardens, urban farming, and agricultural fields, the Smart Irrigation System offers a convenient, efficient, and environmentally friendly way to manage plant watering needs.

Scroll to Top