
Automatic Water Pump Controller Using Arduino
This project automates irrigation or water tank refilling using an Arduino UNO, a soil moisture sensor, a relay module, and a DC water pump. It ensures plants or tanks receive water only when needed, conserving water and reducing manual effort.
Key Components & Their Roles
- Arduino UNO – Reads sensor data and controls the pump.
- Soil Moisture Sensor – Detects the moisture level in the soil.
- Relay Module – Acts as a switch to control the water pump.
- Water Pump – Delivers water when activated.
- 9V Battery – Powers the pump.
- Jumper Wires – Connect components.
Working Principle
- The soil moisture sensor measures the water content in the soil.
- If the soil is dry, the sensor sends a signal to the Arduino.
- The Arduino activates the relay, which turns on the water pump.
- Once the soil reaches a sufficient moisture level, the pump is turned off automatically.
Wiring Connections
| Component | Arduino Pin |
|---|---|
| Soil Sensor VCC | 5V |
| Soil Sensor GND | GND |
| Soil Sensor A0 | A0 |
| Relay IN | D8 |
| Relay VCC | 5V |
| Relay GND | GND |
| Pump + | Relay NO |
| Pump – | Relay COM |
| Battery + | Relay NC |
| Battery – | GND |
Arduino Code
// Define pins
const int waterLevelSensorPin = A0; // Analog pin connected to the water level sensor
const int relayPin = 7; // Digital pin connected to the relay module
// Define threshold levels (adjust based on your water level sensor calibration)
const int waterLevelThreshold = 500; // Value above which the pump should stop
void setup() {
pinMode(relayPin, OUTPUT); // Set relay pin as output
digitalWrite(relayPin, LOW); // Ensure the pump is off initially
Serial.begin(9600); // Initialize serial monitor for debugging
}
void loop() {
int waterLevel = analogRead(waterLevelSensorPin);
Serial.print("Water Level Value: ");
Serial.println(waterLevel);
// Check the water level and control the relay
if (waterLevel > waterLevelThreshold) {
// Water level is below the threshold, turn on the pump
digitalWrite(relayPin, HIGH);
Serial.println("Pump ON: Low Water Level Detected");
} else {
// Water level is above the threshold, turn off the pump
digitalWrite(relayPin, LOW);
Serial.println("Pump OFF: Water Level Adequate");
}
delay(1000); // Delay for 1 second before the next reading
}
Benefits of This System
✅ Water-efficient – Only waters when needed
✅ Low-cost automation – Ideal for home gardens and small farms
✅ Expandable – Can integrate with IoT platforms like Blynk for remote control
✅ Beginner-friendly – Great for learning Arduino and sensor integration



Leave a Reply