Introduction: Social Distancing Alarm

About: Hello everyone ! I am Archit Singh and I study in class 7. Making innovative things is like my hobby . I am 12 now. When I was at 7 then I started making small projects with dc motor and batteries but when I g…

Hello Everyone as we all know that covid-19 is all over the world . So I have taken a small initiative to stop covid-19 by making this alarm. Actually I have coded that the ultrasonic sensor will measure that the distance is less than 2 gaz or not. If it is less than 2 gaz then the buzzer starts beeping and as the person gets closer and closer the buzzer should beep faster and faster. It took me 2 months to make this model .Today in the hour of Trouble this alarm is no less than a boon. I humbly request you all to share this project as much as possible so that our workers, employers and others can be safe from coronavirus till the vaccine arrives. I hope you will share this alarm so that it can be used socially.

Supplies

Arduino Uno, Ultrasonic Sensor, Buzzer, Battery, Body(In which alarm can be made), Decoration Tape

Step 1: Join All the Wires

The Circuit Diagram is Given above. Make all the connections as Directed

Step 2: Source Code of the Project

You have to use arduino ide app to insert the code in arduino. Download the app from this link - https://www.arduino.cc/en/software

Source code -

int trigpin = 4;

int echopin = 5;

int buzzer= 3;

int timer;

long duration;

int distance;

void setup()

{

pinMode(3,OUTPUT);

pinMode(trigpin, OUTPUT);

pinMode(echopin, INPUT);

}

void loop()

{

digitalWrite(trigpin, LOW);

delayMicroseconds(2);

digitalWrite(trigpin, HIGH);

delayMicroseconds(10);

digitalWrite(trigpin, LOW);

duration = pulseIn(echopin, HIGH);

distance = duration*0.034/2;

timer = distance * 10;

Serial.print("Distance: ");

Serial.println(distance);

if(distance<182) {

digitalWrite(3, HIGH);

delay(50);

digitalWrite(3, LOW);

delay(timer);

}

else

{

digitalWrite(3, LOW);

}

}