Person counting is a method to count how many persons are comes in the range of sensor and count it. This is possible through embedded system software. This method is useful in museums, stadiums, etc. places so that they can count daily visitors and make a perfect record of it.
Used elements for this project :-
1 Arduino board
1 LCD 16Ć2
1 Ultrasonic distance sensor
Cables
In this we are provide a 5V power supply through 1 cable for showing a output on screen. 2 cables are going in ground and others are connected with digital pins. Here, we use ultrasonic distance sensor for detecting a distance. It will detect sensor from object to sensor. It has 4 cables connected one is for 5V power supply, one is connected in ground and other 2 cables are connected in digital pins. This is all about connections with Arduino board.
#include
LiquidCrystal lcd(11, 10, 5, 4, 3, 2);
int trig = 7;
int echo = 8;
int count = 0;
long duration;
long distance;
int esc = 0;
void setup()
{
lcd.begin(16,2);
pinMode(trig, OUTPUT);
pinMode(echo, INPUT);
}
void loop()
{
digitalWrite(trig, LOW);
delayMicroseconds(5);
digitalWrite(trig, HIGH);
delayMicroseconds(15);
digitalWrite(trig, LOW);
duration = pulseIn(echo, HIGH);
distance= duration*0.034/2;
if (distance < 300 && esc == 0)
{
count = count + 1;
esc = 1;
}
if(distance > 300)
{
esc = 0;
}
lcd.setCursor(0,0);
lcd.print("Count: ");
lcd.print(count);
delay(2500);
}
Sign in to your account