IR LED and phototransistor beam counter


I am designing lecture room control device for a 3rd year design project with which I need to count the number of people in the room by using 2 parallel IR beams at the door. The Leds and receivers are set to be 0.8m apart. The setup of my circuit is below.

I need help finding the resistor values for the led and transistors and if i need to angle the led or transistor in a certain way.


You will need to check the datasheet for that IR LED, but these ones have a Vf of 1.5V and a Ifmax of 50mA.

Using a calculator like this one you arrive at 80R if you go for that maximum current. You may need that maximum if the LED is quite a distance from the receiver.

Instead of that external pullup on the receiver, it’s waaaaaaay easier to use the built-in one via:

pinMode(x, INPUT_PULLUP); // where x is the number of the pin

But you might like to read here about the possible effects of ambient light and go for a modulated beam instead. That writer found they are less susceptible to ambient.


The problem is we cant use programmed chips and microcontrollers.

So you are saying use a 80ohm resistor for R1?

So you are saying use a 80ohm resistor for R1?

No I did not say that… Consult the datasheet for your LED and calculate the resistor required based on Vf and Ifmax

As a matter of interest how are you going to count without a microcontroller?

Supplementary question: if you're not using a micro, why are you posting here in a micro forum?