Secondary Menu

Arduino-DIY Laser / IR Person Counter

About: Greetings ! I'm Tanay, a hobbyist interested in making robots and sharing stuff. I hope that my instructables help you in solving your problems Happy Tinkering ! Note : Sorry for the inconvenience but I won...
More About electro18 »

A Bi-Directional person / object counter is a device which can be used to monitor the number of objects entering / exiting through it. It has a wide range of applications including automatic parking slots monitoring , number of people entering / exiting a mall , number of students in a class , et cetera.

It has two variants :

1. Laser diode and LDR combination

2. IR led and photodiode combination

The laserdiode-LDR version can be used where the distance between the source ( laserdiode ) and the sensor ( LDR ) is large whereas the IR-PhotoDiode can only be used for short distances and is comparatively less accurate.

Step 2: Schematics

Circuit # 1 :

Two LDRs are connected to the A0 and A1 analog pins of arduino . One leg of the LDR is grounded and the other end is connected to +5v through a 10k ohm pull-up resistor. The Junction of the LDR's leg and the resistor is connected to the analog pin.

When the resistance of the LDR goes below 10k ohm , the analog pin reads 0 v and if it goes above 10k ohm , the analog values will be displayed accordingly.

Circuit # 2 :

This circuit just converts 9v to 5v using 7805 voltage regulator to drive the Laser Diodes. A 10k ohm pot is added to protect the Laser Diodes. Two laser diodes are connected in parallel to the power source.

Display Circuit :

If you don't want to use the serial monitor to display the counter values then you can add 2 x seven segment displays to the arduino's digital pins as shown ( you can also use a multiplexer if you want ).

Step 3: Layout and Working

There're two parts of the counter :

1. Laser source

2. Sensor plate

Layout

The two laser diodes are connected in parallel to a +5v regulated power source. On the other side , two LDRs are connected to arduino . They are placed such that both the laser beams fall directly on the LDRs.

A 2 x 7 segment display is connected to the arduino to display ( total no. of objects entering - total no. of objects leaving ). This can also be done by using the Arduino serial monitor.

WORKING :

In normal position , the beams fall directly on the LDRs and hence the resistance of the LDRs drops down drastically . As the resistance goes below 10k Ohm , the analog pin will read a lower analog value. When an object enters , the first beam ( beam A ) breaks before second beam ( beam B ) , the counter will increase by 1 . As beam B breaks before beam A , the counter will decrease by 1.

Step 4: Programming Part

There are two programs in the Archive

1. For Serial monitor

2. For 7-segment display

INSTRUCTIONS :

Download the archive and choose your program ,

Upload it to your arduino and open the serial monitor to check the value of both the sensors in normal and breached positions and set the threshold accordingly.

After you've checked the counter and calibrated the sensors , you can now attach your LCD / seven-seg display.

HOW DOES THE PROGRAM WORK ?

The program reads the sensor values and compares them with the threshold value , in normal state the counter will be constant. As one of the beam breaks , the counter is increased or decreased by 1 . The program also calculates the time for which the object stays between the source and the sensors and suspends the program for that time duration to avoid false readings.

ANY QUERIES ?

Feel free to ask questions and if you like my ible , please vote for me !

Hiya, ive made the entire circuit, ive made the seven segment display version. But im having problems with the programming. Random segments on the seven segment displays show up, and they don't change :( HELP

I was curious if you would be willing to make a couple of these for me? I am trying to figure out a way to monitor the number of people that pass in front of my table at a conference. There are a couple of modifications, but we can talk more about that if you are interested. Shoot me an email at olsonb2@gmail.com.

how to define when first time sensor output on then then off after 5 sec..

i made project when counter = 2 then do condition & counter = 3 then other condition.but problem is i want to check how many time my hand in front of ir sensor within 10 second ..also problem is when counter =3 when ir detect 3 motion but before that counter =2 condition is satisfy then this loop run after then counter = 3 condition run...how to solve ...please help ...any expert

will this system work without using a photodiode? we can just use the IR sensors for the detection. if sensor A gets notified first, increment the counter. if sensor B gets notified first then decrement. is that possible?

I need a bit more specific information about the problem that you're encountering. Did the 7 segment fry up ? and did you check the connections properly ? Try using a DMM and figure out whether it is a common anode or common cathode.

I have a confussion, if some one cuts the first beam but don't cut the second beam, then returns again cutting the 1st beam, then the counter will be increased or decreased by 2,, how you have solved this problem??