Water Dispenser

by bhandariabisha40 in Circuits > Arduino

24 Views, 0 Favorites, 0 Comments

Water Dispenser

Screenshot 2025-06-17 174359.png
Screenshot 2025-06-14 120744.png

This automatic water dispenser detects your hand using an ultrasonic sensor and activates a water pump and LED. It's contactless, making it more hygienic than manual taps — perfect for use in kitchens, washrooms, or public areas!


How it works:

The ultrasonic sensor continuously checks the distance to any object in front of it.

When it detects a hand within ~10 cm, it sends a signal to the relay module.

The relay activates the water pump, and water is dispensed.

An LED lights up while the pump is running.


Why this idea?

With hygiene being a growing concern contactless technology has become increasingly popular. This project tackles the problem of manual tap contamination with a simple yet effective solution!

Supplies

Screenshot 2025-06-17 173538.png

1x Arduino The microcontroller board that controls the system.

Jumper Wires male male & male female

1x 5V pump Pumps water to the cup

1x single channel Relay Acts as a switch to control the water pump.

1x LED Indicates when the pump is on

1x 330 Resistor Limit the current flowing through the LEDs

cardboard (optional) used for decoration

1 x ultrasonic distance sensor to detect the distance for the pump to turn on

1x breadboard Facilitates easy wiring of components.

1x USB Cable for Arduino to connect the arduino to power supply

2x containers one to store water one for the water to go into

Setup Arduino on Breadboard

Screenshot 2025-06-15 142410.png

Gather all the components listed above. Plug your Arduino into the breadboard’s power and ground rails (5V to +, GND to -).

Wire the Distance Sensor

Screenshot 2025-06-15 142625.png
  1. VCC → Arduino 5V
  2. GND → Arduino GND
  3. Trig → Arduino Pin 6
  4. Echo → Arduino Pin 7

This sensor will detect the presence of your hand in front of the dispenser.

Set Up the Relay

Screenshot 2025-06-15 142710.png

Once the relay module is set up on the breadboard, you can begin connecting it to both the power supply and the Arduino. First, connect the VCC pin of the relay module to the positive rail on the breadboard. This ensures the relay consistently receives 5V from the Arduino. Then, connect the GND pin of the relay to the negative rail of the breadboard, which is linked to the Arduino’s GND pin to create a shared ground. Finally, connect the IN (input) pin of the relay to digital pin 5 on the Arduino. This allows the Arduino to control the relay, turning the water pump on or off based on input from the distance sensor. With this setup, the relay acts as a switch controlled by the Arduino, managing the operation of the water pump automatically.

Set Up the Pump and LED

Screenshot 2025-06-15 142859.png

To connect the water pump safely and allow the Arduino to control it via the relay module, follow these steps:

Connect the positive terminal of the pump to the 5V pin on the Arduino. Then, connect the negative terminal of the pump to the COM (Common) terminal on the relay module. Next, connect the GND (ground) pin of the Arduino to the NO (Normally Open) terminal on the relay.

In this setup, the relay acts as a switch that the Arduino controls. When triggered, the relay completes the circuit between the Arduino's power and ground lines, allowing current to flow through the pump and power it on. This setup lets the Arduino turn the pump on and off safely while using its own 5V supply.


Connect a 330Ω resistor to the shorter leg (cathode) of the LED, and connect the longer leg (anode) to digital pin 8 on the Arduino.

Upload the Code to Arduino

Screenshot 2025-06-16 180632.png
Screenshot 2025-06-16 180802.png

The code uses an ultrasonic distance sensor to detect when a hand (or object) is placed close to the dispenser. It works by sending out an ultrasonic pulse from the sensor’s trigger pin and measuring the time it takes for the echo to return. This time is then converted into a distance measurement in centimeters.

If the measured distance is less than the set threshold (10 cm), the Arduino activates the relay to turn on the water pump and lights up the green LED as an indicator. When no hand is detected within this range, the pump and LED turn off.

The code continuously repeats this process, allowing the water dispenser to automatically turn the pump on or off based on proximity detection.

Decorating Water Dispenser(optional)

Screenshot 2025-06-15 143218.png

To give your water dispenser a neat and finished look, you can build a custom enclosure using cardboard:

  1. Cut five equal pieces of cardboard, each measuring about 5 inches by 5 inches. Four of these will form the sides of the box, and one will be the base.
  2. On one of the side pieces, carefully cut a hole to fit the distance sensor so it can detect your hand without obstruction.
  3. Cut another small hole near the top or side of the box to allow the pump’s tube to exit the enclosure freely without bending or pinching.
  4. Use hot glue or strong adhesive to assemble the four side pieces into a box shape, then attach the base piece to complete the enclosure. Make sure all edges are secure.
  5. Place your water container with the pump inside the cardboard box. Position the sensor so it faces outward through the hole you cut.
  6. Feed the pump’s tube out through the hole you made for it, ensuring it can deliver water without restriction.



Testing

How to Test the Water Dispenser:

  1. Take two containers. Place the water pump inside one container filled with water.
  2. Use the other container as the receiving cup where the water will be poured.
  3. Wave your hand near the distance sensor. This should trigger the pump to turn on and start pumping water into the second container.
  4. When you move your hand away from the sensor, the pump will stop, and the LED indicator will turn off.

You’re all done! Congratulations — you’ve just built your very own automatic water dispenser from scratch. With your Arduino, pump, sensor, and some creativity, you created a handy device that senses your hand and dispenses water without any buttons. Whether you use it for fun, a project, or practical purposes, you now have a cool, tech powered gadget that you made yourself. Great job!


project not working? here are some common mistakes you might have made:

Reversing LED legs (polarity mistake)

  1. The longer leg (anode) goes to the Arduino pin; the shorter leg (cathode) goes to ground through a resistor.

Incorrect breadboard connections

  1. Double-check the wires on the breadboard.

Wrong pin number in code

  1. Make sure the code uses the correct pin (e.g., pin 8) that matches your physical wiring.

if Relay is clicking but pump not running

Double-check that the pump’s positive wire is connected to the relay's NO (Normally Open) terminal and the COM (Common) is connected to the power source.

Downloads

Final Results!

IMG_5530.jpeg