← Back to blog
Student Projects

Social Distancing Reminder

About This Project

Hello everyone, this is my first project on Arduino Project Hub.

My name is Krishna Srikanth, I am 9 years old. I am a student of MECHATRON ROBOTICS, New Delhi. I have completed a full fledged course on Arduino and electronics in just 2 months. I have always desired to become a scientist in ISRO, Perhaps i’m also taking these small steps at an early age.

In these tough times of COVID-19 Virus, I have made this super easy project Social Distancing Reminder which will help you maintain a distance of 1 metre with another person. This virus spreads rapidly with physical contact and air transmission upto 1 metre. This piezo electric buzzer will create a sound whenever the other person comes as close as 1 metre.

Looking forward to contribute more to this world by more innovative ideas.

Thanks!!

Stay Safe and Happy !

Components Required

  • Arduino UNO
  • Ultrasonic Sensor
  • SG90 Micro-Servo Motor
  • Buzzer
  • Jumper Wires
  • 9V 1A switching Wall Supply

Code Of Project

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;
}
More stories
Book free trial
Buy a kit Become partner Talk to us