DIY Arduino Projects For Beginners

How to make Automatic hand sanitizer dispenser with Arduino (DIY)

As the Corona Virus contagion spreads in the world, a lot of measures have been put in place to contain the covid-19 virus spread. Though there is covid-19 vaccine, however, certain measures have been adopted to help cub the spread of the virus.

In line with this, a lot of tech companies have done tremendous innovations in designing technological gadgets that will help stop the spread of the virus. One of the gadgets that have been designed, and is in the market is the automatic hand sanitizer dispenser. See images below.

Figure 1: Hand sanitizer dispenser

Automatic hand sanitizer dispenser is a device that automatically dispenses hand sanitizer without you pressing a knob or turning a lever. The device works with a proximity sensor, the sensor senses the presence of the palm, if the palm is close enough to the dispensing nozzle, the device will dispense the sanitizer in small amount enough to serve for the sanitization. This device can be a bit expensive in some countries, hence there is the need for a DIY automatic hand sanitizer dispenser.

In this tutorial I will show you how you can make your own DIY automatic hand sanitizer dispenser.

The parts you need for the design of the automated hand sanitizer dispenser are shown below:

Figure 2: Parts needed for the design of the hand sanitizer dispenser

List of the components used for the design:

  1. Arduino board (1)
  2. Ultrasonic sensor (1)
  3. 5V DC pump (1)
  4. Lithium-ion Batteries (3)
  5.  Battery casing (1)
  6. NPN BJT Transistor (1)
  7. LED (1)
  8. 330R Resistor (1)
  9. Power Jack (1)
  10. Switch
  11. Hose
  12. Sensor support
  13. Container for sanitizer
  14. Jumper wires
  15. Twist strips
  16. Device casing
  17. Screws

Circuit of the design is shown below

Figure 3: Circuit diagram for automatic hand sanitizer dispenser

Connect the components as shown in the circuit diagram, and build the device as shown in the figure below. watch the video to get a better understanding of the construction and detailed explanation of how the device works.

Figure 4: DIY hand sanitizer
Figure 5: Hand sanitizer in use

Below is the Arduino code for the design, copy and paste this code in your Arduino IDE and upload to your Arduino board. Make sure you unplugged the Arduino from the battery before uploading the code to the board.

int trigPin = 9;      
int echoPin = 8;     

int to_transistor=12;    

long duration;
 int distance;
 int led=2;

void setup() 
{
 
  Serial.begin(9600);
  
  delay(random(500,2000));  
  
  pinMode( to_transistor, OUTPUT);
        pinMode( trigPin, OUTPUT);
        pinMode( echoPin, INPUT);
              pinMode( led, OUTPUT);
               digitalWrite(led ,HIGH);
              
}

void loop() {

  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);   
  digitalWrite(trigPin, HIGH);    
  delayMicroseconds(10);
   digitalWrite(trigPin, LOW);
  duration = pulseIn(echoPin, HIGH);
  distance = duration*0.034/2;   
  delay(10);

   Serial.println(distance);
    
  if (distance <=8)            
  {
    digitalWrite(to_transistor, HIGH);                    
     delay(300); 
     digitalWrite(to_transistor,LOW);
     delay(2000);    
                                             
  }
else 
{
  
   digitalWrite(to_transistor, LOW);                    
      
                          
}
       
  }
  
    

You can watch the How-to video of the construction below>

Check out other nice tutorials below:

Arduino remote controlled car
Obstacle avoidance robot
Bluetooth controlled scrolling text display
Water level indicator and control

Leave a Reply

Your email address will not be published. Required fields are marked *