Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
Hackster is hosting Impact Spotlights: Smart Home. Watch the stream live on Thursday!Hackster is hosting Impact Spotlights: Smart Home. Stream on Thursday!
Akshay Joseph
Published © GPL3+

COVID - 19 Automatic Hand Sanitizer

Automatic hand sanitizer bottle using Arduino and Servo Motor

BeginnerProtip64,270
COVID - 19 Automatic Hand Sanitizer

Things used in this project

Hardware components

Arduino UNO
Arduino 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
25 projects • 157 followers
B.Sc. Electronics Student at Govt. College Tanur
Contact

Comments

Please log in or sign up to comment.