Arduino Based Social Distancing Cap | Electronics Project | Best Electronics Projects

0
478

Hey, freaks, here we came with another awesome Arduino project based on Arduino, A Alarm Cap for Social Distancing this project is meant for the Covid-19 Pandemic. We all know, in this pandemic social distancing is important to avoid the spread of Covid-19. But maintaining physical distancing is not always possible, especially when we go out, due to our daily works we forget about social distance.

Social distancing cap
Arduino based Social Distancing Alarm Cap

This Arduino-based social distancing cap alerts you when someone comes close to you or you come too close. Either from left/right or front/back. The four ultrasonic sensors connected to Arduino Uno fitted with the cap senses the minimum distance & immediately alerts you with a buzzer.

Working of Arduino based Social Distancing Cap

Circuit Diagram :

This circuit includes a Arduino Uno, 4 Ultrasonic sensors (HC-SR04) and few other components. The circuit diagram is shown in figure below-

arduino social distancing
Circuit Diagram

The ultrasonic sensor (HC-SR04) determines the distance from an object. This sensor offers an excellent range of detection with high accuracy & stable readings without any physical contact. The range of HC-SR04 is between 2cm to 400cm and has an accuracy of 5mm. The HC-SR04 sensor module consists of three parts – An ultrasonic transmitter, receiver, and a Control Circuit. The HC-SR04 ultrasonic sensor has four pins given below –

Buy HC-SR04 Sensor from Amazon : Click here

  1. VCC: +5V DC
  2. Trig: Trigger (Input)
  3. Echo: Output
  4. GND: Ground

The HC-SR04 Ultrasonic Sensor is easy. When the HC-SR04 sensor is triggered (a small 10µs pulse from the Arduino Uno board triggered to the trigger input pin), the transmitter sends a sound signal at a high-frequency of 40kHz. Then the receiver picked the transmitted signal reflects back from the nearby object.

The output of the Ultrasonic sensor HC-SR04 (echo-pin 3) is a pulse, where the distance of the object is proportional to the width of that pulse. To calculate the width of the pulse, we use the pulseIn( ) function in the code. The Arduino program code calculates the distance of all four directions of the objects.

Here, we place four HC-SR04 ultrasonic sensors in four directions and connect the sensors to the Arduino Uno board. Each of the HC-SR04 sensors in all four directions collects the distance of the object and then compares the distances with the safe value of distance defined in the code. Whenever the person gets too close to another in any of the four directions, an alert (alarm sound) is produced.

Pin connections of Arduino & sensors :

Pin connections
Components QuantityBuy from Amazon
Arduino Uno Board1Buy Now
HC-SR04 Ultrasonic Sensor4Buy Now
9V PP3 Battery1Buy Now
DC Jack1Buy Now
Buzzer1Buy Now
Cap1Buy Now
Jumper Wires1Buy Now

Software Used in Social Distancing Cap :

The social distancing cap operations through the software code loaded into the memory of the Arduino board. The software program code is very simple & easily understandable.

In the starting of code, the pin numbers are defined. Trigger & echo pins are needed to connect with Arduino for each sensor. So, there are total eight pins that are needed to connect with the Arduino Uno board. For alert or alarm, a buzzer is used, so we also need to define the buzzer pin in the code. Only two variables are required for each HC-SR04 sensor: the distance to be calculated from the pulse duration, and the duration received from the ultrasonic sensor.

  • Set the input and output pins of the buzzer and the four HC-SR04 sensors.
  • For monitoring, the working of the four HC-SR04 sensors set the serial communication.
  • In the loop, start initializing the trigger pin of the sensor to the high state for 10 microseconds, and then using PulseIn( ) function read the output and calculate the distance.
  • The initialization of all four sensors is similar.
  • The distance1, distance2, distance3, and distance4 are the four variables to mark the distance from all four directions. Perform logical ‘or’ operation.
  • Use an ‘if’ statement to compare the received distance with the safe distance and if the distance crosses the threshold limit i.e. greater than safe distance then turn on the buzzer.

Assembling and Testing of Social Distancing Cap :

Before assembling the components, make sure to upload the software program code (social_distancing_cap.ino) to the Arduino Uno board using Arduino IDE.

All the four ultrasonic HC-SR04 sensors connected with Arduino Uno must kept on the cap in all four directions. A 9V PP3 battery is connected to power the circuit to the Arduino board through its DC jack.

The safe distance of 30cm is used in the code for testing, it can be changed according the need. To check the distance from all four sensors the serial monitor utility in Arduino IDE can be used. Remove the USB cable after verifying the working of sensors on the serial monitor.

To reduce the size of the circuit, use small module of ultrasonic sensor and Arduino Nano.

For more ece projects visit our website daily, and don’t forget to join our social media groups for latest jobs & internships updates.

Source Code: Click Here

LEAVE A REPLY

Please enter your comment!
Please enter your name here