Smart Water Dispenser using Arduino | Automatic Touchless Water System


Build a Smart Water Dispenser using Arduino and an ultrasonic sensor! Learn how to create a touchless automatic water dispenser that activates a pump when it detects your hand. Step-by-step guide, circuit diagram, components, and Arduino code included.

Introduction: Smart Water Dispenser using Arduino

In today’s world, hygiene and automation are becoming essential in our daily lives. Whether it’s in homes, offices, or public places, people prefer touchless systems to avoid contamination and improve convenience.

One such innovation is the Smart Water Dispenser using Arduino — a project that automatically dispenses water when it detects a hand nearby.

This DIY project is simple, affordable, and practical, using basic components like an Arduino board, ultrasonic sensor, relay module, and mini water pump.

In this article, we’ll explain everything — from the working principle and circuit design to the Arduino code and real-world applications.


Why Build a Smart Water Dispenser?

Here are a few reasons why this project is worth your time:

  • Hygienic and Contactless – Reduces the spread of germs and bacteria.
  • ⚙️ Fully Automatic – Dispenses water only when needed, saving both time and water.
  • 💧 Energy Efficient – The water pump runs only when a hand is detected.
  • 💡 DIY Friendly – Uses simple, easily available electronic components.
  • 🔧 Customizable – Can be extended to dispense sanitizer, soap, or other liquids.

How the Smart Water Dispenser Works

The working principle is quite simple:

  1. Ultrasonic Sensor (HC-SR04) detects the distance of any object in front of it.
  2. When a hand comes within a set range (for example, 10 cm), the Arduino microcontroller receives this signal.
  3. Arduino then activates the relay module, which turns on the water pump connected to a water reservoir.
  4. When the hand is removed, the ultrasonic sensor no longer detects an object, and the relay turns off the pump — stopping the water flow.

Thus, the system dispenses water automatically without physical touch.


Components Required

To build your own Smart Water Dispenser using Arduino, you’ll need the following components:

ComponentQuantityDescription / Function
Arduino Uno / Nano1Main microcontroller for processing sensor data
Ultrasonic Sensor (HC-SR04)1Detects the distance of objects (your hand)
5V Relay Module1Switches the pump on/off based on Arduino signal
Mini Water Pump (DC 5V–12V)1Pumps the water from reservoir
Jumper WiresAs neededFor connecting components
Breadboard1For easy circuit assembly
Power Supply (5V or 9V adapter)1To power the Arduino and pump
Plastic Tube1To direct water flow from pump outlet

Circuit Diagram and Connections

Here’s how you connect everything:

  1. HC-SR04 Ultrasonic Sensor
    • VCC → 5V on Arduino
    • GND → GND on Arduino
    • TRIG → Digital Pin 9
    • ECHO → Digital Pin 10
  2. Relay Module
    • VCC → 5V on Arduino
    • GND → GND on Arduino
    • IN → Digital Pin 8
  3. Water Pump
    • Connect one end to COM (Common) terminal of relay.
    • Connect other end to NO (Normally Open) terminal.
    • Power the pump using a separate 5V/9V source (through relay control).

Make sure to connect all grounds (GND) together for a common reference.


Arduino Code for Smart Water Dispenser

Below is the sample code for your automatic water dispenser project.

// Smart Water Dispenser using Arduino and Ultrasonic Sensor

define trigPin 9

define echoPin 10

define relayPin 8

long duration;
int distance;

void setup() {
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(relayPin, OUTPUT);
Serial.begin(9600);
}

void loop() {
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);
distance = duration * 0.034 / 2;

Serial.print(“Distance: “);
Serial.println(distance);

if (distance < 10) { // If hand is within 10 cm
digitalWrite(relayPin, HIGH); // Turn ON pump
} else {
digitalWrite(relayPin, LOW); // Turn OFF pump
}

delay(200);
}

How the Code Works

  • The ultrasonic sensor continuously measures distance.
  • If the detected distance is less than 10 cm, the relay pin goes HIGH (activating the water pump).
  • When the hand moves away, the relay turns off automatically.

Testing Your Project

Once your circuit is ready and code is uploaded:

  1. Power up the Arduino.
  2. Place your hand in front of the ultrasonic sensor.
  3. The pump should start running and water should flow through the tube.
  4. Remove your hand — the pump stops automatically.

You’ve successfully built a Smart Water Dispenser using Arduino!

Applications

This simple project has several practical uses:

  • 🏠 Home Kitchens – Hands-free water tap for hygiene.
  • 🏢 Offices & Public Restrooms – Touchless water dispensers for employees or guests.
  • 🏥 Hospitals & Clinics – Reduces germ transmission.
  • 🧴 Sanitizer Dispensers – The same design can be modified to dispense liquid sanitizer.

Advantages

  • ✔️ Low Cost and easy to build.
  • ✔️ Reduces water wastage by automatically turning off.
  • ✔️ Compact Design, suitable for small setups.
  • ✔️ Expandable — you can add temperature or flow sensors.

Possible Upgrades

Once your basic version works, you can add more features:

  1. LCD Display: Show water level or usage count.
  2. Wi-Fi (ESP8266/ESP32): Control or monitor remotely.
  3. Flow Sensor: Measure the exact quantity of water dispensed.
  4. Buzzer or LED Indicator: Provide feedback during operation.
  5. Solar Power Supply: Make it eco-friendly and energy-efficient.

Safety Tips

  • Always use a low-voltage pump (5V–12V DC) for safety.
  • Keep electronic parts away from water — use waterproof casing.
  • Use separate power supply for the pump if it draws high current.
  • Double-check connections before powering on.

SEO Keywords (Include Naturally in Your Post)

Keywords:
Smart Water Dispenser using Arduino, Arduino water pump project, automatic water dispenser, touchless water system, Arduino ultrasonic sensor project, DIY Arduino projects, Arduino relay module, automatic tap system, Arduino hygiene project, smart home automation.


Conclusion

The Smart Water Dispenser using Arduino is a perfect example of how simple electronics and coding can make everyday life smarter and safer.

With just a few components and a bit of coding, you can build a touchless automatic water system that saves water, promotes hygiene, and enhances convenience.

Whether you’re a student, hobbyist, or DIY enthusiast, this project helps you understand sensor interfacing, relay control, and automation — all core concepts in Arduino programming.

Leave a Comment