Akshay Joseph
Published © GPL3+

COVID - 19 Automatic Hand Sanitizer

Automatic hand sanitizer bottle using Arduino and Servo Motor

BeginnerProtip6,724
COVID - 19 Automatic Hand Sanitizer

Things used in this project

Hardware components

Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×1
UTSOURCE Electronic Parts
UTSOURCE Electronic Parts
×1
Jumper wires (generic)
Jumper wires (generic)
×1
12v Adapter
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Mini Side Cutter, 120mm Length with 25mm Jaw Capacity
Mini Side Cutter, 120mm Length with 25mm Jaw Capacity

Story

Read more

Schematics

Automatic hand sanitizer

Code

Automatic hand sanitizer

Arduino
#include<Servo.h>
#define echoPin 4
#define trigPin 5
Servo Myservo;

int long duration;
int distance;
void setup(){ 
Myservo.attach(3);
pinMode(echoPin,INPUT);
pinMode(trigPin,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);
  
  if(distance<=5){
Myservo.write(180);
}
else {
Myservo.write(0);


}
  delay(500);

}

Credits

Akshay Joseph

Akshay Joseph

22 projects • 58 followers
B.Sc. Electronics Student at Govt. College Tanur

Comments