IOT

Hand Wash Timer Using Arduino

The  World  Health  Organization announced a  public health emergency of  Global Importance on January  30,  2020, with the emergency of CoronaVirus Disease  2019  (covid-19). Coronavirus is a new Covid SARS-COV-2 irresistible infection. Prevention is better than cure” is one of the effective measures to prevent the spreading of COVID-19 and to protect mankind. Currently, humans are employed for Use of Hand Sanitizer, Temperature screening, and mask identification in public places to prevent the spread of COVID-19. 

Hand Washing is quite important because it helps limit the spread of germs to an extent. Handwashing with soap and water for 20-30 seconds can destroy all viruses and bacteria from our hands/. However, we occasionally forget to keep track of time, and germs remain on our hands long after we have washed them. Today, we are going to design a handwash timer using an Arduino, this project will keep track of time for you.

Normal Hand Sanitizer

In a normal hand sanitizer, we have to apply pressure to operate it, and when we apply pressure to it, it creates pressure on the liquid in the container, and when the pressure is released, the hand sanitizer liquid is pumped out. So that was the basic explanation of how a regular hand sanitizer works; now we’ll apply that logic to the construction of an automatic hand sanitizer dispenser.

Handwash Timer

When an adult is asked to wash his hands for 30 seconds, he would most likely comply, but how will a child? They will not understand it and may not follow it in your absence due to their lack of understanding.

Handwashing with soap and water for 20-30 seconds can destroy all viruses and bacteria from our hands. Hand washing for 20 seconds is recommended by health experts. Is it 20 seconds? While washing one’s hands, it is impossible to monitor the time. A regular stopwatch or timer will not suffice in this situation. So here’s how I’m going to make a 20-second touchless timer. This project uses the Arduino Uno to make a hand wash timer and makes sure you wash your hands for 20 seconds. It uses the ultrasonic distance sensor to perform this.

Components Required

  • Arduino UNO/ Arduino Nano
  • Servo Motor
  • Connecting Wires 
  • Ultrasonic Sensor 
  • Buzzer  
  • Power Supply

How does the Handwash Timer Works? 

when a person approaches the hand sanitizer, the ultrasonic sensor located near the hand sanitizer detects the motion of the hand and sends a signal to the Arduino, which then starts signaling the Servo motor if the hand reaches the desired distance.

We’ve plotted the servo motor’s speed with time (20 seconds = 360 degrees). The servo motor will begin ticking for 20 seconds after receiving the signal from the Arduino. This will assist the user in determining how long he should wash his hands. Now we’ll work on the coding portion of the project.

Interfacing Diagram For Servo Motor

We may require a servo motor, or some electronic component to convert an electrical signal to the mechanical displacement of alcohol-based hand rub or sanitizer via the dispenser for motion or processing the output. The best choice would be to utilize a Servo motor with metal gears for optimum torque. 

Servo to Arduino:

  • Signal to D9
  • Vcc to Vin
  • Gnd to Gnd

Interfacing Ultrasonic Sensor With Arduino 

The ultrasonic sensor’s interface with the Arduino is shown in the diagram below. The ultrasonic sensor’s trigger pin is connected to the Arduino’s D3 pin, and the ultrasonic sensor’s echo pin is connected to the Arduino’s D2 pin.

Sensor to Arduino:

  • Trigger to D10
  • Echo to D11
  • Vcc to Vcc
  • Gnd to Gnd

Connection Diagram Of Buzzer With Arduino 

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;
    }
  }
}

Output:

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 article, we learned How To Make a simple Handwash Timer Using An Arduino.. Hope you all liked this. Will be back soon with more interesting blogs soon.

Leave a Reply

Your email address will not be published.