Sanitary Mechanisms: The Automatic Handwash Dispenser
Introduction
With the growing need for safe hygiene during this global pandemic, bathroom sanitation is a rising concern for many. Especially since proper handwashing has been cited as an important practice to prevent COVID-19. For this reason, many are considering the adoption of sensor technology and contactless amenities in public and private spaces. This smart technology may be the future of bathrooms to prevent the transmission of germs and bacteria to the maximum extent.
The Automatic Handwash Dispenser gained massive popularity globally due to public health necessity. It is a fantastic entry point into fluid mechanics and infrared beam-breaking. It requires you to balance sensor sensitivity with the physical prime-time of a water pump.
About Device
When washing hands, the user’s hands are placed under the nozzle and before the sensor. The activated sensor will further activate the pump that dispenses a premeasured amount of soap from the nozzle.
My device is composed of two parts, a source of focused light and a light sensor. When the user’s hands are placed in line of the beam of light, the pump mechanism is activated by the disruption that is sensed by the light sensor.
EXPANDED TECHNICAL DETAILS
The False Positive Problem
An IR Obstacle Sensor (TCRT5000) bounces an invisible laser at your hand and looks for the reflection.
- If the bathroom steam fogs the sensor, or the sun hits it perfectly, it might false-trigger and dump 12 ounces of soap all over your counter while you're asleep!
- The Software Debounce: You must program a rigorous check.
if (analogRead(sensorPin) < triggerValue) {
delay(100); // Wait 1/10th of a second
if (analogRead(sensorPin) < triggerValue) { // Are you STILL there?
pumpSoap();
}
}
- This double-check ensures only a solid, intentional hand placement triggers the pump.
Controlling Viscous Fluids
Water flows easily. Liquid soap is thick and requires significant torque.
- A standard 3V DC toy motor submerged in soap will jam. You must use a dedicated 5V Peristaltic Pump, or a high-torque diaphragm pump.
- The pump is controlled by an N-Channel TIP120 Transistor or a Logic Level MOSFET.
- The Arduino code:
digitalWrite(PumpPin, HIGH); delay(800); digitalWrite(PumpPin, LOW); - You adjust that
800millisecond delay perfectly, so it dispenses exactly a dime-sized amount of soap! It then enters a massivedelay(3000)so it won't trigger twice if you don't move your hand away fast enough.
Required Bathroom Build
- Arduino Nano (Smallest possible board).
- TCRT5000 IR Proximity Sensor (Or HC-SR04 Ultrasonic).
- 5V or 12V Mini Fluid Pump (Diaphragm style).
- MOSFET / Transistor Driver Circuit.
- Silicone Tubing and a waterproof plastic chassis (Soap corrodes electronics quickly!).
Advantages
- An automatic soap dispenser is a touchless device, which helps to ensure that there is no cross-contamination between repeated uses.
- An automatic hand wash dispenser is a lot easier to maintain for a number of reasons.
- With health and hygiene having become a key priority, these devices can make life a lot simpler.
- Dispensers will only distribute a set amount of soap per motion activation. A predetermined amount to be dispensed can be set to a highly efficient quantity in which waste will be minimal.
Demo video
Plzz subscribe, like, comment and share on my youtube channel.
Some project images



Arduino code

I hope you enjoy my project.