Project tutorial
Automatic Hand Sanitizer

Automatic Hand Sanitizer © CC BY-NC

This accessory can be attached to most hand sanitizer/soap dispensers to make them Completely Automatic and Hands-Free!

  • 3,488 views
  • 7 comments
  • 14 respects

Components and supplies

Necessary tools and machines

3drag
3D Printer (generic)
Mine is the Creality3D Ender 3 V 2
09507 01
Soldering iron (generic)
(optional)
Hacksaw (generic)

Apps and online services

Ide web
Arduino IDE
3D design program
(optional) I used Onshape
Ultimaker Cura
(Slicer for 3D printing)

About this project

Over the last months the COVID-19 pandemic has been spreading chaos all around the world. There are countless infections and unfortunately many casualties. One of the most important measures suggested by the World Health Organization is constant hand washing with either soap or hand sanitizers. But one of the most significant problems is the way we do it and that is by physically touching the dispenser which eliminates the whole purpose of the action and even creates a great risk of infection. So I, a 14 year old boy, decided to create something using an Arduino Nano board that could combat this problem, but I also wanted it to be cheap and to be able to be attached to many different dispensers easily, quickly and effectively! And this is exactly what I made, an accessory that can be attached to most hand sanitizer/soap dispensers and turn them completely hands-free and automatic

Firstly watch this video to see the device in action and also to understand how it works and how it was made!

Watch this video to see the device in action

Step 1: Understand the Mechanism

So basically a stepper motor is connected with a coupler to a screw. Then the 3D printed presser is connected on one side with the screw using a nut and on the other side it is supported by a 3D printed rod. The rod does not allow the screw's rotational force to rotate the presser and instead the presser moves linearly. This way we can command the stepper to move in any direction (back and forth), at any speed and for as many steps as we like.

Step 2: Understand How the Device Works

The concept is that when the IR Obstacle Sensor, which is attached to the 3D printed IR Holder, gets activated, by simply putting your hand a few centimetres below it, the presser goes down a set distance, (pressing the dispenser) waits for 2 seconds and then returns to the initial position by simply going up until the end-stop switch gets activated. Similarly when the device first gets powered on, the presser will go up until the switch gets activated and then it stops there, as a kind of self-calibration so that the presser is ready for use.

Then using the Velcros you wrap the Hand-Sanitizer of your choice and tighten it as much as possible.

Now the Automatic Hand Sanitizer Dispenser is functional!!

Step 3: Gather the Necessary Components

All the links of the necessary components are located in the "Things" Section.

Step 4: Design Custom Parts

All the 3D printed parts were designed by me on Onshape but you needn't worry about 3D designing because I have provided all the.stl files in the "Attachments" Section.

Step 5: 3D Printing Custom Plastic Parts

I 3D printed the parts on my Creality3D Ender 3 V2 in Grey and White PLA at 0.2mm layer height and at 20% infill. If you don't have access to a 3D printer you could try using cardboard or wood.

Step 6: Modding the stepper

The 28BYJ-48 stepper motor is a small and really cheap stepper motor. It is a unipolar stepper motor and has a torque of about 300 g/cm which works with our project but I want it to be stronger for better results. We can increase the torque to 800+ g/cm by converting it to a bipolar motor with a simple and easy mod!

Bipolar steppers have bigger coils and as a result a lot more torque.

Firstly you want to remove the blue cover with a screwdriver.

Once removed you want to fully cut off the middle trace that goes up to the red wire using a knife.

You want to make sure that it does not connect at all anymore.

Now you can cut off the red wire from both sides.

You can reattach the blue cover now. I needed to cut off 2 of its supports to be able to put it back.

Now you have your own bipolar 28BYJ-48 stepper. It has approximately 2.5 times the initial torque. However now you will need to get a bipolar stepper driver such as the DRV8825 which I am using. The minimum voltage supply for the driver is rated at 8.4V and our motor is rated at 5V. But don't worry the bipolar version of the motor can easily handle that voltage!

Step 7: DIY Velcro Ties x2

It's time to make the Velcro ties that will attach the accessory to the dispenser. If you already have some Velcro cable ties feel free to use them.

You can make them as long or as short as you'd like but I would suggest cutting one part at 30cm - 40cm and the other at 4cm - 7cm.

Now you want to staple the two parts together. Make sure that the sides that will be stapled together are either both rough or both soft.

Now your Velcro tie is ready to use!

You will need two of these.

Step 8: Circuit

It's time to create the electronics circuit! For starters connect the 9V battery's Ground to Arduino Ground with a 100μF electrolytic capacitor in between (Remember the side of the capacitor with the white line is the ground/cathode). Connect the 9V to a generic On-Off switch and then to Vin on the anode of the capacitor. I am using two mini breadboards because they fit well inside the case, use any breadboard you like but take into consideration the limited space.

Connect the IR Obstacle Sensor VCC to 5V, Ground to Ground and finally OUT to Digital pin 9.

Now we are going to connect the end-stop switch. Connect the common leg to 5V and the normally open to Digital pin 8 and to Ground through a 1kΩ resistor.

Add the DRV8825 bipolar motor driver to the breadboard. Connect the Vmot to the Vin of the Arduino. Connect the two Grounds to Ground. Connect the Dir pin to Digital pin 2, the Step pin to Digital pin 3, the Enable pin to Digital pin 4. Connect the Reset and Sleep pin to each other.

Lastly connect the 28BYJ-48's blue cable to A2, the yellow cable to A1, the orange cable to B1 and the pink cable to B2.

The electronics are finally connected!

Step 9: Programming

const int dirPin = 2;

We define the Dir pin of the driver as the Digital pin 2.

const int stepPin = 3;

We define the Step pin of the driver as the Digital pin 3.

const int enablePin = 4;

We define the Enable pin of the driver as the Digital pin 4.

const int stepsPerRevolution = 6000;

We define the number of steps per revolution as 6000, one 360 degree rotation is 2048 steps.

int endStop = 8;

We define the input pin of the endStop switch as the Digital pin 8.

int irSensor = 9;

We define the input pin of the IR obstacle sensor as the Digital pin 9.

void setup()
{
pinMode(endStop, INPUT);
pinMode(irSensor,INPUT);

In setup we declare the endStop and irSensor pins as Inputs.

pinMode(stepPin, OUTPUT);
pinMode(dirPin, OUTPUT);
pinMode(enablePin, OUTPUT);

We declare the stepPin, dirPin and enablePin as Outputs.

digitalWrite(enablePin, LOW);

We set the enablePin LOW to enable the DRV8825 driver

while(digitalRead(endStop) == LOW)
{

As long as the digital value of the endStop switch is LOW (The switch is not being pressed.)

digitalWrite(dirPin, HIGH);

the direction of the motor's rotation is set as anti-clockwise

for(int x = 0; x < 1; x++)
{
digitalWrite(stepPin, HIGH);
delayMicroseconds(2000);
digitalWrite(stepPin, LOW);
delayMicroseconds(2000);
}

and the stepper will rotate anti-clockwise one step at a time until the While statement's condition is false.

digitalWrite(enablePin, HIGH);
}

This disables our driver so that when not in use the driver does not consume much current.

void loop()
{

if(digitalRead(irSensor)== 0)
{

In the loop if the digital value of the irSensor is 0 (there is an obstacle (hand) in front of the IR Obstacle sensor)

digitalWrite(enablePin, LOW);

The driver gets enabled.

digitalWrite(dirPin, LOW);

The direction of the motor's rotation is set as clockwise.

for(int x = 0; x < stepsPerRevolution; x++)
{
digitalWrite(stepPin, HIGH);
delayMicroseconds(2000);
digitalWrite(stepPin, LOW);
delayMicroseconds(2000);
}

The stepper will rotate clockwise for 6000 steps.

delay(2000);

It will wait for 2 seconds.

while(digitalRead(endStop) == LOW) 
{

As long as the digital value of the endStop switch is LOW (The switch is not being pressed.

digitalWrite(dirPin, HIGH);

the direction of the motor's rotation is set as anti-clockwise.

for(int x = 0; x < 1; x++)
{
digitalWrite(stepPin, HIGH);
delayMicroseconds(2000);
digitalWrite(stepPin, LOW);
delayMicroseconds(2000);
}
}

and the stepper will rotate anti-clockwise one step at a time until the While statement's condition is false.

digitalWrite(enablePin, HIGH);
}
}

Then the driver will get disabled until the If statement's condition is true and the code plays again.

Step 10: Assembly

Cover Assembly

Just place the Velcro tie in the gap, add on top of it the holder and screw them together.

x2

Screw the Velcro grip to the cover. The cover assembly is now complete!

x2

Presser Assembly

Push the linear bearing in the right hole until it is in the middle. Screw the T8 nut to the left hole of the presser with 4 screws.

Electronics Case Assembly

Put your circuit in the electronics case. Run the cables of the stepper, the switch and the IR Obstacle sensor through the hole.

IR Obstacle Sensor Holder Assembly

Screw the IR Obstacle Sensor to the hole and use a nut to tighten the fit and adjust the position.

Final Assembly!

Insert the bearing.

Add the T8 screw and the Presser assembly.(The T8 screw needs to be 70mm to 82mm long. If you have a longer screw you should cut it to the wanted size using a tool like a hacksaw. Otherwise you can try 3D printing one.)

Tighten the coupler to the motor's shaft. Then tighten it to the T8 screw. Lastly screw the motor to the base with two screws.

Add the end-stop switch.

Screw the Cover to the base with 5 screws.

Screw the IR Obstacle Sensor Holder to the front of the base with 2 screws.

Ultimately screw the Electronics Case to the Cover with 3 screws! Well done the project is completed!

Conclusion

This project of an Accessory that can turn most Hand Sanitizer/Soap Dispensers completely Automatic and Hands-Free is finally finished!!

Thank you for your time!!

Code

Automatic_Hand_Sanitizer_Transformer.codeArduino
The code of the gadget
// Define pin connections & motor's steps per revolution
const int dirPin = 2; //we define the dir pin of the driver
const int stepPin = 3;//we define the step pin of the driver
const int enablePin = 4;//we define the enable pin of the driver
const int stepsPerRevolution = 6000; // one full (360 degree) rotation is 2048 steps
int endStop = 8;//we define the input pin of the endstop switch
int irSensor = 9;//we define the input pin of the IR obstacle sensor




void setup()
{
  
  pinMode(endStop, INPUT);// Declare pins as Inputs
  pinMode(irSensor,INPUT);
   
  pinMode(stepPin, OUTPUT);// Declare pins as Outputs
  pinMode(dirPin, OUTPUT);
  pinMode(enablePin, OUTPUT);
  
  digitalWrite(enablePin, LOW);// This enables our driver
  
  while(digitalRead(endStop) == LOW)// When the code starts the stepper will rotate until the end stop switch 
  {                                 //stop switch gets activated
    
   digitalWrite(dirPin, HIGH); //the directions is set as anti-clockwise

  // Spin motor slowly
  for(int x = 0; x < 1; x++)
  {
  
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(2000);
    digitalWrite(stepPin, LOW);
    delayMicroseconds(2000);
  }
    
  }
digitalWrite(enablePin, HIGH);// This disables our driver so that when not 
                              //in use the driver does not consume current
}

void loop()
{
  
     if(digitalRead(irSensor)== 0)// If there is an obstacle (hand) in front of the IR Obstacle sensor
     {
digitalWrite(enablePin, LOW);//We enable the driver
digitalWrite(dirPin, LOW);// the direction is set as clockwise

  // Spin motor slowly
  for(int x = 0; x < stepsPerRevolution; x++)// it rotates for the number of steps we declared above(remember one full rotation is 2048 steps)
  {
  
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(2000);
    digitalWrite(stepPin, LOW);
    delayMicroseconds(2000);
  }
  delay(2000); // It waits for 2 seconds
  
  while(digitalRead(endStop) == LOW) //Rotates clockwise until the endstop switch 
  {                                  //is activated thus returning to starting position
    
   digitalWrite(dirPin, HIGH);//the directions is set as anti-clockwise

  // Spin motor slowly
  for(int x = 0; x < 1; x++)
  {
  
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(2000);
    digitalWrite(stepPin, LOW);
    delayMicroseconds(2000);
  }
    
  }
  digitalWrite(enablePin, HIGH);// the driver gets disabled 
      
     }
 
}

Custom parts and enclosures

The main base of the device.
Presser
This is the component that actually presses the dispenser.
The cover of the device.
Electronics Case
Acts as a case for the electronics.
Velcro grip
Creates the Velcro tying mechanism.
You will need two of these.
8mm rod
Acts as support for the presser part.
IR Obstacle sensor holder
It gets connected to the base and acts as support for the ir sensor.
Velcro holder
Holds the Velcros on the cover.
You will need 2 of these.

Schematics

Cirscuit Diagram
Untitled sketch bb 9yw7sxcqjr

Comments

Similar projects you might like

Fighting Corona: Multichoice automatic hand sanitizer

Project tutorial by herolivechannel

  • 4,079 views
  • 1 comment
  • 7 respects

Touch-less Hand Sanitizer

Project tutorial by Gustavo Bertoli and gabriel123br

  • 2,581 views
  • 1 comment
  • 8 respects

DIY Hand Sanitizer Dispenser Using Arduino

Project tutorial by Mission Critical

  • 28,336 views
  • 7 comments
  • 13 respects

Automatic Hand-wash / Sanitizer Dispenser - Peristaltic pump

Project in progress by Rebeldose

  • 6,581 views
  • 8 comments
  • 21 respects

AutoSteri

Project tutorial by David Bershadsky

  • 3,820 views
  • 4 comments
  • 18 respects
Add projectSign up / Login