Picture of Amanpreet kaur
DIY Automatic hand sanitizer dispenser
You liked this Project
You unliked this Project
You Voted this Project
You Retracted your vote for this Project
  • 3
  • 432
by Amanpreet kaur - Tuesday, 21 April 2020, 8:58 PM

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.


  •  Arduino uno
  • ultra sonic sensor or ir sensor
  • servo motor
  • Jumper Wires.


  • Hot glue gun
  • Computer or Laptop.


  • Alcohol Based Hand Rub or Sanitizer.( most important)
  • Self Threading Screw ( 1 pcs).
  • 0.8 mm copper wire ( 0.5 meter ).
  • plastic container ( which fits everything inside comfortably)

Connect servo to pin no. 9 of arduino.

trig and echo pin to 10 and 11 pin respectively.

vcc to 5v and gnd to gnd  of arduino.

 step 1 : take a plastic box, fix screw to one end of box.       

step 2: fix servo motor to another end of box and attach wire to screw and other end of wire to servo by mark the position of bottle

step 3:  make holes for ultra sonic sensor ,sanitizer bottle, and for USB to connect arduino.

step 4: Palce all the components in place and upload the code .    

For more details check the pictures shown explaining each step.                                   

step 1

                                step 1


                                    step 2

step 3

                                     step 3


                                   step 4


const int servo = 9;     //define Servo Signal Pin

const int trigPin = 10;  //define Trigger Pin

const int echoPin = 11;  //define Echo Pin

// defines variables

long duration;

int distance;

#include <Servo.h>

Servo myservo;    // create servo object to control a servo

int pos = 0;    // variable to store the servo position

void setup() {

  pinMode(trigPin, OUTPUT);    

  pinMode(echoPin, INPUT);    





void loop() {

    digitalWrite(trigPin, LOW);


      // Sets the trigPin on HIGH state for 10 micro seconds

    digitalWrite(trigPin, HIGH);


    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: ");






      // delay(100);




     //  delay(100);







[ Modified: Friday, 24 April 2020, 3:26 PM ]
Show comments
  • Picture of Manie KansalManie Kansal - 21 Apr, 23:54
    Its an amazing idea.. #staysafe#