Count Door Entries with Your Own Digital IR Counter

By Robin Mitchell


Counting how many people walk through a door or how many times an object has passed a point can be a very important circuit. In this DIY Hacking project, we will build an object counter that uses an IR beam which when broken, increments a counter.



Required Materials


IR Counter Schematic

You can find a full sized schematic here

How Does it Work?

The IR counter starts with the IR LED D2 which emits a beam of IR light. This beam is aimed onto the IR photodiode which in turn increases the conductivity of the IR diode. Therefore, when the beam hits the IR photodiode in this circuit, the voltage across R2 increases. When the beam is cut, this voltage drops as the conductivity of the IR photodiode decreases. The potentiometer RV1 is set so that when the beam is un-cut, the output of the op-amp IC1 is on and when the beam is cut (i.e. blocked) the output of IC1 is off.

This output is then connected to the 4040 CMOS ripple counter which counts on the falling edge on the input clock signal. Therefore, when the beam is cut, the counter increments by one. The reset input on the 4040 is connected to a tactile switch and pull down resistor such that when the button is pressed, the reset pin is connected to 5V and therefore resets the current count value.

The last part of the circuit is connected to a 7-segment display which outputs the current count value. The IC that converts the binary value to hexadecimal is the HSEG1000, a segment driver IC that can drive up to two segments and output an 8-bit hexadecimal value. The HSEG1000 is used because most (if not all) 7 segment drivers do not output hexadecimal and when value above 9 are placed on the input, the output remains blanks. The HSEG1000, however, displays the letters A – F for values above 9. The HSEG1000 can be found here ( The HSEG1000 IC in this circuit is configured in transparent mode by connecting MODE to 5V, WR to 5V, and the RESET input to 5V.




The IR counter shown here is constructed on a custom PCB made on a CNC milling machine (g-code files are attached in the project zip file). Of course, all parts (including the HSEG1000) are in through hole form which means this circuit could also be built on stripboard or solderless breadboard. While the IR diodes shown here are mounted on the PCB itself, they can be placed on a doorway or door with wires connecting to the main circuit to record beam cuts. The trick to getting a reliable count is via the potentiometer RV1. This potentiometer will need to be carefully configured so that the high and low values from the IR photodiode cross the voltage value generated from RV1.



Recommended Posts

Leave a Comment

81 − = 76

Start typing and press Enter to search