mohammadsohail0008
Published © GPL3+

Social Distancing Device

Social Distancing Device for Covid-19

IntermediateFull instructions provided16,038
Social Distancing Device

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Ultrasonic Sensor - HC-SR04 (Generic)
Ultrasonic Sensor - HC-SR04 (Generic)
×1
Buzzer
Buzzer
×1
Solar Cockroach Vibrating Disc Motor
Brown Dog Gadgets Solar Cockroach Vibrating Disc Motor
×1
9V battery (generic)
9V battery (generic)
×1
9V Battery Clip
9V Battery Clip
×1
Rocker Switch, SPST
Rocker Switch, SPST
×1
cardboard box
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Scissors, Free Fall
Scissors, Free Fall

Story

Read more

Schematics

Circuit

Code

Code

Arduino
// https://www.youtube.com/channel/UCaXI2PcsTlH5g0et67kdD6g  //
// Social Distancing Device //
// By MOHD SOHAIL //

int const trigPin = 4;
int const echoPin = 3;
int const buzzPin = 2;
int const motorPin = 5;
void setup()
{
pinMode(trigPin, OUTPUT); 
pinMode(echoPin, INPUT); 
pinMode(buzzPin, OUTPUT);
pinMode(motorPin, OUTPUT);

}

void loop()
{

int duration, distance;

digitalWrite(trigPin, HIGH);
delay(1);
digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);

distance = (duration/2) / 29.1;

if (distance <= 100 && distance >= 0) {

digitalWrite(buzzPin, HIGH);
digitalWrite(motorPin, HIGH);
} else {

digitalWrite(buzzPin, LOW);
digitalWrite(motorPin, LOW);
}

delay(60);
}

Credits

mohammadsohail0008
42 projects • 31 followers

Comments