IoT & Automation

Smart Irrigation System

Arduino Uno Intermediate Level
Smart Irrigation System

Never forget to water your plants again! This Smart Irrigation System continuously monitors the soil moisture level. When the soil gets too dry, it automatically turns on a small water pump to hydrate your plant, turning off once the optimal moisture level is reached.

Components Used:

  • Arduino Uno
  • Soil Moisture Sensor
  • 5V Relay Module
  • Mini Submersible Water Pump + Tubing
  • External Power Supply (for pump)

How it Works:

The Soil Moisture Sensor acts as a variable resistor. When soil is wet, conductivity increases (resistance lowers). The Arduino reads this analog value. If the value goes above a certain threshold (meaning the soil is dry), the Arduino triggers the Relay, which switches on the Pump.

Arduino Code Snippet:


#define SENSOR_PIN A0
#define RELAY_PIN 7

int dryThreshold = 600; // Adjust based on calibration

void setup() {
  pinMode(RELAY_PIN, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  int moistureLevel = analogRead(SENSOR_PIN);
  Serial.print("Moisture: ");
  Serial.println(moistureLevel);

  // If reading is HIGH, resistance is HIGH -> Soil is DRY
  if (moistureLevel > dryThreshold) {
    digitalWrite(RELAY_PIN, LOW); // Turn on Pump (Active Low relay)
    Serial.println("Watering...");
  } else {
    digitalWrite(RELAY_PIN, HIGH); // Turn off Pump
  }
  delay(1000);
}