Wave, dispense, done. In this Automatic Wash Dispenser, your hand becomes the button: an IR sensor detects motion and a servo presses the pump for a clean, measured shot of soap. No touching, no mess, and fewer germs on shared surfaces.
Unlike store-bought units with proprietary refills, this DIY dispenser lets you keep the bottle you already use. You’ll tune the press strength and time yourself, so it works with liquid or foam pumps. The whole system runs on batteries and fits under or beside any sink.
We’ll keep it simple and robust: an Arduino reads the sensor, debounces the signal, then drives a high-torque servo with a safe cooldown so it won’t double-dispense while your hand is still nearby.
Circuit Diagram

Connection
- IR Proximity Sensor Module
- VCC → Nano 3.3
- GND → Nano GND
- OUT → Nano D2
- Signal (yellow/white) → Nano D9
- VCC (red) → Nano 5v
- GND (black/brown) → 6x AA Battery (–) and Nano GND
- Nano Arduino → Can be powered via USB or shared from the battery pack (optional)
Tip:
- Connect all grounds together (battery GND to Nano GND) for a common ground.
Sample Code
#include <Servo.h> Servo myServo;
int sensorPin = 2; // IR sensor OUT pin
int sensorState = 0; void setup() { myServo.attach(9); // Servo signal pin to D9 pinMode(sensorPin, INPUT); myServo.write(0); // Initial position
} void loop() { sensorState = digitalRead(sensorPin); if (sensorState == LOW) { // LOW kapag may object (depende sa sensor mo) myServo.write(180); // Aangat to 90° delay(1000); // Stay for 1 second myServo.write(0); // Babalik sa 0° delay(1000); }
}How It Works?
In Hand Wash Dispenser, the IR proximity sensor watches the area in front of the spout. When a hand enters that zone for a brief moment, the controller treats it as a valid request and ignores tiny flickers from reflections or passing objects.
The controller then triggers a 270-degree gear servo that drives a short linkage or arm. That motion presses a pump head or opens a small valve for a fixed time, producing a consistent dose and then releasing smoothly so the mechanism resets.
Power comes from a battery pack sized for weeks of typical use. The electronics idle at very low current between activations, and the firmware enforces a cool-down window to prevent accidental double shots while the user moves away.
Applications & Extension
Everyday hygiene: kitchens, bathrooms, clinic exam rooms, school sinks, and shop counters—anywhere a lot of hands meet a single pump. Touch-free operation keeps the station cleaner and more inviting.
Operations add-ons: add a Hand Wash Dispenser timer ring (LED or beeper) to coach the 20-second scrub, a low-soap indicator window, or a simple counter that logs activations for facility teams.
Future upgrades: swap to a rechargeable pack, seal the enclosure for splash resistance, tune dose time for liquid vs. foam soaps, or add wireless reporting (ESP-based) for refill alerts without changing the basic user experience.
Watch the Full Demo Video
Here’s the Automatic Wash Dispenser in action
.cr-vrow { display: flex; gap: 20px; align-items: flex-start; justify-content: center; /* ← center horizontally */ max-width: 100%; flex-wrap: wrap; } /* Horizontal video (mas malaki) */.cr-vid16x9 { width: 800px; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; background: #000; box-shadow: 0 6px 16px rgba(0,0,0,.15); margin-inline: auto; /* ← fallback centering */ } /* Vertical video (height match sa horizontal) */.cr-vid9x16 { height: 450px; aspect-ratio: 9 / 16; border-radius: 14px; overflow: hidden; background: #000; box-shadow: 0 6px 16px rgba(0,0,0,.15); }.cr-vid9x16 iframe,.cr-vid16x9 iframe { width: 100%; height: 100%; border: 0; display: block; } /* Mobile view adjustment */ @media (max-width: 768px) {.cr-vrow { flex-direction: column; /* stack videos */ align-items: center; /* center align */ }.cr-vid16x9 { width: min(100%, 800px); /* responsive width, stays centered */ max-width: 100%; }.cr-vid9x16 { height: auto; /* auto height for mobile */ width: 60%; /* keep it narrower */ max-width: 300px; } }Frequently Asked Questions
What does this Automatic Wash Dispenser tutorial cover?
Wave, dispense, done.
What Arduino library does the Automatic Wash Dispenser tutorial use?
The sketch uses standard Wire.h (I2C) or SPI.h plus a part-specific library installable via Arduino IDE → Sketch → Include Library → Manage Libraries. See the Sample Code section.
Why does the Automatic Wash Dispenser act differently on USB power vs battery?
Battery voltage sags under load. Add a 100uF cap across the rails, use a 5V/2A regulator-backed pack, and never power motors from the Arduino's onboard regulator.
