Never forget to water your plants again. This project senses how dry the soil is and switches on a small water pump only when your plant actually needs a drink.
What you’ll build
An Arduino Nano reads the soil moisture sensor every few seconds. When the reading crosses your dryness threshold, it fires a relay that powers the mini water pump for a short burst, then waits for the moisture to rise — fully automatic watering with no timers to configure.
Components you’ll need
| Component | Qty | Price |
|---|---|---|
| Arduino Nano ATmega328P Compatible Board | 1 | ₹149 |
| Soil Moisture Sensor | 1 | ₹29 |
| 5V Single Channel Relay Module for Arduino | 1 | ₹49 |
| Mini Water Pump | 1 | ₹19 |
| 400 Point Breadboard | 1 | ₹299 |
| Male to Female Jumper Wires 40pcs 20cm Multicolour | 1 | ₹49 |
| Total | ₹594 |
Step-by-step guide
- Insert the soil moisture probe into the pot and connect its module: VCC to 5V, GND to GND, and A0 to the Nano’s A0 pin.
- Wire the relay module: VCC to 5V, GND to GND, and IN to pin D7.
- Connect the mini water pump through the relay’s NO (normally open) contact so it only runs when the relay clicks on. Power the pump from a separate 5V supply if it stutters.
- Run a small tube from the pump into the pot, with the pump submerged in a water reservoir.
- Upload the sketch and open the Serial Monitor to see live moisture readings.
- Water the soil once manually, note the “wet” reading, let it dry and note the “dry” reading, then set THRESHOLD between the two and re-upload.
The code
The sketch averages a few analog readings, compares them with your threshold, and pulses the pump with a safety cooldown so it can never flood the pot.
const int sensor = A0, relay = 7;
const int THRESHOLD = 550; // higher = drier (calibrate!)
void setup(){ pinMode(relay,OUTPUT); digitalWrite(relay,HIGH); Serial.begin(9600); }
void loop(){
long sum=0; for(int i=0;i<10;i++){ sum+=analogRead(sensor); delay(20); }
int moisture = sum/10; Serial.println(moisture);
if(moisture > THRESHOLD){
digitalWrite(relay,LOW); // pump ON (active-low relay)
delay(3000); // water for 3 seconds
digitalWrite(relay,HIGH); // pump OFF
delay(30000); // let water soak in
}
delay(2000);
}Build this project
Add all 6 required components to your cart in one click — total ₹594.
Add all components to cart