Hand Wash Timer Using Arduino
The tutorial show how to design a handwash timer using an Arduino, this project will keep track of time for you.Â
Hello and welcome in this tutorial we going to design a DIY Hand Wash Timer Using Arduino.
As we know that Covid-19 cases in India are increasing day by day. 'WHO' states that periodic handwashing can prevent the spread of coronavirus.
According to WHO hygiene report, washing hands with soap and water for 20-30 seconds can remove all viruses and germs from our hands. But sometimes we forget to take care of time, due to which even though we have washed our hands, germs remain on our hands.
Therefore, in this tutorial, we are designing a handwash timer using an Arduino, this project will keep track of time for you.Â
Here's a video for you.
The Components Will Need To Design A Hand Wash TimerÂ
Working of Handwash Timer
When you ask an adult to wash his hands for 30 seconds, he will probably do it but how will a child do it?
Due to the lack of knowledge, they will not understand it and may not follow it in your absence.
So, what will you do in this matter? The answer is you can develop a system that helps your kids wash their hands for 20 seconds and also entertain them.
Lets Start Designing Hand Wash Timer
To design Hand wash timer, we are using an ultrasonic sensor, general hand sanitizer (or you can use automatic hand sanitizer) and Arduino board.
The ultrasonic sensor we are using for hand detection in this project and the servo motor we are using to design the second hand of the timer as Shown In The Video.
After this, we are also using a buzzer for indication purpose.
Interfacing Diagram For Servo Motor
Interfacing Ultrasonic Sensor With Arduino
Connection Diagram Of Buzzer With Arduino
How does the Handwash Timer Works?
As discussed above, when a person moves closer to the hand sanitizer, the ultrasonic sensor placed near the hand sanitizer will detect the motion of the hand and send a signal to the Arduino and then, if the hand reaches the specified distance, the Arduino will start signalling the Servo motor.
Here we have mapped the speed of the servo motor over time (30sec = 360degree). After receiving the signal from the Arduino, the servo motor will start ticking for 30sec. This will help the user to find out how long he needs to wash his hands.
So, in this way we have got a basic idea of how we can design a hand wash timer. Now we will work on the coding part of the hand wash timer
Code For Hand Wash Timer
#include <Servo.h>
const int echoPin = 2;
const int trigPin = 3;
int buzzer = 2;
Servo myservo;
// defines variables
long duration;
int distance, count;
void setup() {
myservo.attach(9);
pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output
pinMode(echoPin, INPUT); // Sets the echoPin as an Input
pinMode(buzzer, OUTPUT);
Serial.begin(9600); // Starts the serial communication
}
void loop()
{
// Clears the trigPin
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
// Sets the trigPin on HIGH state for 10 micro seconds
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
// Reads the echoPin, returns the sound wave travel time in microseconds
duration = pulseIn(echoPin, HIGH);
// Calculating the distance
distance = duration * 0.034 / 2;
// Prints the distance on the Serial Monitor
Serial.print("Distance: ");
Serial.println(distance);
while (distance < 30)
{
count ++;
if (count < 21)
{
digitalWrite(buzzer, HIGH);
int servo_angle = map(count, 0, 1023, 0, 255);
myservo.write(servo_angle);
delay(1000);
digitalWrite(buzzer, LOW);
}
else
{
digitalWrite(buzzer, LOW);
count = 0;
break;
}
}
}
This is the code which you can use in your application.
After uploading this code to Arduino and interfacing the necessary components to the Arduino board, your timer is ready to help your family members wash their hands.
Conclusion
In this way, we learned to create a simple Handwash Timer Using An Arduino. If there is any doubt, please feel free to ask me.