rohit270798
Published © GPL3+

Social Distancing Reminder

This project will help a person to maintain a minimum distance of 1 metre from another person to avoid further spread of COVID-19 virus.

BeginnerFull instructions provided2,129
Social Distancing Reminder

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
Jumper wires (generic)
Jumper wires (generic)
×1
9V 1A Switching Wall Power Supply
9V 1A Switching Wall Power Supply
×1

Software apps and online services

Tinkercad
Autodesk Tinkercad

Hand tools and fabrication machines

Tape, Gaffer / Duct / Cloth
Tape, Gaffer / Duct / Cloth

Story

Read more

Schematics

Schematic

Code

Code

Arduino
int pingPin = 9;
int buzzer = 11;

void setup() {
  
  Serial.begin(9600);
  pinMode(buzzer, OUTPUT);
}

void loop() {
  long duration, cm;

  pinMode(pingPin, OUTPUT);
  digitalWrite(pingPin, LOW);
  delayMicroseconds(2);
  digitalWrite(pingPin, HIGH);
  delayMicroseconds(5);
  digitalWrite(pingPin, LOW);

  pinMode(pingPin, INPUT);
  duration = pulseIn(pingPin, HIGH);
  cm = microsecondsToCentimeters(duration);

  Serial.print("Distance: ");
  Serial.print(cm);
  Serial.print("cm");
  Serial.println();

  if(cm < 100) {
    digitalWrite(buzzer, HIGH);
  }
  else {
    digitalWrite(buzzer, LOW);
  }
  
  delay(100);
}


long microsecondsToCentimeters(long microseconds) {
  return microseconds / 29 / 2;
}

Credits

Krishna Srikanth

Posted by rohit270798

Comments