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

Arduino UNO-Based Smart Irrigation System with Wi-Fi and Solar Power

View and Edit Project In Cirkit DesignerImage of Arduino UNO-Based Smart Irrigation System with Wi-Fi and Solar Power

Circuit Documentation

Summary

This circuit is designed for an automated irrigation system that monitors soil moisture and rain conditions to control a water pump. The system uses an Arduino UNO as the main microcontroller, interfaced with various sensors and modules including soil moisture sensors, a rain sensor, a relay module, a servo motor, an LCD display, and a WiFi module. The system is powered by a solar panel and a 12V battery, regulated by a solar panel regulator.

Component List

  1. Arduino UNO

    • Description: Main microcontroller
    • 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. SparkFun Soil Moisture Sensor (2 units)

    • Description: Measures soil moisture level
    • Pins: VCC, GND, SIG
  3. 1 Channel 5V Relay Module

    • Description: Controls the water pump
    • Pins: VCC+, VCC- (GND), IN, N.O., COM, N.C.
  4. lcdi2c

    • Description: I2C LCD display
    • Pins: GND, VCC, SDA, SCL
  5. RAIN SENSOR

    • Description: Detects rain
    • Pins: AO, DO, GRD, VCC
  6. Water Pump

    • Description: Pumps water for irrigation
    • Pins: VCC, GND
  7. Wifi module ESP8266-01

    • Description: Provides WiFi connectivity
    • Pins: RX, GPIO0, GPIO2, GND, +3V3, Reset, CH-PD Chip power down, TX
  8. Solar Panel

    • Description: Provides power to the system
    • Pins: gnd, vcc
  9. Solar Panel Regulator 5A MPPT Controller Battery Charging 9V/12V/24V/Auto Switch

    • Description: Regulates power from the solar panel
    • Pins: +Vin, Ground, battery (-), battery(+)
  10. 12V 200Ah Battery

    • Description: Stores power for the system
    • Pins: GND, 12V
  11. Servo (Wokwi Compatible)

    • Description: Controls mechanical movements
    • Pins: GND, V+, PWM

Wiring Details

Arduino UNO

SparkFun Soil Moisture Sensor (2 units)

1 Channel 5V Relay Module

lcdi2c

RAIN SENSOR

Water Pump

Wifi module ESP8266-01

Solar Panel

Solar Panel Regulator 5A MPPT Controller Battery Charging 9V/12V/24V/Auto Switch

12V 200Ah Battery

Servo (Wokwi Compatible)

Documented Code

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

const int moistureSensorPin = A0;
const int rainSensorPin = D2;
const int relayPin = D3;
const int buzzerPin = D4;

int moistureThreshold = 500; // Example threshold value for moisture level

// WiFi configuration
const char* ssid = "YourWiFiSSID";
const char* password = "YourWiFiPassword";

// Initialize LCD
LiquidCrystal_I2C lcd(0x27, 16, 2); // I2C address and size

void setup() {
  Serial.begin(115200);

  // Set pin modes
  pinMode(moistureSensorPin, INPUT);
  pinMode(rainSensorPin, INPUT);
  pinMode(relayPin, OUTPUT);
  pinMode(buzzerPin, OUTPUT);

  // Start LCD and Wi-Fi
  lcd.begin();
  lcd.print("System Starting...");

  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(1000);
  }
  
  lcd.clear();
  lcd.print("WiFi Connected");
  delay(2000);
}

void loop() {
  int moistureLevel = analogRead(moistureSensorPin);
  int rainStatus = digitalRead(rainSensorPin);

  // Display current soil moisture on LCD
  lcd.setCursor(0, 0);
  lcd.print("Moisture: ");
  lcd.print(moistureLevel);

  // Check moisture level
  if (moistureLevel < moistureThreshold && rainStatus == LOW) {
    digitalWrite(relayPin, HIGH); // Turn on pump
    lcd.setCursor(0, 1);
    lcd.print("Irrigation ON");
  } else {
    digitalWrite(relayPin, LOW); // Turn off pump
    lcd.setCursor(0, 1);
    lcd.print("Irrigation OFF");
  }

  // Rain detection - suspend watering if raining
  if (rainStatus == HIGH) {
    digitalWrite(relayPin, LOW); // Turn off pump
    lcd.setCursor(0, 1);
    lcd.print("Rain Detected");
  }

  // Optional: send real-time updates via Wi-Fi to mobile or web interface
  // Implement Wi-Fi communication here (e.g., send HTTP request to server)

  delay(2000); // Update every 2 seconds
}

This code initializes