Touchless Washing Hands Timer

Touchless Washing Hands Timer © CC BY

Health authorities recommend washing your hand for at least 20 seconds. This device monitors the time while you washing your hands.

  • 997 views
  • 0 comments
  • 7 respects

Components and supplies

Necessary tools and machines

Apps and online services

About this project

I have created this project to count the minimum time recommended by the health authorities that we should wash our hands.

This project works in the following way:

You should close your hand at least 5 cm to the sensor. The device makes a sound and starts the count. After 20 seconds, the device makes 3 sounds and wait for the activation again.

If you have any question, you can send me an email at info@rjconcepcion.com

You can follow me at instagram @lab_torord

Code

Touchless washing hands timer codeArduino
// Touchless washing hands timer

// Info library NewPing https://playground.arduino.cc/Code/NewPing/

#include <NewPing.h> // Library for sensor HC-SR04


const int trigger = 2;  // D2 trigger Pin
const int echo = 3;     // D3 echo Pin
const int max_dist = 200; // max distance 200 cm
const int led = 13;       // Build-in led
const int sonido = 12;    // Buzzer pin

//D9 to pin 12 latch (RCLK) 74HC595 
const int latchPin = 9;
//D10 to Pin 11 Clock (SRCLK) 74HC595 
const int clockPin = 10;
//D8 to Pin 14 Data (SER) 74HC595
const int dataPin = 8;

const int tdigt1 = 4; // Transistor digit 1
const int tdigt2 = 5; // Transistor digit 2

//7Segment display configuration
const byte CHAR_COUNT = 11;
const byte symbols[CHAR_COUNT] = {
//GFEDCBAd
 B01111110, // 0
 B00001100, // 1
 B10110110, // 2 
 B10011110, // 3
 B11001100, // 4 
 B11011010, // 5
 B11111010, // 6 
 B00001110, // 7
 B11111110, // 8 
 B11011110, // 9
 B10000000,  // -
    
};

int dist = 0;   // Distance variable
int var = 20;  // Time varible. You can change this value.

int digt1 = 0;  // Var digit 1
int digt2 = 0;  // Var digit 2


NewPing sonar(trigger, echo, max_dist); // NewPing constructor 

void setup() {
  Serial.begin(9600);   // Set serial communication speed

  pinMode(led, OUTPUT);       // Led pin as output
  pinMode(sonido, OUTPUT);    // Sound pin as output
  pinMode(latchPin, OUTPUT);  // lachtPin as output
  pinMode(dataPin, OUTPUT);   // dataPin as output
  pinMode(clockPin, OUTPUT);  // clockPin as output
  pinMode(tdigt1, OUTPUT);    // tdigit1 as output
  pinMode(tdigt2, OUTPUT);    // tdigit2 as output
  
}

void loop() {
  delay(50);
  dist = sonar.ping_cm(); // Get the distance. 
  Serial.print(dist);     // Print distance in serial monitor.
  Serial.println("cm");
  delay(500);             


  // Start this cycle if the distance is less than 5 cm
  if ((dist <= 5) & (dist > 0)) {
    digitalWrite(led, HIGH); 
    beep(200);                      // Make a sound

    while (var > 0){                // While cycle for counter 

    digt1 = var % 10;               // Get the remainder
    digt2 = var / 10;              //  Get first digit
      
    for (int i=0; i<50; i++) {      // Show every digit 10 ms.
    digitalWrite(tdigt1, HIGH);
    writeLeds(symbols[digt1]);      // Write symbols in the displays.
    delay(10);
    digitalWrite(tdigt1, LOW);

    digitalWrite(tdigt2, HIGH);
    writeLeds(symbols[digt2]);
    delay(10);
    digitalWrite(tdigt2, LOW);

    }
    
    var--;                        
    
    }
                                  
    var = 20;
    beep(200);
    beep(200);
    beep(200);
  }
                                  //If the sensor is not active.
  else {     
       
    digitalWrite(led, LOW);
    
    digitalWrite(tdigt1, HIGH);
    writeLeds(symbols[10]);
    

    digitalWrite(tdigt2, HIGH);
    writeLeds(symbols[10]);
       
    
  }
  
}

// beep function. 
void beep(unsigned char delayms){
  analogWrite(sonido, 200);      
  delay(delayms);          
  analogWrite(sonido, 0);       
  delay(delayms);             
}  


//writeleds function. Info https://www.arduino.cc/reference/en/language/functions/advanced-io/shiftout/
void writeLeds(byte pattern)
{
  
  digitalWrite(latchPin, LOW);
  shiftOut(dataPin, clockPin, MSBFIRST, pattern); 
  digitalWrite(latchPin, HIGH);
  
}
  

Schematics

Schematic
Esquematico circuito 8y1qpjzrt5

Comments

Similar projects you might like

Washing Machine Timer

Project tutorial by Shahariar

  • 4,498 views
  • 5 comments
  • 11 respects

Hand Washing Timer That Sings to You!

Project tutorial by goveil1

  • 297 views
  • 0 comments
  • 0 respects

Simple LCD Timer With Arduino UNO

Project showcase by Hugo Blanc

  • 30,897 views
  • 10 comments
  • 28 respects

Fight Coronavirus: Simple Handwash Timer

Project tutorial by The Tech Lab

  • 1,603 views
  • 0 comments
  • 5 respects

Arduino Mutitasking: Clock + Stopwatch + Timer

Project tutorial by LAGSILVA

  • 21,693 views
  • 13 comments
  • 65 respects

Corona Hand Wash Timer

Project tutorial by Team Random Stuff We Make!

  • 3,128 views
  • 11 comments
  • 38 respects
Add projectSign up / Login