DIY: ANTI-CORONA VIRUS HAND WASHING STATION

1,757

13

3

Introduction: DIY: ANTI-CORONA VIRUS HAND WASHING STATION

Since we're all in quarantined because of the virus that is going around, we want to insure that we are practicing social distancing and washing our hands more carefully. The problem is, we aren't doing either of those two things and because of that, we've been stuck inside for 3 months.

We all know that public washrooms are very yucky and the last thing we want to do is touch the soap dispenser that is covered with germs that you didn't even know existed. So I've decided to make a solution to that!

Introducing my state of the art hand washing station!

Not only does it ensure that you wash your hands properly for 20 seconds, but you won't have to make direct contact with anything! Meaning that you can peacefully wash your hands without having to worry about touching surfaces that are infested with germs! And if someone tries to stand too close to you while you're washing your hands, then a loud alarm will go off, telling that person to stand 1 meter away.

Well let's get to it!

Supplies

What you will need for all 3 circuits:

What you will need for the 1 Meter Distance Sensor:

What you will need for the Soap Dispenser

What you will need for the main Hand Washing Station:

Step 1: Understanding How a Breadboard Works (optional If You Are Not Using a Breadboard)

Breadboards are oftentimes the foundation of a circuit. They help keep everything more clean and organized. Since we aren't really going to use the breadboard that much, it is still important to understand how to use it. A bread board consists of a bunch of holes, where many of them are connected. We can place electronic components into these holes and create circuits. See the diagram above for an example. Often times, the side railings that are connected horizontally will be used as ground and power in order to keep things organized. We will do the same for this project.

Step 2: Making the Main Hand Washing Station: Understanding How a Distance Sensor Works

Ultrasonic distance sensors are very cool piece of technology. As you can see, the sensor features two large circles (one transmit, the other receives) that are used to emit a sound wave that is unable to be heard by humans. This is because humans can only hear up to a frequency of 20,000 Hz and this sensor is emitting sounds that is higher than that. This sensor then waits for the sound to be reflected back after hitting an object (like a person for example) and it calculates the distance based off how long it took for it to go and come back. Therefore if the sound wave takes way too long to come back, it means that the object in front of the sensor is very far. The image above is a perfect demonstration on how the distance sensor works.

Step 3: Making the Main Hand Washing Station: How an RGB LED Works

RGB LEDs are also very interesting on how they work. An RGB LED works very similarly to a standard LED, but instead of one single colour, it can display almost any colour. This is because there are smaller LEDs all packaged together inside: red, green and blue. These LEDs come in two variation: common cathode or common anode. A common cathode LED is where all the LEDs inside all share the same cathode in a single pin. A common anode is the same thing but instead with an anode pin. For this project, we will be using a common cathode LED.

Step 4: Making the Main Hand Washing Station (Step 1) - Plugging the Components In

To start this project, let's begin plugging things in.

  • First, use a jumper cable and connect 5V on the Arduino to the power line on the breadboard then connect GND to the breadboard.
  • Then place the RGB LED onto the bread board. **Make sure each pin is on it's on row and not connected in parallel**
  • Place the distance sensor onto the board similarly to the RGB LED.

Step 5: Making the Main Hand Washing Station (Step 2) - Adding More Components and Connecting Wires

Lets add power to the components.

  • Connect the VCC pin on the distance sensor to the power rail. Then connect the GND pin to the ground rail. (Both GND and VCC should be labeled)
  • The RGB LED is a bit tricky to work with if you aren't paying attention. The pin that is the longest out of all of them is the common cathode pin. That pin should be connected to ground. The pin that is on the left of it (there should only be 1 pin on the left, if there is two, then flip your LED), that is your red pin and the one to the far right is your green and blue.
  • Connect your red pin to a 330 Ohm resistor, and the green and blue to their own individual 220 Ohm resistor.
  • Connect the power socket of the servo to power rail (the socket should be followed by a red wire).
  • Connect the ground socket of the servo to the ground rail ( should be followed by a black wire).

Step 6: Making the Main Hand Washing Station (Step 3) - Connecting RGB LED, Distance Sensor and Servo

  • Connect the 330 Ohm resistor to pin 11 on the Arduino by using a jumper cable.
  • Connect the the 220 Ohm resistor from the blue pin to pin 6 on the Arduino by using a jumper cable.
  • Connect the the 220 Ohm resistor from the green pin to pin 5 on the Arduino by using a jumper cable.
  • Connect the TRIG pin on the distance sensor to pin 9 on the Arduino.
  • Connect the ECHO pin on the distance sensor to pin 10 on the Arduino.
  • Connect the remaining socket on the servo to pin 7 on the Arduino.

Step 7: Making the Main Hand Washing Station (Step 4) - CODING

Now that we are done wiring, it is time for us to code! Luckily for you, I have the code ready. You can adjust how long you want the servo to move (aka how long you want the user to wash their hands) by going in the code, and changing it. I left a note where you can do it.

#include
Servo servoMain; //Dynamic Innovator const int trigPin = 9; const int echoPin = 10;

// defines variables long duration; int distance; int safetyDistance; int redPin = 11; int greenPin = 5; int bluePin = 6;

void setup() { pinMode(redPin, OUTPUT); pinMode(greenPin, OUTPUT); pinMode(bluePin, OUTPUT); pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output pinMode(echoPin, INPUT); // Sets the echoPin as an Input Serial.begin(9600); // Starts the serial communication servoMain.attach(7); } void setColor(int red, int green, int blue) { analogWrite(redPin, red); analogWrite(greenPin, green); analogWrite(bluePin, blue); }

void loop() {

digitalWrite(trigPin, LOW); delayMicroseconds(2);

digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);

distance= duration*0.034/2;

safetyDistance = distance; if (safetyDistance <= 10 ){ servoMain.write(0); delay(20000);// This is how long it will take for someone to wash their hands, currently it is at 20 seconds. setColor(0, 255, 0); } else{ servoMain.write(90); delay(10000); setColor(255, 0, 0); // if you want it to be a different colour instead of red, you can change it here } }

Step 8: Making the Soap Dispenser (Step 1) - Plugging the Components In.

You can make this project on 1 Arduino, however you will need to make sure you have enough pins available on your Arduino. Since I am creating this on Tinkercad, I will have to make it on a fresh Arduino or else everything will begin to lag during simulation.

  • Plug the distance sensor onto the breadboard. Make sure they aren't all connected in parallel and each pin is on its own row!!
  • Plug the 5V to the power rail of the breadboard. Then plug the GND pin to the ground rail of the breadboard.
  • Connect the VCC pin of the distance sensor to the power rail of the breadboard.
  • Connect the GND pin to the ground rail of the bread board.
  • Connect the power socket of the servo to power rail (the socket should be followed by a red wire).
  • Connect the ground socket of the servo to the ground rail ( should be followed by a black wire).

Step 9: Making the Soap Dispenser (Step 2) - Adding the Final Wires

  • Connect the TRIG pin on the distance sensor to pin 9 on the Arduino.
  • Connect the ECHO pin on the distance sensor to pin 10 on the Arduino
  • Connect the remaining socket on the servo to pin 7 on the servo.

That's basically it for the soap dispenser. Remember to place the servo on top of a soap bottle so when it is activated, it pushes down on the soap bottle.

Step 10: Making the Soap Dispenser (Step 3) - Coding

#include

Servo servoMain1; //Dynamic Innovator const int trigPin = 9; const int echoPin = 10;

// defines variables long duration; int distance; int safetyDistance;

void setup() { pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output pinMode(echoPin, INPUT); // Sets the echoPin as an Input Serial.begin(9600); // Starts the serial communication servoMain1.attach(7); }

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;

safetyDistance = distance; if (safetyDistance <= 10 ){ // Enter the Distance servoMain1.write(90); // Turn Servo Left to 45 degrees delay(1000); // Wait 1 second servoMain1.write(0); delay(1000); } else{ servoMain1.write(0); delay(1000); } }

Step 11: Making the 1 Meter Distance Sensor (Step 1) - Adding the Components

  • Plug the 5V to the power rail of the breadboard. Then plug the GND pin to the ground rail of the breadboard.Connect the VCC pin of the distance sensor to the power rail of the breadboard.Connect the GND pin to the ground rail of the bread board.
  • Plug the VCC pin of the distance sensor the power rail and plug the GND pin to ground rail.
  • Plug the Piezo into the breadboard and connect its negative pin to the ground rail on the breadboard.
  • Connect the LED's anode leg to a 330 ohm resistor with a jumper cable. Then connect the LED's cathode leg to the ground rail.

Step 12: Making the 1 Meter Distance Sensor (Step 2) - Connecting It With the Arduino

  • Connect the TRIG pin on the distance sensor to pin 9 on the Arduino
  • Connect the ECHO pin on the distance sensor to pin 10 on the Arduino
  • Connect the remaining pin on the Piezo to pin 11 on the Arduino.
  • Connect the 330 ohm resistor to pin 13 on the Arduino.

Step 13: Making the 1 Meter Distance Sensor (Step 3): CODING

//Dynamic Innovator

const int trigPin = 9; const int echoPin = 10; const int buzzer = 11; const int ledPin = 13;

// defines variables long duration; int distance; int safetyDistance;

void setup() { pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output pinMode(echoPin, INPUT); // Sets the echoPin as an Input pinMode(buzzer, OUTPUT); pinMode(ledPin, OUTPUT); Serial.begin(9600); // Starts the serial communication }

void loop() {

digitalWrite(trigPin, LOW); delayMicroseconds(2);

digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);

distance= duration*0.034/2;

safetyDistance = distance; if (safetyDistance <= 100 //you can adjust the distance here ){ digitalWrite(buzzer, HIGH); digitalWrite(ledPin, HIGH); } else{ digitalWrite(buzzer, LOW); digitalWrite(ledPin, LOW); }

}

Step 14: FINISH!

You guys can create your own contraptions that will work with the servos. I made 3-D renders that demonstrates on how each of these circuits can work in your bathroom. The servo that is involved with the hand washing station has a rod that lifts the sink's handle up and down depending on if the distance sensor is detecting something.

Well I hope you have as much fun as I did when I made this. Hopefully this project can result in a cleaner world where we don't have to be quarantined all the time!

Arduino Contest 2020

Participated in the
Arduino Contest 2020

Be the First to Share

    Recommendations

    • Halloween Contest

      Halloween Contest
    • Robots Contest

      Robots Contest
    • 3D Printed Student Design Challenge

      3D Printed Student Design Challenge

    3 Comments

    0
    rifqifathinalfarisi
    rifqifathinalfarisi

    Question 7 months ago on Step 7

    I like your project i want to use it for my study i will give credit later but, sorry to ask. The main hand wash code for servo (in void loop) seems did nothing or can you please explain? Thank you friend... :)

    0
    MrShahmeerKhan
    MrShahmeerKhan

    Answer 7 months ago

    If there weren't any issues that popped up when you had ran the code, it might just be something wrong with the hardware/wiring. Make sure that the const pins I established match with the ones on your circuit.