Sharifdeen Ashshak
Published © GPL3+

Get use of the Technology in using Smart Sanitizer

Here I made a cool sanitizer using some cool electronic components. So we can protect our hands from COVID19 in these days

BeginnerFull instructions provided1,721
Get use of the Technology in using Smart 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
Cable Management Tool, Cable Tie Gun
Cable Management Tool, Cable Tie Gun
×1
Breadboard (generic)
Breadboard (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Code

coding.ino

C/C++
//for more projects
//www.blackkeyhole.com
  
#include <Servo.h>
Servo myservo;  
int pos = 0;  
const int trigPin = 5;
const int echoPin = 6;

long duration, distance;

void setup() 
{
  myservo.attach(12);
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT); 
  Serial.begin(9600);
  myservo.write(pos);
}

void loop(){

  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);   
  digitalWrite(trigPin, HIGH);     // send waves for 10 us
  delayMicroseconds(10);
  duration = pulseIn(echoPin, HIGH); // receive reflected waves
  distance = duration / 58.2;   // convert to distance
  delay(10);

  if(distance<18)
  {
      myservo.write(pos+165);
      delay(500);
  }
  else
  {
      myservo.write(pos);
  }
  delay(300);
  
}

Credits

Sharifdeen Ashshak

Sharifdeen Ashshak

34 projects • 40 followers
Ai, IoT, embedded enthusiast

Comments