Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
Akshay Joseph
Published © GPL3+

COVID -19 Social Distancing Reminder

The device beeps when a person or object near less than one meter from you.

BeginnerFull instructions provided8,686
COVID -19 Social Distancing Reminder

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
9V Battery Clip
9V Battery Clip
×1
9v Rechargeble battery
×1
Ultrasonic Sensor - HC-SR04 (Generic)
Ultrasonic Sensor - HC-SR04 (Generic)
×1
5v buzzer
×1
Male/Female Jumper Wires
Male/Female Jumper Wires
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Social Distancing Reminder

Code

Social Distancing Reminder

Arduino
//sketch created by Akshay Joseph
//follow me on Instagram five_volt_player

#define echoPin 4
#define trigPin 3

long int duration;
int distance;
void setup() {

  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  pinMode(13, OUTPUT);


}
void loop() {
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);

  duration = pulseIn(echoPin, HIGH);
  distance = (duration * 0.034 / 2);

  if (distance < 100) {
    digitalWrite(13, HIGH);
    delay(500);
    digitalWrite(13, LOW);
    delay(500);
  }
  else {
    digitalWrite(7, LOW);
  }
}

Credits

Akshay Joseph

Akshay Joseph

25 projects • 157 followers
B.Sc. Electronics Student at Govt. College Tanur

Comments