Automatic Plant Watering System using Arduino UNO
Smart irrigation that monitors soil moisture in real time and automatically waters your plants — no human effort needed.
The Automatic Plant Watering System is an efficient smart irrigation project that continuously monitors soil moisture and activates a water pump whenever the soil becomes dry. Built around an Arduino UNO, this project is perfect for school robotics, IoT beginners, and smart agriculture demonstrations — all while reducing water wastage and ensuring healthy plant growth.
Working Principle
Soil is Dry (value > 600)
- Water pump turns ON
- Buzzer activates
- LCD shows "Soil Dry – Watering"
Soil is Wet (value ≤ 600)
- Water pump turns OFF
- Buzzer stops
- LCD shows "Soil Wet – OK"
Components Required
Visual Guide
Circuit Diagram
The diagram below shows the complete wiring of all components. The soil moisture sensor feeds analog data to A0, the LCD runs in 4-bit mode on D2–D7, the buzzer connects to D8, and the relay (controlling the pump) connects to D9.
🔌 Automatic Plant Watering System — Full Circuit
💡 Tip: Use Tinkercad to simulate this circuit before building it physically. Jump to simulation →
Pin Connections
Wiring Guide
🌡️ Soil Moisture Sensor → Arduino
Sensor Pin Arduino Pin Wire Color
VCC 5V 🔴 Red
GND GND ⚫ Black
AO (Analog Out) A0 🟡 Yellow
📺 16×2 LCD Display → Arduino (4-bit mode)
LCD Pin Arduino Pin Notes
VSS (Pin 1) GND Ground
VDD (Pin 2) 5V Power
VO (Pin 3) Potentiometer Contrast adjust
RS (Pin 4) D2 Register Select
RW (Pin 5) GND Always Write
EN (Pin 6) D3 Enable
D4 (Pin 11) D4 Data bit 4
D5 (Pin 12) D5 Data bit 5
D6 (Pin 13) D6 Data bit 6
D7 (Pin 14) D7 Data bit 7
A/BL+ (Pin 15) 5V Backlight +
K/BL- (Pin 16) GND Backlight −
🔔 Buzzer → Arduino
Buzzer Pin Arduino Pin
+ (Positive) D8
− (Negative) GND
⚡ Relay Module → Arduino & Pump
Relay Pin Connects To Notes
VCC 5V (Arduino) Relay power
GND GND (Arduino) Common ground
IN (Signal) D9 (Arduino) Control pin
NO (Normally Open) Pump + Pump power circuit
COM (Common) External PSU + 6V–9V supply
Build It
Step-by-Step Instructions
01
Gather All Components
Collect all components listed above. Make sure your Arduino IDE is installed (version 1.8+ or 2.x) and the LiquidCrystal library is available (it's built-in).
02
Place Components on Breadboard
Position the Arduino, LCD display (use a separate breadboard section), relay module, buzzer, and moisture sensor. Keep the pump wiring away from signal wires to avoid noise.
03
Wire the Soil Moisture Sensor
Connect VCC → 5V, GND → GND, and AO → A0 on Arduino. Insert the sensor prongs into the soil of your plant pot. Do NOT power the sensor continuously — you can use a digital pin to power it intermittently to extend its lifespan.
04
Connect the LCD in 4-bit Mode
Wire VSS to GND, VDD to 5V, and VO to the wiper of a 10kΩ potentiometer (other ends to 5V and GND). Then: RS→D2, RW→GND, EN→D3, D4–D7→D4–D7. Connect backlight pins 15→5V and 16→GND.
05
Wire the Buzzer
Connect the buzzer's positive pin to D8 and negative pin to GND. If using a passive buzzer, you'll need to generate a tone in code (use tone(8, 1000)).
06
Connect the Relay and Water Pump
Wire the relay module: VCC→5V, GND→GND, IN→D9. For the pump circuit: connect the external power supply (+) to relay COM, relay NO to pump (+), and pump (−) and PSU (−) to a common GND. Never power a motor directly from the Arduino 5V pin.
07
Upload the Arduino Code
Open Arduino IDE, connect your Arduino UNO via USB, paste the code below, select board (Arduino UNO) and correct COM port, then click Upload.
08
Test and Calibrate
Open Serial Monitor (9600 baud) to watch moisture values. Adjust the threshold variable in code to match your specific soil and sensor. Typically, dry soil reads above 600 and wet soil reads below 400 on a 10-bit scale (0–1023).
Arduino Code
Complete Arduino Sketch
Copy and paste this code into Arduino IDE. The threshold is set at 600 — adjust based on your sensor readings.
🌿 automatic_plant_watering.ino
// ============================================
// Automatic Plant Watering System
// makemindz.com | Arduino UNO Project
// ============================================
#include <LiquidCrystal.h>
// LCD: RS, EN, D4, D5, D6, D7
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);
// Pin Definitions
const int sensorPin = A0; // Soil moisture sensor
const int buzzerPin = 8; // Buzzer
const int relayPin = 9; // Relay (controls pump)
// Threshold: above this = soil is DRY
const int DRY_THRESHOLD = 600;
void setup() {
lcd.begin(16, 2);
pinMode(buzzerPin, OUTPUT);
pinMode(relayPin, OUTPUT);
digitalWrite(relayPin, HIGH); // Relay OFF (active LOW)
Serial.begin(9600);
lcd.setCursor(0, 0);
lcd.print("Plant Watering");
lcd.setCursor(0, 1);
lcd.print("System Ready!");
delay(2000);
}
void loop() {
int rawValue = analogRead(sensorPin);
// Convert to moisture percentage (invert scale)
int moisture = map(rawValue, 0, 1023, 100, 0);
Serial.print("Raw: ");
Serial.print(rawValue);
Serial.print(" Moisture: ");
Serial.print(moisture);
Serial.println("%");
lcd.setCursor(0, 0);
lcd.print("Moisture: ");
lcd.print(moisture);
lcd.print("% ");
if (rawValue > DRY_THRESHOLD) {
// SOIL IS DRY → Activate pump & buzzer
digitalWrite(relayPin, LOW); // Relay ON (pump starts)
digitalWrite(buzzerPin, HIGH);
lcd.setCursor(0, 1);
lcd.print("Dry! Watering...");
} else {
// SOIL IS WET → Stop pump & buzzer
digitalWrite(relayPin, HIGH); // Relay OFF (pump stops)
digitalWrite(buzzerPin, LOW);
lcd.setCursor(0, 1);
lcd.print("Soil Wet - OK ");
}
delay(1000); // Check every 1 second
}
Try Before You Build
Tinkercad Simulation
Test the full circuit virtually in Tinkercad before assembling the physical components. You can interact with the moisture sensor slider and see the LCD, buzzer, and pump respond in real time.
🖥️ Open in Tinkercad
Simulate the complete Automatic Plant Watering System circuit — no hardware needed to get started!
Launch Tinkercad Simulation
⬇️ Download Project Files (Google Drive)
Why This Project
Features & Applications
Prevents Overwatering
Real-Time Moisture %
Audio Alert Buzzer
Fully Automatic
Low Cost Build
Conserves Water
Where You Can Use This
Home Gardens
Smart Agriculture
School Projects
Greenhouse Automation
IoT Farming
More Arduino Projects on MakeMindz
🟢 Beginner Projects
🟡 Intermediate Projects
Circuit Diagram
The diagram below shows the complete wiring of all components. The soil moisture sensor feeds analog data to A0, the LCD runs in 4-bit mode on D2–D7, the buzzer connects to D8, and the relay (controlling the pump) connects to D9.
💡 Tip: Use Tinkercad to simulate this circuit before building it physically. Jump to simulation →
Wiring Guide
🌡️ Soil Moisture Sensor → Arduino
| Sensor Pin | Arduino Pin | Wire Color |
|---|---|---|
| VCC | 5V | 🔴 Red |
| GND | GND | ⚫ Black |
| AO (Analog Out) | A0 | 🟡 Yellow |
📺 16×2 LCD Display → Arduino (4-bit mode)
| LCD Pin | Arduino Pin | Notes |
|---|---|---|
| VSS (Pin 1) | GND | Ground |
| VDD (Pin 2) | 5V | Power |
| VO (Pin 3) | Potentiometer | Contrast adjust |
| RS (Pin 4) | D2 | Register Select |
| RW (Pin 5) | GND | Always Write |
| EN (Pin 6) | D3 | Enable |
| D4 (Pin 11) | D4 | Data bit 4 |
| D5 (Pin 12) | D5 | Data bit 5 |
| D6 (Pin 13) | D6 | Data bit 6 |
| D7 (Pin 14) | D7 | Data bit 7 |
| A/BL+ (Pin 15) | 5V | Backlight + |
| K/BL- (Pin 16) | GND | Backlight − |
🔔 Buzzer → Arduino
| Buzzer Pin | Arduino Pin |
|---|---|
| + (Positive) | D8 |
| − (Negative) | GND |
⚡ Relay Module → Arduino & Pump
| Relay Pin | Connects To | Notes |
|---|---|---|
| VCC | 5V (Arduino) | Relay power |
| GND | GND (Arduino) | Common ground |
| IN (Signal) | D9 (Arduino) | Control pin |
| NO (Normally Open) | Pump + | Pump power circuit |
| COM (Common) | External PSU + | 6V–9V supply |
Step-by-Step Instructions
Gather All Components
Collect all components listed above. Make sure your Arduino IDE is installed (version 1.8+ or 2.x) and the LiquidCrystal library is available (it's built-in).
Place Components on Breadboard
Position the Arduino, LCD display (use a separate breadboard section), relay module, buzzer, and moisture sensor. Keep the pump wiring away from signal wires to avoid noise.
Wire the Soil Moisture Sensor
Connect VCC → 5V, GND → GND, and AO → A0 on Arduino. Insert the sensor prongs into the soil of your plant pot. Do NOT power the sensor continuously — you can use a digital pin to power it intermittently to extend its lifespan.
Connect the LCD in 4-bit Mode
Wire VSS to GND, VDD to 5V, and VO to the wiper of a 10kΩ potentiometer (other ends to 5V and GND). Then: RS→D2, RW→GND, EN→D3, D4–D7→D4–D7. Connect backlight pins 15→5V and 16→GND.
Wire the Buzzer
Connect the buzzer's positive pin to D8 and negative pin to GND. If using a passive buzzer, you'll need to generate a tone in code (use tone(8, 1000)).
Connect the Relay and Water Pump
Wire the relay module: VCC→5V, GND→GND, IN→D9. For the pump circuit: connect the external power supply (+) to relay COM, relay NO to pump (+), and pump (−) and PSU (−) to a common GND. Never power a motor directly from the Arduino 5V pin.
Upload the Arduino Code
Open Arduino IDE, connect your Arduino UNO via USB, paste the code below, select board (Arduino UNO) and correct COM port, then click Upload.
Test and Calibrate
Open Serial Monitor (9600 baud) to watch moisture values. Adjust the threshold variable in code to match your specific soil and sensor. Typically, dry soil reads above 600 and wet soil reads below 400 on a 10-bit scale (0–1023).
Complete Arduino Sketch
Copy and paste this code into Arduino IDE. The threshold is set at 600 — adjust based on your sensor readings.
// ============================================ // Automatic Plant Watering System // makemindz.com | Arduino UNO Project // ============================================ #include <LiquidCrystal.h> // LCD: RS, EN, D4, D5, D6, D7 LiquidCrystal lcd(2, 3, 4, 5, 6, 7); // Pin Definitions const int sensorPin = A0; // Soil moisture sensor const int buzzerPin = 8; // Buzzer const int relayPin = 9; // Relay (controls pump) // Threshold: above this = soil is DRY const int DRY_THRESHOLD = 600; void setup() { lcd.begin(16, 2); pinMode(buzzerPin, OUTPUT); pinMode(relayPin, OUTPUT); digitalWrite(relayPin, HIGH); // Relay OFF (active LOW) Serial.begin(9600); lcd.setCursor(0, 0); lcd.print("Plant Watering"); lcd.setCursor(0, 1); lcd.print("System Ready!"); delay(2000); } void loop() { int rawValue = analogRead(sensorPin); // Convert to moisture percentage (invert scale) int moisture = map(rawValue, 0, 1023, 100, 0); Serial.print("Raw: "); Serial.print(rawValue); Serial.print(" Moisture: "); Serial.print(moisture); Serial.println("%"); lcd.setCursor(0, 0); lcd.print("Moisture: "); lcd.print(moisture); lcd.print("% "); if (rawValue > DRY_THRESHOLD) { // SOIL IS DRY → Activate pump & buzzer digitalWrite(relayPin, LOW); // Relay ON (pump starts) digitalWrite(buzzerPin, HIGH); lcd.setCursor(0, 1); lcd.print("Dry! Watering..."); } else { // SOIL IS WET → Stop pump & buzzer digitalWrite(relayPin, HIGH); // Relay OFF (pump stops) digitalWrite(buzzerPin, LOW); lcd.setCursor(0, 1); lcd.print("Soil Wet - OK "); } delay(1000); // Check every 1 second }
Tinkercad Simulation
Test the full circuit virtually in Tinkercad before assembling the physical components. You can interact with the moisture sensor slider and see the LCD, buzzer, and pump respond in real time.
🖥️ Open in Tinkercad
Simulate the complete Automatic Plant Watering System circuit — no hardware needed to get started!
Launch Tinkercad Simulation⬇️ Download Project Files (Google Drive)

Comments
Post a Comment