Skip to main content

74. Social Distancing with automatic door control system

Hey everyone!

Today I will be explaining you about my new COVID-19 project. This project is about practicing social distancing more effectively with an automatic door control system, and will be helpful in public places such as Malls, supermarkets, railway station, ticket counters and other places where queueing is essential. The World Health Organisation, WHO, has advised people to practice social distancing (staying away from people for at least one metre) to prevent the spread of COVID-19 disease. In this project, the distance between the laser diodes are modelled as 1 m. Read on further to learn how I did this project.

Hardware components used in this project

  • Arduino Mega 2560
  • USB Type A/ B cable
  • Breadboard power supply module - 3.3V/ 5V
  • Solderless Breadboard - Full+
  • Laser diodes (x5)
  • Photoresistors/ LDR (x5)
  • Resistors (x5) - 10kΩ
  • Ultrasonic sensor module (HC-SR04)
  • IR tracking sensor module 
  • TowerPro Micro servo motor (x2) - SG90
  • LCD display module with I2C interface - 16x2
  • Male/ Male Jumper wires
  • Female/ Male Jumper wires
  • Regulated power supply
*Note: I have used the breadboard power supply module to prevent the components from drawing out voltage from the microcontroller board.

Connections

Laser Diodes

  • 01 - D25
  • 02 - D27
  • 03 - D29
  • 04 - D31
  • 05 - D33

Light Dependent Resistors

  • 01 - A0
  • 02 - A1
  • 03 - A2
  • 04 - A3
  • 05 - A4

LCD display module with I2C interface

  • GND - Ground
  • VCC - 5V
  • SDA - D20
  • SCL - D21

TowerPro Micro servo motor SG90

  • S (Barrier) - D9
  • S (Door control) - D10
  • (+) (Red wire) - 5V
  • (-) (Black/ Brown wire) - Ground (GND)

Ultrasonic sensor module (HC-SR04)

  • VCC - 5V
  • Trig - D5
  • Echo - D4
  • GND - Ground

IR tracking sensor module

  • S - D6
  • (+) - 5V
  • (-) - Ground

How this project works (Explanation of the codes)

Now, we will be looking at how this project works. You can easily deduce the codes by reading this section carefully. For this project, you will be needing the LiquidCrystal_I2C, Servo, and Wire libraries. The Servo and Wire libraries are inbuilt but the LiquidCrystal_I2C library needs to be downloaded/ installed. You can download the library from this github repo
You would also need the I2C scanner to get the I2C address of your device. You can get the codes for the I2C scanner from this Arduino site.
Create two array functions named LDR and Laser, respectively. Add the respective pin values in the arrays. Create a LiquidCrystal_I2C object interface by using the LiquidCrystal_I2C function. Name your object as lcd and the parameters will be your device's I2C address, number of columns and number of rows. Define the trig and echo pins and create two servo objects using the Servo syntax. Name one servo object as Barrier and the other as Door, as one servo motor will control the barrier on the outside and the other one will be controlling the door on the inside of the premises. When you are replicating this system in real life, you will need to replace the servo motor controlling the door with a solid state relay module. The solid state relay module will control the motors operating the automatic sliding doors.
Create a variable for your IR sensor and another variable to store the output of the sensor. Create variables named count and distance. The count variable will be used to calculate the number of people standing in the queue while the distance variable will be used to used to store the distance calculated. Create a variable named duration using the 'long' datatype.
Within void setup( ), call pinMode( ) to configure the pins stored in the Laser and Trig pin as OUTPUT. The pins stored in the  LDR array, the Echo pin and sensor should be configured as as INPUT. Use the attach ( ) function with the respective servo objects as syntax to declare that that barrier is connected to D9 and door is connected to D10. Set the initial position of the servos to 0 using the write( ) function and their respective object names as their syntax.
Within void loop ( ), create variables to store LDR values. There are different types of LDRs, so make sure to measure the values produced by each LDRs when the laser diode is shone on them and when it's not. You will need the following code to test each LDR.
Set the trig pin LOW for 5 microseconds before setting it HIGH. Set it LOW after 10 microseconds. Calculate the duration using the pulseIn function and store the value in the 'duration' variable. The pulseIn function will calculate the time taken for the ultrasonic pulse emitted by the trig pin to reach the echo pin. The echo pin will be HIGH when it receives the ultrasonic pulse. To learn about how the ultrasonic sensor module works, please visit this website
Divide the duration by 2 and multiply it by the standard speed of sound in air. Divide the result by 10,000 to calculate the distance in cm. Store this value in distance variable. If the distance ( from the ultrasonic sensor module) is within 0 and 10 cm, the value stored in the count variable must increase by 1, and the servo motor must turn 100 degrees before turning back to 0 after 5 seconds. If value stored in the count variable is 5, then the servo motor must not turn and there should be no change in the count variable. 
The IR tracking sensor sends a LOW signal to the microcontroller if an object is detected within 2 cm away from the IR sensors. So, the output value of the IR tracking sensor is LOW, the value stored in the count variable must decrease by 1 and the servo motor must turn 70 degrees. The servo motor will be connected to the door in such a way that if the servo motor rotates, the door will be pulled open. After 5 seconds, the door must be closed again.
The LCD display module must display the number of people standing in the queue and the slots which are occupied. For example, if the number of people standing in the queue is 1 and no slots are occupied, then it means that the person is not standing in the correct position and therefore not following the social distancing rules properly. 
Watch the YouTube video in the last section of this page to understand how this project works. The laser diode beam will fall right on the photoresistor surface. The person has to stand in the correct position and block the beam. If the light is no longer shown on the LDR surface, then the LCD display module must show that slot 1 is occupied. Id the person moves away from this position, the light will be shone on the surface again and the slot will no longer be occupied. 

Final Look

If anyone has any questions or suggestions about this project, please feel free to comment below or send me an email at arduinoprojectsbyr@gmail.com. Please do not send me any email requesting the full codes.

Comments

Popular posts from this blog

51. Buzz wire game using Arduino

Hello everyone! This is my first Arduino project in 2020 and it is going to be a fun and simple project. You would have heard of the Buzz Wire, a steady hand game, and today you will be learning to make one using Arduino. Hardware components used in this project Arduino Nano USB Type A to mini B cable (for Arduino Nano) Solderless Breadboard - Mini and Full-size LEDs (x2) - Green and Red Resistors (x2) - 220 Ω  Active Buzzer module (KY-012) LCD display module with I2C interface - 16x2 Male-to-Male Jumper wires (x4) - 10cm Female-to-Male Jumper wires (x5) - 20 cm Jumpers (x5) - to reduce the usage of wires Copper wire  Tape (or any form of insulation)  Setup Your hardware setup must look somewhat similar to the ones in the images above. The beginning and end of the copper wire maze must be taped to prevent conductivity between the wire loop and maze. Connections LCD display module with I2C interface GND - Ground VCC - 5V SDA - A4 SCL - A5

71. Buzz Wire Game ( Version 2.0 ) using Arduino

Hey Everyone! I hope that everyone's safe during this pandemic. Today I am going to explain you about the second version of my Buzz wire game. People who are bored of staying indoors can find this game pretty interesting and fun to play.  If you are a beginner, you can start off with my first version of this project :  51. Buzz wire game using Arduino   Hardware components used in this project Arduino Uno Solderless Breadboard (x2) - Full/ Full+ LCD display module with I2C module - 16x2 Potentiometer - B20K Push-buttons (x3) Resistor - 220 Ω Active Buzzer module (KY-012) LED - Red Copper Wire - 19/ 20 gauge thick Male-to-Male Jumper wires - 10cm and 20cm Wire - Long enough to connect the loop of copper wire to ground Other tools required for this project Cutting pliers - To cut the right amount of copper wire Round-nose pliers - To bend the copper wire and make a maze and loop Hardware setup Connections Wire Maze - D2 Wire loop - Ground (GND) B20K Potentiometer S - A0 (+) - 5V (-)

86. RFID Health tag (Arduino and Python)

 Hey everyone, Sorry I have not uploaded in a while. Today, I will be sharing an interesting project with all of you. This RFID Health tag project is useful when it comes to keeping track of vaccinated individuals, their biodata and their health conditions and medications. For this project, you will be needing Arduino and Python. Read on further to see how I did this project. Hardware components used in this project Arduino Uno Solderless Breadboard - Half+ MRFC522 RFID reader RFID key tags (x5) Push-buttons (x2) Male-to-Male Jumper wires (x12) USB Type A/ B cable (for Arduino Uno) Software required Arduino IDE - latest version recommended Python 3.8 Schematic MFRC522 RFID reader SDA/ SS - D10 SCK - D13 MOSI - D11 MISO - D12 IRQ - Not connected GND - Ground RST/ RESET - D9 3.3V - 3.3V Push-buttons Submit button - D4 Retrieve button - D5 Coding Arduino For this project, you will be using the following libraries: MFRC522 by miguelbalboa -  https://github.com/miguelbalboa/rfid SPI - In-bu