Automatic Water Pump Controller

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

  1. Arduino UNO – Reads sensor data and controls the pump.
  2. Soil Moisture Sensor – Detects the moisture level in the soil.
  3. Relay Module – Acts as a switch to control the water pump.
  4. Water Pump – Delivers water when activated.
  5. 9V Battery – Powers the pump.
  6. 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

ComponentArduino Pin
Soil Sensor VCC5V
Soil Sensor GNDGND
Soil Sensor A0A0
Relay IND8
Relay VCC5V
Relay GNDGND
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

Your email address will not be published. Required fields are marked *

More Articles & Posts