Project tutorial
Social Distancing Reminder – Coronavirus

Social Distancing Reminder – Coronavirus © GPL3+

This reminds people to keep a 2-meter distance from you

  • 3,238 views
  • 2 comments
  • 12 respects

Components and supplies

A000066 iso both
Arduino UNO & Genuino UNO
Arduino Nano works better for this, but I have used an Arduino UNO.
×1
Rhxvhx2dhljmbtloxexc
Arduino Proto Shield
I used it, but it's optional.
×1
Adafruit Mini Breadboard
×1
Elegoo 16 x 2 LCD Display
×1
51gzz5eu9pl. sx425
Ultrasonic Sensor - HC-SR04 (Generic)
×1
Touch sensor
You can also use a button, but you'll need a pull-down resistor.
×1
NTC Thermistor
×1
Mfr 25frf52 10k sml
Resistor 10k ohm
×1
Adafruit industries ada1536 image
Buzzer
×1
09939 01
Rotary potentiometer (generic)
This is to adjust the contrast of the LCD.
×1
11026 02
Jumper wires (generic)
×1
A transparent box to put everything into
It needs to be transparent for you to be able to see the LCD and it needs to be waterproof to light rain
×1

Apps and online services

About this project

The Tutorial Video

What is it?

Reasonably, the most reliable approach to slowing down the spread of the coronavirus is to keep away from others; prevention is better than cure. However, it would be irritating to turn around every thirty seconds and look if someone was approaching you. It would be helpful if there were a device that could warn others to keep away from you. That is the purpose behind the project: to alert others to maintain a 2-meter distance from you. It is a 2-in-1 as the thermistor is not only used to add accuracy to the distance measurement (the speed of sound changes depending on the temperature) but it also means that – by using a button or a touch sensor to switch between the modes – it can have two modes: alerting if someone comes close to you (Mode 1) and measuring the temperature and the distance (Mode 2). The measuring mode shows the temperature and the distance on the LCD.

How does it work?

  • The Arduino measures the temperature.
  • The temperature is used to calculate the distance with greater accuracy.

If the Arduino is on Mode 1:

  • If the distance is between 2m and 1m, the LCD backlight lights up and the LCD shows "Please keep away" and how far away the person is.
  • If the distance is 1m - 50cm the backlight of the LCD flashes and the LCD shows "Keep away"
  • If the distance is less than 50cm the backlight turns off and on twice a second and the LCD shows "STAY AWAY!"

If the Arduino is on Mode 2, the LCD shows the distance on the top and the temperature on the bottom of the screen.

To protect the components from the rain, I attached half a plastic bottle which can be pushed up when there is rain.

It can be attached to (using two pieces of string) and be easily removed from the bottom of a rucksack.

The touch sensor is used to switch between the modes.

How do I build it?

Connect the components according to the circuit diagram below.

Once you have done that, import the libraries under the section named 'Code' – which you can do by (assuming you have opened the Arduino IDE) going to 'Sketch' —> 'Include Library' —> 'Add .ZIP Library...' and selecting the library (which should be a .zip file). Both libraries are needed for the code to work.

When all that is done, you can upload the code below.

Code

The CodeArduino
Upload it to the Arduino.
#include <HCSR04.h>
#include <LiquidCrystal.h>
#define trigPin 7
#define echoPin 6
#define buzzer 9
#define backlight 10

LiquidCrystal lcd(12, 11, 5, 4, 3, 8);
UltraSonicDistanceSensor distanceSensor(trigPin, echoPin);

int tempReading;
double tempK;
float tempC;
int rounded;
int temp_round;
volatile boolean modes = 0;
double distance;

void setup() {
  lcd.begin(16, 2);
  attachInterrupt(0, changeMode, FALLING);
  pinMode(2, INPUT);
  pinMode(buzzer, OUTPUT);
  pinMode(backlight, OUTPUT);
  digitalWrite(backlight, HIGH);
  backlightOn();
}

void loop() {
  tempReading = analogRead(A0);
  tempK = log(10000.0 * ((1024.0 / tempReading - 1)));
  tempK = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * tempK * tempK )) * tempK );
  tempC = tempK - 273.15;
  distance = distanceSensor.measureDistanceCm(tempC);
  temp_round = round(tempC);
  if (modes == 1) {
    backlightOn();
    if (distance >= 300 || distance <= 0) {
      rounded = 0;
      lcd.clear();
      lcd.print("Out of range");
      lcd.setCursor(0, 1);
      lcd.print("Temperature:" + String(temp_round) + " C");
    }
    else {
      rounded = round(distance);
      lcd.clear();
      lcd.print("Distance: ");
      lcd.print(rounded);
      lcd.print(" cm");
      lcd.setCursor(0, 1);
      lcd.print("Temperature:" + String(temp_round) + " C");
    }
  } else {
    if (distance >= 300 || distance <= 0) {
      rounded = 0;
      lcd.clear();
      backlightOff();
    }
    else {
      rounded = round(distance);
      if (distance >= 200) {
        backlightOff();
        lcd.clear();
      }
      else if (distance <= 200 && distance > 100) {
        backlightOn();
        lcd.clear();
        lcd.print("Please keep away");
        lcd.setCursor(0, 1);
        lcd.print("Distance:");
        lcd.print(rounded);
        lcd.print(" cm");
      }
      else if (distance <= 100 && distance > 50) {
        backlightOn();
        lcd.clear();
        lcd.print("Keep away");
        lcd.setCursor(0, 1);
        lcd.print("Distance:");
        lcd.print(rounded);
        lcd.print(" cm");
        delay(200);
        buzz();
        backlightOff();
        delay(100);
        unbuzz();
        backlightOn();
        delay(100);
      }
      else if (distance <= 50) {
        backlightOn();
        lcd.clear();
        lcd.print("STAY AWAY!");
        lcd.setCursor(0, 1);
        lcd.print("Distance:");
        lcd.print(rounded);
        lcd.print(" cm");
        delay(200);
        buzz();
        backlightOff();
        delay(200);
        unbuzz();
        backlightOn();
        delay(200);
        buzz();
        backlightOff();
        delay(200);
        unbuzz();
        backlightOn();
      }
    }
  }
  delay(700);
}

void changeMode() {
  modes = !modes;
}

void backlightOn() {
  digitalWrite(backlight, HIGH);
}

void backlightOff() {
  digitalWrite(backlight, LOW);
}

void buzz() {
  digitalWrite(buzzer, HIGH);
}

void unbuzz() {
  digitalWrite(buzzer, LOW);
}

Schematics

Wiring
coronavirus_distancing_WQxTcxgmYm.fzz
coronavirus_distancing_MA0bILE8zp.jpg
Coronavirus distancing ma0bile8zp

Comments

Similar projects you might like

Coronavirus Live Updator

Project tutorial by Sai Chakradhar

  • 8,491 views
  • 16 comments
  • 41 respects

A Device Which Help Us To Maintain Social Distancing

Project in progress by Rohan Barnwal

  • 2,170 views
  • 2 comments
  • 9 respects

Fun Coronavirus Kids Soap Clock

Project tutorial by ElectricAvi

  • 587 views
  • 0 comments
  • 6 respects

Covid-19 Coronavirus Doorbell

Project showcase by Roni Bandini

  • 13,333 views
  • 4 comments
  • 32 respects

Healthcare Skin Pressure Detector

Project tutorial by David Escobar

  • 10,839 views
  • 3 comments
  • 21 respects
Add projectSign up / Login