Introduction: 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't…

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 1: Part List

Parts you'll need for making this project :

1.2 x Laser-Diodes ( I've used a laser-diode from a red laser pointer - 635nm and <1mW )

2. 2 x Small LDRs

3. 2 x 10k ohm resistors

4. 1 x 7805 - 5v voltage reg.

5. Arduino ( any microcontroller would serve the purpose )

6. Heat Shrink tubing ( 4mm )

7. PerfBoard

8. 9v battries and battery connectors

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 !

Home Technology Contest

Participated in the
Home Technology Contest

Epilog Challenge VI

Participated in the
Epilog Challenge VI