Model For Crowd Management System Using Arduino


This Simple Project explains how to build a model for Crowd Control System using Arduino.

When using a service or specific facilities, the proper crowd control is very important.
 (eg : Waiting for a Interview in the waiting area , Waiting in a queue)

This system uses ultrasonic sensors to detect people who get in and out to an area (eg : an office room).

To understand this project easily, Lets Consider multiple candidates whom are being interviewed at a Office room.(3 Candidates are interviewed at a time).

Ultrasonic Sensor -02 detects the person in front of the entrance (IN Door) and starts to count the no of people who are entering .(one person will count as 1).The door will automatically open by an servo motor.

After entering through the IN door, the person is detected by Ultrasonic sensor -01 and the door will be closed (This Procedure also prevent the person from exiting through the IN door)

When leaving the room, the Ultrasonic Sensor -03 will detect the person and starts to count people who are exiting. (one person will count as 1). The door will automatically open by second servo motor.
 
After exiting through OUT door, the person is detected by Ultrasonic sensor -04 and the door will be closed (This Procedure also prevent the person from entering to the area through the OUT door).

Subtraction between the counted people who are entered and exited are taken in to the calculation.
This way the total number of persons inside the area(Office room) can be obtained.

Total number of persons inside the area is displayed via LCD module.

If the total number of persons inside are equals to 3, the entrance (IN door) will be closed. System will operate in normal condition(as described above) when the total number of people inside the area is less than 3.

In case of emergency, the buzzer which is located inside the area can be rung by a push button located outside of the entrance(IN door). Then the Person conducting the interview can manually open the door using the push button inside the area(Office room). 

To exclude the interviewers from the count, the counter has to be reset by pressing the reset push button, after the interviewers are entered into the Office room.

Tools & Components

1 X Arduino Nano

2 X Servo Motor(Metal Gear)

4 X Ultrasonic Sensor(HC-SR04)

3 X Push Button

1 X Buzzer

1 X 10K Ohm Potentiometer

5VDC 3A Power Supply

Connecting Wires

Suitable mechanical lever arrangement for door(open/close)

Connecting Components



Sensor Arrangement


Ultrasonic Sensor 01  Trig. Pin - Arduino Pin D4

Ultrasonic Sensor 01  Echo Pin - Arduino Pin D2

Ultrasonic Sensor 02  Trig. Pin - Arduino Pin D6

Ultrasonic Sensor 02  Echo Pin - Arduino Pin D5

Ultrasonic Sensor 03  Trig. Pin - Arduino Pin D12

Ultrasonic Sensor 03  Echo Pin - Arduino Pin D13

Ultrasonic Sensor 04  Trig. Pin - Arduino Pin D10

Ultrasonic Sensor 04  Echo Pin - Arduino Pin D11


LCD Module D7       - Arduino Pin A5

LCD Module D6       - Arduino Pin A4

LCD Module D5       - Arduino Pin A3

LCD Module D4       - Arduino Pin A2

LCD Module E         - Arduino Pin A1

LCD Module RS       - Arduino Pin A0

LCD Module Vcc       - +5V

LCD Module Vss       -  GND

LCD Module LED(-)  -  GND

LCD Module LED(+) - +5V

LCD Module VEE      - Potentiometer Sig. Pin


Push Button (Reset Counter)                 - Arduino Pin Reset

Push Button (Manual Open Switch)      - Arduino Pin D11

Push Button (Buzzer)                             - Buzzer(+)


Servo Motor 01 (IN Door)                     - Arduino Pin D3

Servo Motor 02 (OUT Door)                 - Arduino Pin D9

Arduino Code


//2020 www.Craftybin.blogspot.com
// Author : Chathura H.®

#include <Servo.h>
Servo myservo1;
Servo myservo2;

#include <LiquidCrystal.h>
LiquidCrystal lcd(A0, A1, A2, A3, A4, A5);

#include <HCSR04.h>
UltraSonicDistanceSensor distanceSensor1(4, 2);
UltraSonicDistanceSensor distanceSensor2(6, 5);
UltraSonicDistanceSensor distanceSensor3(12, 13);
UltraSonicDistanceSensor distanceSensor4(10, 11);

int count1 = 0;
int count2 = 0;

void setup () {
    myservo1.attach(3);
    myservo2.attach(9);
    Serial.begin(9600);
    lcd.begin(16, 2);
    Serial.print("Please Wait...");
}

void loop () {
  int manualopen = analogRead(A6);
 
  lcd.print("Please Wait... ");
  delay(500);
  lcd.clear();
  delay(1);

  if (distanceSensor2.measureDistanceCm() <= 20 || manualopen >= 200)
  {
  count1 = count1 + 1;
  myservo1.write(90);
  delay(500);
  myservo1.write(0); 
  }
 
  else if (distanceSensor3.measureDistanceCm() <= 20)
  {
  count2 = count2 + 1;
  delay(100);
  myservo2.write(90);
  delay(500);
  myservo2.write(0);
  }

  else if ((distanceSensor1.measureDistanceCm() <= 20 && distanceSensor2.measureDistanceCm() > 20) || (count1 - count2) >= 3 )
  {
  myservo1.write(0);
  }

  else if (distanceSensor4.measureDistanceCm() <= 20 && distanceSensor3.measureDistanceCm() > 20)
  {
  myservo2.write(0);
  }

  lcd.print("Crowd Counter = ");
  lcd.print(count1 - count2);
  delay(500);
  lcd.clear();
  delay(1);
  Serial.print("INCOMING = ");
  Serial.println(count1);
  Serial.print("OUTGOING = ");
  Serial.println(count2);
  Serial.print("Crowd = ");
  Serial.println(count1 - count2);
  Serial.println("");

Safety First !
Always Connect the power supply if you are absolutely sure that the components are connected correctly without changing polarity and short circuited the wiring.
Even if it seems nothing is wrong : DOUBLE CHECK EVERYTHING !!
Your Feedback is very important to us. 
Please Leave a comment about how you feel about this project.

Post a Comment

Previous Post Next Post