DIY Hand Sanitizer Dispenser Using Arduino

by MissionCritical in Circuits > Arduino

16569 Views, 54 Favorites, 0 Comments

DIY Hand Sanitizer Dispenser Using Arduino

thumbnail-1.jpg
1.2.jpg
1.3.jpg
gif1.gif

In this current scenario of global outbreak, it is advised by WHO (world health organization) to maintain Healthy Hand Wash and Sanitation Habits, but the main problem is the way we do it, that is by physical touch to the bottle, which in short doesn’t serve our purpose, so in this tutorial, we will learn How To make a D.I.Y. Arduino Based Soap or Hand Sanitizer Dispenser.

Supplies

Electronics:

  1. Arduino Nano ( or any Arduino ).
  2. Ultrasonic Sensor ( HC-SR04)
  3. Servo Motor ( metal Geared Preferred ).
  4. Jumper Wires ( female to female ).
  5. misc

Tools:

  1. Hot Glue Gun.
  2. Computer or Laptop.

Misc:

  1. Alcohol Based Hand Rub or Sanitizer. ( most important)
  2. Self Threading Screw ( 1 pcs).
  3. 0.8 mm copper wire ( 0.5 meter ).
  4. plastic container ( which fits everything inside comfortably)
  5. Stationary ( marker and ruler scale ).

Watch the Video

Select the Liquid

3.1a.jpg
3.3.jpg
3.2a.jpg

First and the most important thing we will need for this build is Alcohol Based Hand Rub or Hand Sanitizer or Hand Wash as suggested by W.H.O. ( world health organization ) find more information here .

for this build, it is very important to get right kind of dispenser, since we are just making a dispenser and not printing the entire mechanism, we will need alcohol or hand rub in dispenser or push type bottle.

Selection of Components

4.7.jpg
4.3.jpg
4.5.jpg
4.4.jpg
4.1a.jpg
4.2.jpg

Sensor:

We will need a Sensor to sense our proximity or presence which will basically act as a trigger or touch less switch for this system. We have two choices here, that is we can use either IR sensor Module, or Ultrasonic sensor Module. We can use IR sensor Module, which is basically a cheap and efficient option, but sometimes inaccurate, or we can use HC-SR04 Ultrasonic sensor, which is quite accurate above 2 cm range, and slightly expensive option, but we will use Ultrasonic Sensor for this Tutorial, for better accuracy.

Motors:

For motion or to process the Output, we might need either a pump, either motor, or some electronic component that will convert electrical signal to mechanical displacement of alcohol based hand rub or sanitizer through the dispenser, best choice would be to use a Servo motor with metal gears for maximum torque. We will avoid using micro pumps, since they are to be inserted into the container, which again creates vulnerable containment spot. So using an external mechanism with help of servo would be a wise choice.

Microcontroller:

For this project build, we will need a Microcontroller to control the Input and Output, to Calculate the distance or sense the Trigger from Sensor and Process the Output in form of Servo Sweep in our Example, for which we can use any arduino, which makes it easy to adjust the parameters, fine tune outputs, so you can use any Arduino, we will use Arduino Nano for our work case.

Understand the Mechanics

5.1.jpg
5.2.jpg

Let's Understand the Mechanical Arrangement before we start making it. We will need a mechanism which will create a force to push the nozzle down and dispense the liquid, since we are using servo motor, that provides circular motion, it alone can’t create a downwards force, we will need some kind of mechanical arrangement to make it happen,we will use pulley mechanism to fix one end and convert the rotational force to push, we can do that using Copper Wire to create a downwards vector force for transmission, what it basically does is, it convert the circular force of Servo to a downwards acting force vector, to simulate push. but this all sounds complicated, so let’s execute this task bit by bit, following the further steps

Connections

6.1.jpg
6.2.jpg
3.png

Connections for this build is very simple !

Sensor to Arduino:

Trigger to D10

Echo to D11

Vcc to Vcc

Gnd to Gnd

Servo to Arduino:

Signal to D9

Vcc to Vin

Gnd to Gnd


(you can refer to this post for basics & working of Ultrasonic. Click here for Components)

Downloads

Attach Servo to Base

7.1.jpg
7.2.jpg
7.3.jpg
7.4.jpg

First step in mechanical arrangement is to attach Servo motor to one rigid surface inside the box, using hot glue

( be careful while using the hot glue )

Pass the Copper Wire Through Servo Arm

8.1.jpg
8.2.jpg

Pass the Copper Wire through Servo motor using the holes on Attachment Arm, pass at least through 2 holes to ensure proper tension is achieved using circular attachment arm would be better choice, since straight one can get caught inside enclosure.

Add Piece of Hot Glue Stick With Hole in Middle

9.1.jpg
9.2.jpg
9.3.jpg
9.4.jpg
9.5.jpg

Cut about 2 cm long piece of Hot Glue Stick and make a hole in middle, pass the copper wire through the piece of hot glue stick, which will indeed help to increase the surface area at contact point,

End Screw

10.1.jpg
10.2.jpg
10.3.jpg

Attach the second end of wire to another rigid surface (opposite face of servo motor), using a Self Threading Screw or a nail here would be a vise choice since it will allow us to adjust the tension or to remove the bottle for refill.

Upload the Code

vlcsnap-00022.jpg
vlcsnap-00025.jpg
vlcsnap-00026.jpg

In theory our idea sounds perfect, let’s code this Arduino and test our idea in real world.

The code is very simple to understand, we used the servo library, and defined basic setups and variables, the main code is such that it calculates the distance in centimeters and if the distance is less than 10 cm the servo motor performs a sweep motion to release the liquid.

you can find the Library for Servo here.

<p>/*==========================================================================  <br>by "Akshay Momaya"
for "Mission Critical" ( youtube )
******subscribe for more ARDUINO projects and tutorials******
https://www.youtube.com/channel/UCM6rbuieQBBLFsxszWA85AQ?sub_confirmation=1
==========================================================================*/</p><p>const int servo = 9;     //define Servo Signal Pin
const int trigPin = 10;  //define Trigger Pin
const int echoPin = 11;  //define Echo Pin</p><p>// defines variables</p><p>long duration;
int distance;</p><p>#include <servo.h></servo.h></p><p>Servo myservo;    // create servo object to control a servo</p><p>int pos = 0;    // variable to store the servo position</p><p>void setup() {
  pinMode(trigPin, OUTPUT);    // Sets the trigPin as an Output
  pinMode(echoPin, INPUT);    // Sets the echoPin as an Input
  myservo.attach(servo);     // attaches the servo on pin 9 to the servo object  
  myservo.write(0);         // Sets Servo to initially 0 degrees 
  Serial.begin(9600);      // Starts the serial communication
}</p><p>void loop() {
    //
    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);
    
    //Servo
    
    if(distance<10)
    { //Check distance is less than 10cm 
       myservo.write(45); // Sets Servo in stages from 0 to 180 degrees so soap does not pitch out. 
       delay(100);
       myservo.write(90);
       delay(100);
        myservo.write(135);
       delay(100);
       myservo.write(120); //Ajust how far you want the servo to go.
       delay(1000);
       myservo.write(00); // Reset the servo to 0 Degrees
       delay(2500);   //Delay the next time someone can get soap
    }                 
}</p>

code is attached in this Step ( some times copying the code from above doesn't work so please download the code from here )

Testing

11.1.jpg

Once our code is uploaded, it would be good practice to Test this project before we complete this enclosure.

in this test we can clearly see when our hand is placed above sensor and distance for ultrasonic drops below 10 cm, servo motor is engaged and alcohol hand rub is dispensed.

once the project is working properly, we can move further to next step!

Complete the Enclosure

12.1.jpg
12.2.jpg
12.3.jpg
12.4.jpg
12.5.jpg

Once our project seems to be working, it's time to complete the enclosure.

follow the steps to complete it:

  1. measure the Dimensions for Ultrasonic Sensor and holes for Bottle.
  2. make a slot for Copper wire with extra room for Moment.
  3. mark all cutting holes.
  4. use Sharp Blade or Drill to plot the holes.
  5. fix everything with the help of hot glue.

And finally this project comes to life.

All Set!

13.1.jpg
gif2.gif

Finally this project is done!

Please Donate!

14.1.jpg

Most of the parts used in this project would be handy with many of guys, so I would request all of you to make this project and donate it to Hospitals or any needy person, I am personally donating this project to an Essential work force. Do share this video with all your Engineer friends and let’s start a moment, make this project, tag us on Instagram using the id @officialmissioncritical its time to contribute to community and show power of our Arduino Community to fight this Global Issue!