← All Projects

Automatic Plant Irrigation System with Soil Moisture Sensor

255 viewsFebruary 24, 2026
ArduinoSoil MoistureRelayPumpIoTAgriculture

An automated plant watering system that monitors soil moisture levels and activates a water pump when the soil is too dry. Uses a capacitive soil moisture sensor and a relay module to control a 5V submersible pump.

Components & Supplies

×1Arduino Uno R3
×1Capacitive Soil Moisture Sensor v1.2
×15V Relay Module (1-Channel)
×15V Submersible Water Pump
×1Silicone Tubing (1m)

Circuit Connections

ComponentPinPinComponent
ArduinoA0AOUTSoil Sensor
Arduino5VVCCSoil Sensor
ArduinoGNDGNDSoil Sensor
ArduinoD7INRelay
Arduino5VVCCRelay
ArduinoGNDGNDRelay
RelayNO+Pump
5V Supply+-Pump

Overview

This automatic irrigation system keeps your plants healthy by monitoring soil moisture and watering them when needed. A capacitive soil moisture sensor reads the soil's water content and the Arduino compares it to a threshold. When the soil is dry, a relay switches on a small submersible pump to water the plant.

This project is ideal for balcony gardens, indoor plants, or greenhouse automation.

arduinoIrrigation Sketch
const int sensorPin = A0;
const int relayPin = 7;
const int dryThreshold = 600;
const int wetThreshold = 400;

void setup() {
  Serial.begin(9600);
  pinMode(relayPin, OUTPUT);
  digitalWrite(relayPin, HIGH); // Relay off (active-low)
  Serial.println("Irrigation System Ready");
}

void loop() {
  int moisture = analogRead(sensorPin);
  Serial.print("Soil Moisture: ");
  Serial.println(moisture);

  if (moisture > dryThreshold) {
    Serial.println("Soil is DRY - Pump ON");
    digitalWrite(relayPin, LOW);
    delay(5000); // Water for 5 seconds
    digitalWrite(relayPin, HIGH);
    Serial.println("Pump OFF - Waiting...");
    delay(30000); // Wait 30s before next check
  } else if (moisture < wetThreshold) {
    Serial.println("Soil is WET - No action");
  } else {
    Serial.println("Soil moisture OK");
  }

  delay(2000);
}