Industrial manufacturing
Industrial Internet of Things | Industrial materials | Equipment Maintenance and Repair | Industrial programming |
home  MfgRobots >> Industrial manufacturing >  >> Manufacturing Technology >> Manufacturing process

Arduino-Based Social Distancing Reminder System for COVID-19

Components and supplies

Arduino-Based Social Distancing Reminder System for COVID-19
Arduino UNO
Arduino Nano works better for this, but I have used an Arduino UNO.
×1
Arduino-Based Social Distancing Reminder System for COVID-19
Arduino Proto Shield
I used it, but it's optional.
×1
Adafruit Mini Breadboard
×1
Elegoo 16 x 2 LCD Display
×1
Arduino-Based Social Distancing Reminder System for COVID-19
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
Arduino-Based Social Distancing Reminder System for COVID-19
Resistor 10k ohm
×1
Arduino-Based Social Distancing Reminder System for COVID-19
Buzzer
×1
Arduino-Based Social Distancing Reminder System for COVID-19
Rotary potentiometer (generic)
This is to adjust the contrast of the LCD.
×1
Arduino-Based Social Distancing Reminder System for COVID-19
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

Arduino-Based Social Distancing Reminder System for COVID-19
Arduino IDE

About this project

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.

Arduino-Based Social Distancing Reminder System for COVID-19
Arduino-Based Social Distancing Reminder System for COVID-19
Arduino-Based Social Distancing Reminder System for COVID-19
Arduino-Based Social Distancing Reminder System for COVID-19
Arduino-Based Social Distancing Reminder System for COVID-19
Arduino-Based Social Distancing Reminder System for COVID-19

The touch sensor is used to switch between the modes.

Arduino-Based Social Distancing Reminder System for COVID-19

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.

Arduino-Based Social Distancing Reminder System for COVID-19
Arduino-Based Social Distancing Reminder System for COVID-19

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

Code

  • The 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);
}
arduino-lib-hc-sr04-master.zip
https://github.com/Martinsos/arduino-lib-hc-sr04
LiquidCrystal.zip
https://github.com/arduino-libraries/LiquidCrystal

Schematics

coronavirus_distancing_WQxTcxgmYm.fzzArduino-Based Social Distancing Reminder System for COVID-19

Manufacturing process

  1. Arduino Uno WiFi Web Server: Toggle an LED via Browser
  2. Build a Basic Calculator with Arduino UNO – Easy Project
  3. Build a Portable Persistence of Vision Display with Arduino UNO and ATtiny85
  4. Smartphone-Based Temperature Monitoring System with Arduino and Bluetooth
  5. Arduino Laser Tripwire Project: Build a Simple Intrusion Detector
  6. Gesture‑Controlled Robot Project: Build Your Own Motion‑Sensing Bot
  7. Arduino UNO Guitar Pedal: DIY, Open‑Source, Beginner‑Friendly
  8. Build a Realistic Traffic Light Simulator with Arduino UNO
  9. Bluetooth‑Controlled Car: DIY Arduino Remote Vehicle
  10. Efficiently Program ATtiny85 Using Arduino Uno: A Cost‑Effective Multi‑Sensor Solution