Sartaj S B
Published

Automatic Hand-wash / Sanitizer Dispenser - Peristaltic pump

This device detects the presence of your hand and automatically release a specific amount of Hand-wash / Sanitizer to your hand.

BeginnerWork in progress4 hours30,413
Automatic Hand-wash / Sanitizer Dispenser - Peristaltic pump

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Peristaltic Pump 12 V
×1
Ultrasonic Sensor - HC-SR04 (Generic)
Ultrasonic Sensor - HC-SR04 (Generic)
×1
BC 547 NPN Transistor
×1
1N4007 – High Voltage, High Current Rated Diode
1N4007 – High Voltage, High Current Rated Diode
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Hook Up Wire Kit, 18 AWG
Hook Up Wire Kit, 18 AWG
×1
12 V 1 A Adapter
×1

Software apps and online services

Arduino IDE
Arduino IDE
Tinkercad
Autodesk Tinkercad

Hand tools and fabrication machines

Hot glue gun (generic)
Hot glue gun (generic)
Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

Circuit Diagram

Code

Code

C/C++
#define echoPin 4                // defining pins and variables
#define trigPin 5
int long duration;
int distance;

const int motor= 10;             // pin connected to base of npn transistor

void setup()
{
  pinMode(echoPin,INPUT);        // defining pin modes
  pinMode(trigPin,OUTPUT);  
  pinMode(motor, OUTPUT);        
}

void loop()
{
  digitalWrite(trigPin,LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin,HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin,LOW);
  duration=pulseIn(echoPin,HIGH);
  distance=(duration*0.034/2);   // now you got the distance 

  if(distance<=20)               // checking the presence of hands in 20 cm limit
  {  
    digitalWrite(motor,HIGH);    // if present motor operates for some time
    delay(4000);                  // delay value to changes the operating time
    digitalWrite(motor,LOW);     // pump stop working for some time
    delay(1000);                 // some delay prevents continous operation
  }
  else 
  {
    digitalWrite(motor,LOW);     // if no hands detected - no operation
  }
}

Credits

Sartaj S B
1 project • 5 followers

Comments