Handy Helper - Hand Washing Timer

by ana3177 in Circuits > Arduino

337 Views, 1 Favorites, 0 Comments

Handy Helper - Hand Washing Timer

GreenGlow.jpg
HandyHelperAnimate.gif

The Handy Helper Handwashing Timer is a small, sleek device that can be mounted onto any standard faucet and changes colors to let users know when they have washed their hands for the full 20-seconds that is recommended by the CDC. This device was initially developed in response to the 2020 COVID-19 pandemic as a way to slow the spread of the virus, though the hope is that our device will assist both families as well as the general public in practicing proper handwashing techniques as a part of their daily life.

HOW IT WORKS: A user moves their hands near the sink, telling the sensor they are ready to wash their hands. A yellow light blinks 3x to let the user know the sensor has picked up on their motion. The user then has 5 seconds to apply soap while the light changes from yellow to green. The light will blink once again, signaling to the user that they should start lathering. From this point, the user has 20 seconds while the light fades from green to red. At this point, the users hands should be properly washed and the light will turn off.

Supplies

List of all supplies needed:

Tools:

  • Soldering iron
  • Heat gun/blow dryer
  • Wire cutters

Circuit

circuit.png

Let's start by setting up our circuit. You can go ahead and solder everything directly, but it may be a good idea to test everything out first using a breadboard. We used an Arduino Lilypad for our project (see supplies list), though the diagram shows the components wired onto an Arduino UNO. Any Arduino will work but smaller is better! The LEDs (common anode) are wired in parallel, with a 220 ohm resistor hooked up to the red lead. The wires are all color coordinated and their colors explained below.

  • RED wire is connected to pin 9 (can use any PWM pin for LEDs)
  • GREEN wire is connected to pin 10
  • BLUE wire is connected to pin 11
  • YELLOW wire connects SDA (pin 2 on lilypad A4 on UNO) on proximity sensor
  • PURPLE wire connects SCL (pin 3 on lilpad A5 on UNO) on proximity sensor
  • GREY wire connects to power (NOTE: in the diagram, you will see that the LEDs are connected to 3.3V while the particle sensor is connected to 5V. This is because the Lilypad can only output 3.3V and while this is enough to power the particle sensor, it works best at 5V so use if possible)
  • BLACK wire connects to ground

Step 2: the Code

You will need to download the library for the particle sensor. Instructions on how to do so can be found here:https://learn.sparkfun.com/tutorials/max30105-par... This step includes the Arduino code below, and as an attachment.

We will just run through the basics of what the code accomplishes in the step. Basically it uses the proximity sensor as a trigger. Once a certain value is met by the proximity sensor, it activates a timer which will cause the device to blink green twice, demonstrating that the device has been activated. It will then hold on green for 5 seconds, allowing the user time to place soap on their hands. The code will then cause the led to blink twice again, indicating the start of the 20 second handwashing timer. At this point, the device will gradually transition from green to red over a period of 20 seconds.

int RED = 9;
int GREEN = 10;
int BLUE = 11;
int IRsens = 2; /*OUT pin on PIR sensor connected to D5 on nano */
int IRstat = 0; /*Status of the PIR sensor, assume no initial motion */

#include <wire.h>
#include "MAX30105.h"

MAX30105 particleSensor;
long unblockedValue; //Average IR at power up

void setup() {
  
  pinMode(RED, OUTPUT);
  pinMode(GREEN, OUTPUT);
  pinMode(BLUE, OUTPUT);
  Serial.begin(9600);

  if (particleSensor.begin(Wire, I2C_SPEED_FAST) == false) //Use default I2C port, 400kHz speed
  {
    Serial.println("MAX30105 was not found. Please check wiring/power. ");
    while (1);
  }

  byte ledBrightness = 0xFF; //Options: 0=Off to 255=50mA
  byte sampleAverage = 4; //Options: 1, 2, 4, 8, 16, 32
  byte ledMode = 2; //Options: 1 = Red only, 2 = Red + IR, 3 = Red + IR + Green
  int sampleRate = 400; //Options: 50, 100, 200, 400, 800, 1000, 1600, 3200
  int pulseWidth = 411; //Options: 69, 118, 215, 411
  int adcRange = 2048; //Options: 2048, 4096, 8192, 16384

  particleSensor.setup(ledBrightness, sampleAverage, ledMode, sampleRate, pulseWidth, adcRange); //Configure sensor with these settings

  //Take an average of IR readings at power up
  unblockedValue = 0;
  for (byte x = 0 ; x < 32 ; x++)
  {
    unblockedValue += particleSensor.getIR(); //Read the IR value
  }
  unblockedValue /= 32;

  delay(3000);
  
}

void loop() {
  long currentDelta = particleSensor.getIR() - unblockedValue;
  unsigned long timer =0;
  if(currentDelta >(long)10){
  timer = millis();
  Serial.println(timer);
  if (timer >= 3000){
    startSequence();
    timer = 0;
  }
  else{
    displayColor(0,0,0);
    Serial.println("bye bye");
  }
 }
 else{
  timer = 0;
  Serial.println("no mo");
 }
}

void displayColor(int r, int g, int b){
  analogWrite(RED,255-r);
  analogWrite(GREEN,255-g);
  analogWrite(BLUE,255-b);
}

void startSequence(){
  Serial.println("ster");
  /*blink yellow x3*/
  for(int i=0; i<2; i++){
    displayColor(255,255,0);
    delay(1000);
    displayColor(0,0,0);
    delay(1000);
  }

  /*fade yellow to green*/
  for(int i=0; i<255; i++){
    int r=255-i;
    displayColor(r, 255, 0);
    delay(35);
  }

  /*blink green 3x */
  for (int i=0; i<2; i++){
    displayColor(0,255,0);
    delay(1000);
    displayColor(0,0,0);
    delay(1000);
  }

  /* fade green to yellow */
  for (int i=0; i<255; i++){
    displayColor(i, 255, 0);
    delay(50);
  }

  /*fade yellow to red*/
  for(int i=0; i<255; i++){
    int g=255-i;
    displayColor(255,g,0);
    delay(25);
    
  }

 displayColor(0,0,0);
 delay(2000);
  
}

Downloads

Step 3: Casting

aerator.jpg
V1resinMold2.PNG
EpoxyRing.JPG
window.jpg

In this step, we will be casting the LEDs in a clear epoxy resin into the shape of a ring. This is so that we can secure them onto our aerator and have a glowing ring around our faucet. Using a wrench if necessary, you will need to remove the aerator (photo 1) from your sink. You may also buy a separate aerator if desired. Next, you will need a mold. This just needs to be a shallow (about 1cm tall) piece made from any plastic (thin plastic will be easier to release the ring) container that is wide enough to fit the aerator and two LEDs. I used the cap from a pill bottle, but mostly anything will work, as shown in the second picture above.

Once you have the aerator and mold, you will need to secure the aerator onto the center of the mold using hot glue. If you would like to be able to remove the device from the aerator, wrap it in plastic wrap before you begin.

Insert the LEDs into the mold in the space between the outside edge of the aerator and the inside edge of your mold, as shown in the second picture above, ensuring that all four leads are sufficiently exposed and have enough separation between one another. This is shown in the 2nd image. You may need to bend them using your wire cutters.

Follow the included instructions for mixing the resin and slowly pour into the mold, ensuring total coverage of LED (be sure to leave the exposed leads uncovered). It should look like the 3rd and 4th image (more or less) when finished.

Step 4: Soldering Electronics

ChipV1.PNG
V1RingwWires.PNG

Once the resin has cured and you have freed the ring from the mold, you may solder together all of the components. It is a good idea to color code your wires as shown in step 1, and use heat shrink tubes between connections wherever possible. If you have any exposed wires either from LED or between connections, you may use hot glue to seal them.

Step 5: Sensor/Controller Housing

lightoffV1.PNG
housing 1.5.jpg

You will now need a container to house your arduino and particle sensor. You may make this from recycled materials (example above uses what used to be a can of pineapples) or, if you have access to a 3D printer, you may print the .STL file that is shown above and attached below (also included a .svg in case you want to laser cut it). It may be a good idea to think about where this is going to go before you decide what you will use to make it, keeping in mind that the particle sensor works best at distances under 6" away. One good place to put it would be near the hand soap, since it would then avoid triggering when using the sink for other purposes. Additionally, you will want to make sure you include a way to access the micro-controller and power connection point.

Once your microcontroller is housed and your sensor positioned, you can reattach your aerator to your faucet and wash those germs away