top of page

Arduino Based Automatic Hand-Washer

Heading 1

Businesswomen Walking in Hallway

In this project you can see how can we control servo motor using arduino and ultrasonic sensor and make a untouch hand washer.

How the project work :

When any person take his/her hand near to ultrasonic sensor, then ultrasonic sensor read 5cm distance or less servo will rotate in 120 degree and sanitizer will come into your hand, and after some time servo will rotate 0 degree.


Connection -- 

HardwarePut  the trigpin of ultrasonic sensor in pin 7 on arduino. Put the echopin of ultrasonic sensor in pin 6 on arduino. Put vcc pin of ultrasinic  sensor to 5v on arduino. Put servo to pin 8 on arduino. Put gnd of  ultrasonic to gnd on arduino. and connect arduino with Pc.


Coding--

##iotianhub

#include <Servo.h>

#define trigPin 7

#define echoPin 6

Servo servo;

int sound = 250;

void setup() {

Serial.begin (9600);

pinMode(trigPin, OUTPUT);

pinMode(echoPin, INPUT);

servo.attach(8);

}

void loop() {

long duration, distance;

digitalWrite(trigPin, LOW);

delayMicroseconds(2);

digitalWrite(trigPin, HIGH);

delayMicroseconds(10);

digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);

distance = (duration/2) / 29.1;

if (distance < 5) {

Serial.println("the distance is less than 5");

servo.write(90);

}

else {

servo.write(0);

}

if (distance > 60 || distance <= 0){

Serial.println("The distance is more than 60");

}

else {

Serial.print(distance);

Serial.println(" cm");

}

delay(500);

}


Email: iotianhub@gmail.com

created by IOTIANS

about us

IotianHub.com is your one-stop destination for Electronics, IoT, Robotics components, Embedded system, Instrumentation, Control and Automation. Its clients are institutions, industries and students. we are working towards excellence in IoT, AI and Robotics domain and believe in pursuing business through innovation and technology. Our team goal is to be a leader in the industry by providing enhanced services, products, relationship and profitability.

IotianHub offers are 100% practical in nature; these involve various hardware and software. Apart from services it also supplies educational kits to the institutions and customized products to various industries.

POLICIES

Copyright ©2020,IotianHub, All rights reserved.

bottom of page