Cnipbotics
Home
CoursesPricingContact
All Projects
Intermediate

Smart Irrigation System

Automate plant watering using a capacitive soil moisture sensor and DHT11 climate sensor to control a relay-switched pump that turns on only when soil is dry and temperature is suitable.

Arduino Uno R3, Capacitive Soil Moisture Sensor, DHT11 Sensor, 5V Relay Module, Mini Submersible Pump, Breadboard, Jumper Wires
Smart Irrigation System

Smart Irrigation System

Learning Objectives

  • Read capacitive soil moisture sensor data and interpret dry/wet thresholds
  • Measure temperature and humidity using a DHT11 sensor
  • Control a relay module to switch a water pump on and off
  • Implement automated decision logic based on multiple sensor inputs
  • Log sensor readings over time and analyze trends

Overview

India loses billions of litres of water annually to inefficient irrigation. Your Smart Irrigation System uses a soil moisture sensor, a DHT11 climate sensor, and a relay-controlled pump to water a plant automatically — only when the soil is dry and temperature conditions are suitable.

Good to Know

Commercial smart irrigation products like the Rachio and B-Hyve use this exact principle but connect to weather APIs via Wi-Fi to skip watering on rainy days. Your project is the foundational prototype of this ₹5,000-crore market.


Components Required

ComponentQtyNotes
Arduino Uno R31_
Capacitive Soil Moisture Sensor v1.21Preferred over resistive (no corrosion)
DHT11 Temperature & Humidity Sensor1±2 °C, ±5% RH accuracy
5 V Single-Channel Relay Module110 A / 250 VAC capacity
Mini Submersible Water Pump13–5 V DC, ~1 W
Small Container + Tubing1Water reservoir + 30 cm silicone tube
Potted Plant or Soil Sample1For testing
Jumper Wires12+_

Safety Notice

Good to Know

Relay and Water Safety: The relay module in this project switches a low-voltage DC pump (safe). Never use this relay to switch mains (230 V AC) electricity unless you are trained and supervised by a qualified electrician. Water and high voltage are extremely dangerous. Keep all electronics away from standing water.


Circuit Wiring

Step 1
Soil Moisture Sensor

| Sensor Pin | Arduino Pin | |-----------|-------------| | VCC | 3.3 V (NOT 5 V — protects the sensor) | | GND | GND | | AOUT | A0 |

Step 2
DHT11 Sensor

| DHT11 Pin | Arduino Pin | |-----------|-------------| | VCC | 5 V | | GND | GND | | DATA | Pin 7 |

Add a 10 kΩ pull-up resistor between DATA and VCC.

Step 3
Relay Module

| Relay Pin | Arduino Pin | |----------|-------------| | VCC | 5 V | | GND | GND | | IN | Pin 8 |

Connect the pump's positive wire to the relay's COM terminal and the relay's NO (Normally Open) terminal back to the pump power supply positive.


Arduino Sketch

Install the DHT sensor library by Adafruit from Library Manager first.

// Smart Irrigation System
#include <DHT.h>
 
#define DHTPIN     7
#define DHTTYPE    DHT11
#define SOIL_PIN   A0
#define RELAY_PIN  8
 
DHT dht(DHTPIN, DHTTYPE);
 
// Thresholds (calibrate for your soil type)
const int DRY_THRESHOLD  = 600; // ADC value — adjust after calibration
const int WET_THRESHOLD  = 300; // ADC value
const float MAX_TEMP_C   = 38.0; // Don't water if too hot (evaporation loss)
 
bool pumpRunning = false;
 
void setup() {
  Serial.begin(9600);
  pinMode(RELAY_PIN, OUTPUT);
  digitalWrite(RELAY_PIN, HIGH); // Relay is active-LOW; HIGH = pump OFF
  dht.begin();
  Serial.println("Smart Irrigation System Ready");
  Serial.println("Soil\tTemp(C)\tHumidity(%)\tPump");
}
 
void loop() {
  int soilRaw    = analogRead(SOIL_PIN);
  float tempC    = dht.readTemperature();
  float humidity = dht.readHumidity();
 
  if (isnan(tempC) || isnan(humidity)) {
    Serial.println("DHT11 read error — check wiring");
    delay(2000);
    return;
  }
 
  // Decision logic
  bool soilDry    = soilRaw > DRY_THRESHOLD;
  bool tempOk     = tempC < MAX_TEMP_C;
  bool shouldPump = soilDry && tempOk;
 
  // Control relay (active-LOW module)
  digitalWrite(RELAY_PIN, shouldPump ? LOW : HIGH);
  pumpRunning = shouldPump;
 
  // Log to Serial
  Serial.print(soilRaw);
  Serial.print("\t");
  Serial.print(tempC, 1);
  Serial.print("\t");
  Serial.print(humidity, 1);
  Serial.print("\t");
  Serial.println(pumpRunning ? "ON" : "OFF");
 
  delay(5000); // Check every 5 seconds
}

Calibrating the Soil Sensor

ACTIVITY

Two-Point Soil Calibration

  1. Record the ADC reading from dry soil (leave unpotted soil out overnight). Note the value — this is your DRY_THRESHOLD.
  2. Fully soak the same soil with water and record the ADC reading. This is your WET_THRESHOLD.
  3. Update the constants in the sketch. The pump should turn on only when soil crosses the dry threshold.

Data Analysis

ACTIVITY

Watering Cycle Analysis

Run the system for 24 hours with a potted plant. Copy Serial Monitor data to a spreadsheet. Plot soil moisture (ADC) vs. time. Identify:

  • How long after watering does the soil reach WET_THRESHOLD?
  • How long does it take to dry back to DRY_THRESHOLD?
  • How does temperature affect the drying rate?

Explore more projects

View All Projects
Stay updated

Subscribe to
our newsletter

Get the latest curriculum updates, project ideas, and school program announcements delivered to your inbox.

Ready to get started?

Bring structured robotics to your school

Schedule a DemoView Curriculum
200+
Schools nationwide
4.8★
Teacher satisfaction
4
Class levels covered
100%
NEP 2020 aligned
CnipboticsCnipbotics

India's structured robotics curriculum for CBSE schools — Class 7 to Class 10.

CurriculumClass 7 — DiscoveryClass 8 — ExplorationClass 9 — EngineeringClass 10 — InnovationCBSE Chapter Mapping
ProgramsBrowse CoursesPricing & KitsRequest a DemoAbout Us
CompanyAbout UsContactPricing
Get in touch

Questions about curriculum, pricing, or ATL lab setup?

Contact Us

School partnership

info@cnipbotics.com

© 2026 Cnipbotics. All rights reserved.

TermsPrivacyCookiesAccessibility