Automatic Hand Sanitizer Dispenser with Arduino
AUTOMATIC SANITIZER DISPENSER - ARDUINO PROJECT
List of Components :
- Arduino Nano / Uno
- UltraSonic Senor
- Relay Module ( Single Channel )
- DC Motor Pump
- 9 V Battery
- Bread board and Jumpers ( if needed)
Circuit Diagram :
About the Project :
This project is a needed one in this pandemic situation. As many of them requested I made this project. Here we are using the components mentioned above. Once a person comes and stands before the system the machine will automatically detect it and it will pour a little amount of sanitizer.
Code Explanation :
According to the code we have set the machine in such a way that if the person comes closer by 10 cm the motor will automatically switch on. And the motor will be auto cutted after 1 sec. The system will only pour the sanitizer once there is any obstacle found within 10 cm from the machine.
Source Code :
#include <Wire.h>
#define trigPin 8
#define echoPin 9
void setup()
{
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
Serial.begin(9600);
pinMode(7,OUTPUT);
digitalWrite(7,HIGH);
}
void loop()
{
int duration, distance;
digitalWrite(trigPin, HIGH);
delayMicroseconds(100);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = (duration / 2) / 29.1;
Serial.println(distance);
delay(100);
if (distance < 10)
{
delay(1000);
digitalWrite(7,LOW); // Pin 9 connected to Relay (Motor)
delay(500); // wait for a second
digitalWrite(7 , HIGH); // turn the motor off by making the voltage LOW
}
}
THANK YOU
SUBSCRIBE OUR CHANNEL FOR MORE PROJECTS :
Follow my insta page :
Toilet paper dispensers I think this is an informative post and it is very useful and knowledgeable. therefore, I would like to thank you for the efforts you have made in writing this article.
ReplyDelete