Introduction: Limit the Crowd to Prevent the Spread of COVID-19

About: I am interested in Arduino and looking forward to discover more.

The World Health Organization, WHO, has advised people to stay away from crowded places to protect themselves from the spread of Coronavirus disease. Even though people practice social distancing, it may not be effective when they are present in crowded places. I came up with this idea after I read the WHO guidelines about preventing the spread of COVID-19.


  • Arduino Uno
  • USB Type A/ B cable (for Arduino Uno)
  • Solderless Breadboard - Half + (You will only be needing the power rail of this breadboard)
  • IR tracking sensor module (x2)
  • Ultrasonic sensor module (x2) (HC-SR04) - You could use this if you don't have IR tracking sensor module
  • LCD display module with I2C interface - 16x2
  • SG90 Micro-servo motor
  • Male/ Female Jumper wires
  • Male/ Male Jumper wires

Step 1: Aim/ Objective

This project is an automated, cheap and effective way of limiting the crowd in public places - such as shopping malls, supermarkets, offices - and public transport vehicles, such as buses and trains.

Using a human to limit the number of people in a particular place would not be as effective as using an automatic system due to the lack of staff members in some areas.This prototype can be used in real-life situations by replacing the servo motor with a solid state relay module. The solid state relay module will control the motor operating the automatic sliding doors in buildings and vehicles. There will be a slight change in code when replacing the servo motor.

Step 2: How This Works

If a person is going to enter the building or vehicle, he/ she can wave or hover his/ her hand over the ultrasonic/ IR tracking sensor module. If an IR tracking sensor module is used, it will send a LOW signal to the Arduino Uno microcontroller and according to my program, the door will be opened.

In my model, I have used a servo motor to open/ close the door. The door will be opened when the servo motor rotates 90 degrees. If an ultrasonic sensor module is used, the door will be opened when the sensor detects an obstacle within 5 cm away from itself.The door will remain open for 5 seconds and the value stored in the count variable will increase by one after the door is closed. The count variable denotes the number of people inside a building or vehicle. If the value stored in the count variable reaches the maximum occupancy value, the LCD display module will show that no one could enter and the door will remain closed until someone leaves the building.I have attached an IR tracking sensor module on the inside of the box (modelled as the building/ vehicle) as well. The process will be the same as that mentioned above, but the difference is that the value stored in the count variable will decrease by one as a person is leaving the building.

Step 3: Schematic

IR tracking sensor module

  • S ( inside) - D5
  • S (outside) - D4
  • (+) - 5V
  • (-) - Ground (GND)

Ultrasonic sensor module (HC-SR04) - If you had used this in your project

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

16 x 2 LCD display module with an I2C interface

  • GND - Ground
  • VCC - 5V
  • SDA - A4
  • SCL - A5

Servo motor

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

Step 4: Code

If anyone has any questions regarding the codes, please feel free to comment below

Step 5: Final Look

Congratulations! You have now completed this project.

Take a look at the YouTube video above to see how this works.

If anyone has any questions or suggestions regarding this project, please feel free to comment below or send me an email at

Arduino Contest 2020

Participated in the
Arduino Contest 2020