Saturday, April 11, 2020

Hand washing aid

For an index to all my stories click this text

I do not have to remind you that we have a world-wide crisis. So keep safe. Keep a distance to otjhers of at least 1.5 meter and wash your hands regularly for at least 20 seconds.

The hand washing however poses a problem. You need to operate the washing tap and the soap dispenser. There is however a chance that your hands are contaminated and therefore you can contaminate the soap dispenser and the washing tap.
Next to that there is the timing problem. How long is 20 seconds. When you are washing your hands it is longer as you think.

The solution to this is to use an automatic soap dispenser that offers a mixture of water and soap or even alcohol to sanitise your hands. The dispenser also has a led that lights up for 20 seconds. So you are sure that you are cleaning your hands thorough.

The objective of this build.

Well you guessed it. Build a sterile setup to wash your hands.

What I am going to show you is how to build a device that has a container with soap. Inside the container is a pump. Outside there is a sensor and a led. When your hand nears the sensor the pump will dispense some soap. After that a red led is lit and stays on for 20 seconds. So you will have a visisble feedback for the minimum time you need to wash your hands.


What you will need to build this project.

- An ESP8266 or a member of the Arduino family
- 2 220 ohm resistors for the leds
- 2 leds a red one and a green one
- 1 100 ohm resistor
- A small pump
- A TIP 120 power transistor
- An HC-SR04 ultrasonic distance sensor.
- An USB breadboard connector
- An USB power supply

And for the build itself
- a container for the soap/water mixture
- a rubber thule
- a hose that fits the pump

The rubber thule is not really required. If you do not have one just use hot glue to fix the hose to the container.
The container itself can be a large jar or anything you might find.
The hose can be found at most home improvement shops.

All the electronics and the pump can be found at your local electronics shop, on ebay or at your favorite chinese supplier. Although the last option might take much too long for this situation.
The color of the leds is not critical and neither is the TIP120. You can replace it with any other suitable power transistor or a mosfet.

The schematics.

I'll give you two versions of the schematics. The Fritzing breadboard setup and a schematic.






Real life setup.



The picture shows my prototype on a breadboard. It works as figured. I will try this setup for a short time and then build a real housing for permanent use.

The program



// Get some soap without contact and
// wash your hands timer
// Luc Volders 
// http://lucstechblog.blogspot.com/

// define pin numbers
const int trigPin = 14;  //D5
const int echoPin = 16;  //D0
const int ledGPin = 12;  //D5
const int ledRPin = 13;  //D5
const int Motorpin = 15; //D8

// define variables
long duration;
int distance;

void setup() 
  {
  pinMode(trigPin, OUTPUT); // Set trigPin as Output
  pinMode(echoPin, INPUT); // Set echoPin as Input
  pinMode(ledGreenPin, OUTPUT);
  pinMode(ledRedPin, OUTPUT);
  pinMode(Motorpin, OUTPUT);
  digitalWrite(ledGreenPin, LOW);
  digitalWrite(ledRedPin, LOW);
  digitalWrite(Motorpin, LOW);

  Serial.begin(9600); // Start 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);

  // Read echoPin, 
  // return the sound wave travel time in microseconds
  duration = pulseIn(echoPin, HIGH);

  // Calculate the distance
  distance= duration*0.034/2;
  // Print the distance on the Serial Monitor
  Serial.print("Distance: ");
  Serial.println(distance);
  // The distance at what the pump starts
  if (distance < 10)
  {
    digitalWrite(ledGPin, HIGH);
    digitalWrite(Motorpin, HIGH);
    // The pump runs 5 seconds then it shuts down
    delay (5000);
    digitalWrite(ledGPin, LOW);
    digitalWrite(Motorpin, LOW);
    digitalWrite(ledRPin, HIGH);
    // The led will stay on for 20 seconds
    delay (20000);
    digitalWrite(ledRPin, LOW);
  }
  delay(2000);


I dont think it will pose any problems. You can copy it and paste it into the Arduino IDE. The tricky part is the distance calculation but that works as is. I will not go into detail about this now as I just want to offer you a working project here.

Adjusting for your own needs

You can use an ESP8266, ESP32 or any member of the Arduino family when building this.  You'll only need 4 I/O pins when leaving the green led out. So an Attiny 85 could do the job.

By using an ESP32 or Arduino you could add another sensor and pump to have seperate soap and water dispensors.

I set the distance from your hands to the sensor at 10 cm. So when your hands are within that range the pump will start. Adjust this to your own build.

In the program the setting for the pump is 5 seconds. Adjust this to your own needs. This timing is dependend on the length of the hose you are using and the kind of soap mixture. So test.


Depending on the soap or mixture you are using it may be possible to have the motor run reverse for an instance so no soap or alcohol is spilled when the pump stops. You can use an H-Bridge for that. You can find a description on the H-Bridge here:
http://lucstechblog.blogspot.com/2019/02/remote-controlled-car-with-wifi.html

After the pump is shut down the led will light for 20 seconds. You could build in a small delay between the stopping of the pump and the lighting of the led. You can also alter the 20 seconds that the led will stay on. Again test and adjust to what you need.

Demonstration of the prototype





Stay at home, safe and healthy
And have fun during these miserable days.

Luc