Waters your plant automatically whenever the soil gets dry.
Built and tested by Vishnu M · Industrial Robotics Institute

An automatic irrigation system for a potted plant or small garden. A soil moisture sensor tells the ESP8266 how dry the soil is; when it gets too dry, a relay switches on a small water pump, and when the soil is wet again the pump turns off.
| Component | Qty |
|---|---|
| ESP8266 NodeMCU | 1 |
| Soil Moisture Sensor | 1 |
| 5V Relay Module | 1 |
| Mini Water Pump | 1 |
| Breadboard | 1 |
| Jumper Wires | As needed |
| Water tank (optional) | 1 |
| From | Connect to |
|---|---|
| Moisture sensor VCC | 3.3V |
| Moisture sensor GND | GND |
| Moisture sensor AO | A0 |
| Relay VCC | 5V (VIN) |
| Relay GND | GND |
| Relay IN | D1 |
| Pump + | Relay NO |
| Pump − | Power supply GND |
Complete, tested Arduino C++ code for this project. Copy it into Arduino IDE and upload it to the ESP8266 NodeMCU.
int moisturePin = A0;
int relayPin = D1;
void setup()
{
Serial.begin(9600);
pinMode(relayPin, OUTPUT);
}
void loop()
{
int moisture = analogRead(moisturePin);
Serial.println(moisture);
if (moisture > 700) // dry soil
{
digitalWrite(relayPin, LOW); // pump ON (active-low relay)
}
else
{
digitalWrite(relayPin, HIGH); // pump OFF
}
delay(2000);
}An automatic irrigation system for a potted plant or small garden. A soil moisture sensor tells the ESP8266 how dry the soil is; when it gets too dry, a relay switches on a small water pump, and when the soil is wet again the pump turns off.
You need: ESP8266 NodeMCU (1), Soil Moisture Sensor (1), 5V Relay Module (1), Mini Water Pump (1), Breadboard (1), Jumper Wires, Water tank (optional) (1). Software: Arduino IDE, ESP8266 board package.
Yes. It is rated beginner and takes about 1–2 hours to build, using the ESP8266 NodeMCU. The guide on this page explains every connection and step.
The complete, tested Arduino C++ code is free on this page. Copy it into Arduino IDE and upload it to the board.
Yes. IRI sells a kit with the parts for this project (PRJ-018). Message IRI on WhatsApp at +91 86060 82634 for the kit price and delivery details.