🔌 Arduino 🌱 Gardening Intermediate ⏱️ 5-6 Hours

Automated Smart Garden System

Build an intelligent plant watering system that monitors soil moisture and automatically waters your plants when needed! This Arduino project uses capacitive soil sensors, a water pump, and an LCD display to keep your garden thriving even when you're away. Perfect for indoor plants, balcony gardens, or small vegetable patches.

💰
$20 - $35
📊
Intermediate
🧩
8 Parts
📝
Jan 2026

📖 Project Overview

This automated garden system takes the guesswork out of plant care. Using capacitive soil moisture sensors, the Arduino continuously monitors the water content in your soil and triggers a water pump when plants need hydration.

The system displays real-time moisture levels on an LCD screen and can be configured with custom thresholds for different plant types. Whether you have succulents that need minimal water or thirsty tomatoes, this system adapts to your garden's needs.

💡 What You'll Learn

  • Reading analog sensor values and calibrating sensors
  • Controlling a water pump with relay modules
  • Displaying data on an I2C LCD screen
  • Implementing hysteresis to prevent rapid on/off cycling
  • Setting up a basic automated control system

🧰 Components Required

Part Name Qty
Arduino UNO 1
Capacitive Soil Moisture Sensor 1-4
5V Mini Water Pump 1
5V Relay Module 1
16x2 LCD with I2C 1
Silicone Tubing (6mm) 1m
Water Reservoir Container 1
Jumper Wires 1 set

🔌 Hardware Connections

Follow this pin mapping guide to connect your sensors and actuators to the Arduino UNO:

🔍 Pin Mapping Guide

Peripheral Device Pin Arduino Pin Notes
Soil Sensor AOUT Analog A0 Moisture Data
Relay Module IN / SIG Digital 7 Pump Control
LCD Display SDA Analog A4 I2C Data
LCD Display SCL Analog A5 I2C Clock
Power VCC / 5V 5V Pin Shared VCC Rail
Power GND GND Pin Common Ground

The system operates on a simple but effective principle:

🔄 Operation Cycle

1. Monitor: Soil moisture sensor reads water content (0-100%)
2. Compare: Arduino checks if moisture is below threshold (e.g., 30%)
3. Activate: If dry, relay turns on water pump
4. Water: Pump runs until moisture reaches target level (e.g., 60%)
5. Display: LCD shows real-time moisture and system status

⚠️ Important Notes

Use a capacitive sensor (not resistive) for longer life. Keep electronics away from water. Always include a timeout to prevent overwatering if the sensor fails.

📋 Step-by-Step Instructions

1

Calibrate the Moisture Sensor

Before wiring everything, test your sensor. Read values in dry air (your "dry" value, typically ~520) and submerged in water (your "wet" value, typically ~260). These will be used to map to 0-100%.

2

Wire the Moisture Sensor

Connect the sensor VCC to Arduino 5V, GND to GND, and the analog output (AOUT in (A) to analog pin A0. If using multiple sensors, use A0, A1, A2, etc.

3

Connect the Relay Module

Wire relay VCC to 5V, GND to GND, and IN to digital pin 7. Connect the water pump's positive wire through the relay's NO (normally open) terminal.

4

Set Up the LCD Display

Connect the I2C LCD: SDA to A4, SCL to A5, VCC to 5V, and GND to GND. Install the LiquidCrystal_I2C library via Arduino Library Manager.

5

Assemble the Water System

Connect silicone tubing from the water reservoir to the pump inlet, and from the pump outlet to your plant pot. Secure all connections to prevent leaks.

6

Upload and Test

Upload the code, then test by removing the sensor from soil. The pump should activate. Insert into moist soil to verify it stops. Adjust thresholds as needed.

💻 Arduino Code

Arduino C++
// Smart Garden Watering System
// MakersDeck Arduino Project

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

// Pin definitions
#define MOISTURE_PIN A0
#define PUMP_RELAY 7

// Calibration values (adjust for your sensor)
#define DRY_VALUE 520
#define WET_VALUE 260

// Threshold settings
#define DRY_THRESHOLD 30   // Start watering below this %
#define WET_THRESHOLD 60   // Stop watering above this %
#define PUMP_TIMEOUT 30000 // Max pump runtime (30 sec)

LiquidCrystal_I2C lcd(0x27, 16, 2);

bool pumpRunning = false;
unsigned long pumpStartTime = 0;

void setup() {
    Serial.begin(9600);
    lcd.init();
    lcd.backlight();
    pinMode(PUMP_RELAY, OUTPUT);
    digitalWrite(PUMP_RELAY, LOW);
    
    lcd.setCursor(0, 0);
    lcd.print("Smart Garden");
    lcd.setCursor(0, 1);
    lcd.print("Initializing...");
    delay(2000);
}

int getMoisturePercent() {
    int raw = analogRead(MOISTURE_PIN);
    // Map raw value to percentage
    int percent = map(raw, DRY_VALUE, WET_VALUE, 0, 100);
    return constrain(percent, 0, 100);
}

void loop() {
    int moisture = getMoisturePercent();
    
    // Control pump with hysteresis
    if (moisture < DRY_THRESHOLD && !pumpRunning) {
        pumpRunning = true;
        pumpStartTime = millis();
        digitalWrite(PUMP_RELAY, HIGH);
    }
    
    if (pumpRunning) {
        // Stop if wet enough or timeout
        if (moisture >= WET_THRESHOLD || 
            (millis() - pumpStartTime > PUMP_TIMEOUT)) {
            pumpRunning = false;
            digitalWrite(PUMP_RELAY, LOW);
        }
    }
    
    // Update display
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("Moisture: ");
    lcd.print(moisture);
    lcd.print("%");
    
    lcd.setCursor(0, 1);
    if (pumpRunning) {
        lcd.print("WATERING...");
    } else if (moisture < DRY_THRESHOLD) {
        lcd.print("Soil is DRY");
    } else {
        lcd.print("Soil is OK");
    }
    
    delay(1000);
}

🚀 Upgrade Ideas

🔧 Take It Further

  • Add multiple moisture sensors for different plant zones
  • Include a water level sensor in the reservoir
  • Add WiFi with ESP8266 for remote monitoring
  • Implement scheduled watering times with RTC module
  • Log moisture data to SD card for analysis

🔗 Related Projects

← Back to All Projects