Zbotic Logo Zbotic Logo
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

  • Shop
  • About Us
  • Contact Us
  • Reseller
  • Blogs
020 69134444
1800 209 0998
[email protected]
Help Desk
Facebook Twitter Instagram Linkedin YouTube
Zbotic Logo Zbotic Logo
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

All departments
  • 3D Print Service
  • 3D Printer
  • Batteries & Chargers
  • Development Boards
  • Drone Parts
  • EBike parts
  • Sensor Modules
  • Electronic Components
  • Electronic Modules
  • IoT and Wireless
  • Mechanical Parts and Workbench Tools
  • Motors & Drivers & Pumps & Actuators
  • DIY and Robot Kits
  • Show more
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
Return to previous page
Home Agriculture & Smart Farming

Smart Irrigation Timer: Automate with Arduino and Relay

Smart Irrigation Timer: Automate with Arduino and Relay

March 11, 2026 /Posted byJayesh Jain / 0

A smart irrigation timer built with Arduino and relay automates garden watering schedules, reducing water waste and eliminating the need for manual timing. Unlike basic mechanical timers available at hardware stores (₹200-500), an Arduino-based smart timer can be programmed with multiple daily watering schedules, adjusted for seasons, and expanded with soil moisture sensors for truly intelligent irrigation. This tutorial covers building a complete irrigation timer suitable for Indian home gardens, kitchen gardens, and small farms.

Table of Contents

  • Components List
  • Wiring Diagram
  • Setting Up the DS3231 RTC
  • Relay Safety for Mains Power
  • Complete Arduino Code
  • Adding LCD Status Display
  • Upgrading with Soil Moisture Sensor
  • Frequently Asked Questions

Components List

  • Arduino Uno or Nano (₹200-400)
  • DS3231 RTC module with CR2032 battery (₹100-200)
  • 5V 1-channel or 4-channel relay module (₹50-200)
  • 16×2 LCD display with I2C backpack (₹100-200)
  • Push buttons x3 (for menu navigation) (₹30-60)
  • 12V solenoid valve (24V AC or 12V DC) (₹200-400)
  • 12V DC adapter for solenoid valve power
  • Capacitive soil moisture sensor (optional, ₹80-150)
  • Project enclosure (₹100-250)

Total cost: ₹900-1,900 for a basic timed system, ₹1,500-2,500 with LCD, moisture sensing, and multi-zone capability. The Arduino Nano is preferred over Uno for its compact size fitting easily in a small enclosure.

Recommended: 5V 12V Soil Moisture Sensor Relay Control Module — If you want the simplest possible smart irrigation start, this all-in-one module automatically activates a pump when soil moisture drops below the threshold — no programming required.

Wiring Diagram

Component Pin Arduino Pin
DS3231 RTC SDA A4
DS3231 RTC SCL A5
LCD I2C SDA/SCL A4/A5 (shared)
Relay Module IN D8
Button 1 (Menu) — D4
Button 2 (Up) — D5
Button 3 (Down) — D6
Soil Moisture AOUT A0

Setting Up the DS3231 RTC

The DS3231 maintains accurate time independently even when Arduino power is off, using a CR2032 coin cell battery. On first use, set the time by uploading a sketch with RTClib:

#include <Wire.h>
#include <RTClib.h>

RTC_DS3231 rtc;

void setup() {
  rtc.begin();
  // Set time: use compile date/time for accurate setting
  rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
  // Or manually: rtc.adjust(DateTime(2024, 3, 15, 8, 0, 0));
}

The DS3231 is temperature-compensated and drifts less than 2 minutes per year, making it ideal for irrigation timing. A cheaper DS1307 can drift 5-15 minutes per year in Indian temperature conditions.

Relay Safety for Mains Power

If your irrigation system uses a 230V AC pump or solenoid valve:

  • Use a relay rated for minimum 10A at 250V AC (not cheap relay modules claiming 10A that are actually rated much lower)
  • Keep the mains side of the relay completely separate from the Arduino/low-voltage side — never bridge the two
  • Use heat-shrink tubing on all mains connections; no bare wires
  • Install a properly rated fuse (5-10A) on the live wire before the relay
  • Have a qualified electrician inspect the mains wiring before powering on

For safety and simplicity, prefer a 12V DC solenoid valve or submersible pump, which can be safely switched by any relay module without mains safety concerns. Most garden drip irrigation systems in India work fine with 12V DC solenoid valves (₹200-400) that operate at the same pressure as municipal water supply (1.5-4 bar).

Complete Arduino Code

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

#define RELAY_PIN 8
LiquidCrystal_I2C lcd(0x27, 16, 2);
RTC_DS3231 rtc;

// Irrigation schedule: up to 4 daily watering events
struct IrrigSchedule {
  int startHour, startMin;
  int durationMin;
  bool enabled;
};

IrrigSchedule schedule[] = {
  {6, 0, 15, true},   // 6:00 AM, 15 minutes
  {18, 30, 10, true},  // 6:30 PM, 10 minutes
  {0, 0, 0, false},   // Disabled
  {0, 0, 0, false}    // Disabled
};

bool isWateringTime(DateTime now) {
  for (auto &s : schedule) {
    if (!s.enabled) continue;
    if (now.hour() == s.startHour && now.minute() == s.startMin) return true;
    // Check if within duration
    DateTime schedStart = DateTime(now.year(), now.month(), now.day(), s.startHour, s.startMin, 0);
    if (now >= schedStart && now < (schedStart + TimeSpan(0, 0, s.durationMin, 0))) return true;
  }
  return false;
}

void setup() {
  pinMode(RELAY_PIN, OUTPUT);
  digitalWrite(RELAY_PIN, HIGH);  // Active-LOW relay: HIGH = off
  lcd.begin(16, 2);
  lcd.backlight();
  Wire.begin();
  rtc.begin();
}

void loop() {
  DateTime now = rtc.now();
  bool waterNow = isWateringTime(now);
  
  digitalWrite(RELAY_PIN, waterNow ? LOW : HIGH);  // LOW = on for active-LOW relay
  
  lcd.setCursor(0, 0);
  lcd.printf("%02d/%02d %02d:%02d:%02d", now.day(), now.month(), now.hour(), now.minute(), now.second());
  lcd.setCursor(0, 1);
  lcd.print(waterNow ? "IRRIGATING...   " : "Next: 6:00 AM   ");
  
  delay(1000);
}

Adding LCD Status Display

The 16×2 LCD with I2C backpack (PCF8574) shows current time, irrigation status, and next scheduled watering time. The I2C address is typically 0x27 — run an I2C scanner if it does not detect. The LiquidCrystal_I2C library from Arduino IDE Library Manager supports printf-style formatting with lcd.printf() on recent versions, simplifying display code significantly.

For a more sophisticated display, use an OLED (SSD1306) that provides 128×64 pixels for showing the full weekly schedule, soil moisture bar graph, and next watering countdown in a compact layout.

Upgrading with Soil Moisture Sensor

Add a capacitive soil moisture sensor to irrigate only when actually needed, overriding time-based schedules:

// Add to loop():
int moisture = analogRead(A0);
int moisturePercent = map(moisture, 3200, 1500, 0, 100);
moisturePercent = constrain(moisturePercent, 0, 100);

bool moistureLow = (moisturePercent < 35);
bool waterNow = isWateringTime(now) && moistureLow;  // Only water if both time AND soil is dry

lcd.setCursor(0, 1);
if (waterNow) lcd.print("IRRIGATING...   ");
else if (!moistureLow) lcd.print("Soil OK: " + String(moisturePercent) + "%   ");
else lcd.print("Dry, not time   ");

This hybrid approach combines the reliability of time-based scheduling (watering at optimal times regardless of sensor failure) with the intelligence of moisture-based control (skipping irrigation when soil is already adequately moist after unexpected rainfall).

Recommended: Capacitive Soil Moisture Sensor — Add intelligent moisture-based control to your Arduino irrigation timer; prevents over-watering after monsoon rains which is a common problem with purely time-based systems.

Frequently Asked Questions

How do I adjust irrigation schedules seasonally in India?

Store schedules in Arduino EEPROM so they persist after power cycles. Add a seasonal mode selection button: Summer mode (increase frequency, water early morning and evening), Monsoon mode (disable or greatly reduce irrigation), Winter mode (water once in morning only). Map these to predefined schedule arrays stored in PROGMEM to avoid SRAM overflow. A simpler approach is to use the DS3231’s alarm functionality to trigger watering at specific times rather than polling in the loop.

Can I control multiple irrigation zones with one Arduino?

Yes, using a 4-channel relay module. Each relay controls one zone’s solenoid valve. Power all valves from a common 12V supply; the Arduino’s digital pins control each relay independently. With 4 zones, you can water different garden sections at different times (vegetables in the morning, lawn in the evening, orchard at night). Keep zone schedules non-overlapping to avoid total current draw exceeding your pump or supply capacity.

What happens to my schedule if power goes out?

The DS3231 RTC continues keeping accurate time on its CR2032 battery during power outages — your schedules remain accurate. The Arduino’s EEPROM retains stored schedules without power. When power is restored, the Arduino restarts, reads the current time from DS3231, and resumes the correct schedule automatically. Add a startup delay (30 seconds) before activating any valve after power restoration to ensure stable power before controlling solenoids.

My relay clicks repeatedly without activating the valve. What is wrong?

This is almost always a power supply issue. Solenoid valves draw 200-500mA at 12V during activation — if powered from the same 5V supply as Arduino, the voltage drop when the valve activates causes Arduino to reset, which releases the relay, which allows voltage to recover, causing another Arduino restart (the clicking cycle). Use separate power supplies: 5V USB for Arduino, 12V dedicated adapter for solenoid valves. Connect the grounds together for a common reference.

How do I make the irrigation timer work without internet (completely offline)?

The build described above is already completely offline — it uses only the local DS3231 RTC for timekeeping. No internet, cloud, or Wi-Fi is required. This is ideal for areas with unreliable connectivity. If you later want to add remote monitoring or control, add an ESP8266 module that connects to Wi-Fi when available and uses the Arduino’s offline schedule as a fallback when Wi-Fi is unavailable.

Shop Smart Irrigation Components at Zbotic →

Tags: Arduino, garden watering, irrigation automation, relay, RTC, smart irrigation timer
Share Post
  • Facebook
  • Linkedin
  • Whatsapp
Sine Wave vs Square Wave BLDC ...
blog sine wave vs square wave bldc controller e bike comparison 598782
blog electric scooter hub motor upgrade higher kv and torque guide 598790
Electric Scooter Hub Motor Upg...

Related posts

Svg%3E
Read more

Farm Drone Pilot Training: Course and Certification India

April 1, 2026 0
Table of Contents DGCA Requirements Choosing an RPTO Curriculum and Duration Costs Career Opportunities Practical Tips Commercial agricultural drone operations... Continue reading
Svg%3E
Read more

Crop Insurance Sensor: Weather Data for Claims India

April 1, 2026 0
Table of Contents How PMFBY Works Weather Data for Claims Claim-Ready Weather Station Documenting Damage Insurance Integration Cost-Benefit PMFBY protects... Continue reading
Svg%3E
Read more

Fertigation Controller: Drip Irrigation Nutrient Mixing

April 1, 2026 0
Table of Contents What Is Fertigation EC and pH Monitoring Automated Dosing System Nutrient Schedules Sensor Integration Economics Fertigation through... Continue reading
Svg%3E
Read more

Organic Farm Certification: Monitoring Requirements

April 1, 2026 0
Table of Contents Certification Process Monitoring Requirements Sensor Documentation Soil Health Monitoring Pest Management Records Cost and Premium NPOP organic... Continue reading
Svg%3E
Read more

Agri-Tech Startups India: Technology Partners for Farmers

April 1, 2026 0
Table of Contents India’s Agri-Tech Landscape Advisory Platforms Farm Management Companies Market Linkage Startups Precision Ag Startups Choosing Partners India’s... Continue reading

Add comment Cancel reply

Your email address will not be published. Required fields are marked

Facebook Twitter Instagram Pinterest Linkedin Youtube

Get the latest deals and more.

Download on Google Play Download on the App Store

Call us: 020 69134444 / 1800 209 0998

Monday - Saturday 09:30 AM - 06:00 PM
For Technical Supports Email: [email protected]
For Sales / Enquiries Email: [email protected]

  • My Account

    • Cart

    • Wishlist

    • Checkout

    • My Orders

    • Track Order

    • My Account

  • Information

    • FAQs

    • Blogs

    • Career

    • About Us

    • Contact Us

    • Payment Options

  • Policies

    • Privacy Policy

    • Terms & Conditions

    • GST Input Tax Credit

    • Shipping Return Policy

    • E-Waste Collection Points

    • Our Sitemap

© Zbotic.in is registered trademark of Moxie Supply Pvt Ltd – All Rights Reserved
Login
Use Phone Number
Use Email Address
Not a member yet? Register Now
Reset Password
Use Phone Number
Use Email Address
Register
Already a member? Login Now