Arduino Projects

Hand Washing Timer project using Arduino, Ultrasonic Sensor, & Servo

Hand washing timer:

In this article I will be showing you how you can make a simple hand washing timer using Arduino Uno, Servo, Ultrasonic Sensor, 555 Timer IC, and some other electronics components.  All these components are not going to be used in a single project; basically we will make two projects. So, after reading this article you can decide yourself which project you need to get started with. The Hand Washing Timer can be implemented in different ways, but today I will show you how to make the simplest Hand Washing Timer with and without the Arduino. So, in one project we will need to write a code and in another project we will only use simple electronics components. Considering the prevailing circumstances doctors have advised us to stay hygienic and wash our hands for at least 20 seconds to prevent us from getting the Covid-19 because by the time when we wash our hands for at least 20 seconds most of the germs or viruses have been removed from our hands. So in this tutorial we will teach you how you can make your own hand wash timer so that you don’t forget to wash your hands for less than 20 seconds.

Amazon Links:

12v Adaptor:

Arduino Uno

Arduino Nano

Micro Servo Motors

MG996R Servo Motor

HC-SR04 Ultrasonic Sensor:

555 timer IC:

Other Tools and Components:

Top Arduino Sensors:

Super Starter kit for Beginners

Digital Oscilloscopes

Variable Supply

Digital Multimeter

Soldering iron kits

PCB small portable drill machines

*Please Note: These are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!

Hand Wash Timer Project:

In the article we have designed the hand wash timer using two ways:

  • Hand wash timer using 555 IC
  • Hand wash timer using Arduino, servo motor and ultrasonic sensor

Now first we will design the project using 555 IC so we will require the following components:

Components Required:

  • 555 Timer
  • 2N3906 Transistor
  • Two 5.6 KΩ resistors
  • 270 KΩ Resistor
  • 1N4148 diode
  • 5 KΩ resistor
  • 10 KΩ resistor
  • 2N7000 MOSFET
  • Led
  • 68 micro farad capacitor
  • Push button or switch
  • 9V DC battery

Now this circuit is a timer circuit and the heart of the circuit is the 555 timer IC which you can see in the circuit diagram.

hand washing timer

So this little timer circuit runs on 9 volts and the trigger switch which is a push-button switch represented by S1 and when I press the switch it will turn on my LED for 20 seconds. Now we have been told to wash our hands with soap and water for 20 seconds or more to get rid of viruses and germs on our hands as we tend to touch our face which can cause us to become infected with the virus. So this is a little reminder to encourage us to wash our hands for at least 20 seconds.

hand washing timer

Today we are surrounded with technology, we have our Smartphone’s that have built-in timers we could use that but this is more of a permanent solution. It’s a novelty kids would like it that’s what you can do, you can mount your circuit on a breadboard, a gyro board, a strip board and then cut it to fit your enclosure so inside your closure you have slots you just slide it in there with your 9-volt battery and then you become creative on top you could put a push button so when you press the button it activates the light or you can get an LED light. So when you press the button start washing your hands and then when the light goes out you know you have washed your hands for at least 20 seconds. Now you probably noticed other components on my breadboard other than the 555 timer IC like these two transistors so this circuit does not have an on/off switch so when you press the push button it activates the led for 20 seconds and then when LED goes out it actually shuts the circuit down. So there is zero quiescent current due to which the battery will last for a long time so that’s what this extra transistors are doing it’s actually causing the circuit to shut off after the light turns off.

Working of the Handing washing timer circuit:

So while I look at this schematic and we will see how this circuit works the schematic diagram of the circuit that I built in my breadboard this is my twenty second timer and the heart of the circuit is a 555 timer. I have a very detailed article on the 555 timer ic which explains the extreme basics.

hand washing timer

The bipolar type transistor which is 2N3906 but you could use CMOS version will also work. Now when the circuit is off there is no current flowing because this transistor is off which is PNP transistor it is a high side switch. So to activate the circuit press the push button which will activate two steering diodes 1N4148 so the first diode will ground to pin two and six of the 555 timer and will also lead off any charge that is on the 68 μF capacitor. Now the second diode feeds the drain of the MOSFET it will ground the drain of the MOSFET which will turn on the transistor 2N3906 so when the 5KΩ point will be grounded. We will have current flowing from 9 volts through the emitter base Junction through the resistor to ground which would activate the transistor which will power up the 555 timer and turn on our LED. Now because pin two of the 555 timer is grounded it is going to trigger so our output will go high which will turn on the MOSFET. So when the MOSFET drain will go to ground we will release the push button. Now the MOSFET is holding the drain to ground which will turn on and keep the transistor on. So it’s sort of like a latch so as long as pin three is high the transistor will be on powering the circuit. so now our capacitor two can start charging the RC Network 270 K ohm resistor and a 68 micro farad capacitor which will give us 20 seconds. So it starts charging until it hits two-thirds VCC and then it will shut off pin 3 which will turn off the FET and turn off the transistor and will have zero current zero current until the next press of our push button. The formula for calculating the timer T on in seconds is:


R is in ohms and C as in farads so in our case we have 1.1 times 270 K times 16 micro farad’s that equals 20.2 seconds.

ton=1.1 ×270 KΩ × 16 μF
ton=20.1 seconds

ton=1.1 x 279 KΩ

So you could pick your arrangement of RC that will give you a 20 second time using this formula.

Hand washing timer using ultrasonic sensor with arduino:

Now we will design hand wash timer using ultrasonic sensor with arduino for designing this project we will require the following components:

  • ArduinoUNO
  • Ultrasonic sensor
  • Jumper wires
  • Servo motor
  • 9V battery

Hand Wash Timer Circuit Design:

hand washing timer

  • Connect the digital pin number 9 of the arduino with the trig pin of the ultrasonic sensor.
  • Connect the digital pin number 10 of the arduino with the echo pin of the ultrasonic sensor.
  • Connect the 5V of the arduino with the VCC of the ultrasonic sensor.
  • Connect the ground of the arduino with the ground of the ultrasonic sensor.
  • After interfacing the ultrasonic sensor we will connect the servo motor with the arduino.
  • Connect the yellow pulse wire of the servo motor with the digital pin number 7 of the arduino.
  • Connect the VCC of the servo motor with the 5V.
  • Connect the ground of the servo motor with the ground of the arduino.

Hand Wash Timer Arduno IDE library setup:

Now in the code we will include the servo library if it is not installed in our arduino ide. In sketch click on the include library and then on the manage library

hand washing timer

Now write servo motor and install the library

hand washing timer

Hand Wash Timer Arduino Complete code:


//servo library

Servo servo;
int trigPin = 8;
int echoPin = 10;
int servoPin = 5;
//int led= 10;
int pos;

long duration, dist, average;
long aver[3]; //array for average

void setup() {

pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
servo.write(0); //close cap on power on


void measure() {

digitalWrite(trigPin, LOW);
digitalWrite(trigPin, HIGH);
digitalWrite(trigPin, LOW);
pinMode(echoPin, INPUT);
duration = pulseIn(echoPin, HIGH);
dist = (duration/2) / 29.1; //obtain distance


void loop() {

for (int i=0;i<=2;i++) { //average distance
delay(10); //delay between measurements



if ( dist<50 ) {

//Change distance as per your need
for (pos = 0; pos <= 180; pos += 1)




Hand Wash Timer Project working:

Now after uploading code to the arduino as we know that servo motor can be rotated 180 degrees almost like a small motor. The servo motor can rotate in both directions clockwise or anti-clockwise according to the code. The HCSR04 or ultrasonic sensor detects the distance. Ultrasonic sensing is one of the best ways to sense proximity and detect distance with high reliability an ultrasonic sensor is an instrument that measures the distance to an object using ultrasound waves. So ultrasonic sensors work by sending out a wave at a frequency above the human audible range the transducer of the sensor acts as a microphone to receive and send the ultrasonic sound. The sensor determines the distance to a target by measuring time lapses between the sending and receiving of the ultrasonic pulse so this is how we get the distance to an object. So we will be using this principle to detect a distance so when the users hand comes close to the hand sensor or the hand wash it will be detected by the ultrasonic sensor and the servo motor will start. So when we place hand in front of the sensor the servo motor will start rotation to 20 seconds for which we have make 20 seconds clock on the paper.

hand washing timer

After the 20 seconds the servo motor will be automatically off and come to the starting point.

Related Projects:

Arduino Automatic Water Tap using Solenoid Valve

Automatic Water Tap without using Arduino

Reduce Water Bill & Electric Bill at Home, DIY project for Home

Engr Fahad

My name is Shahzada Fahad and I am an Electrical Engineer. I have been doing Job in UAE as a site engineer in an Electrical Construction Company. Currently, I am running my own YouTube channel "Electronic Clinic", and managing this Website. My Hobbies are * Watching Movies * Music * Martial Arts * Photography * Travelling * Make Sketches and so on...

Leave a Reply

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

Back to top button