The integrated circuit is a 4516 up/down counter. Diode 2 determines the count direction.
The value of the resistors Rí depends on the type of diode used. (You will probably need resistors in the range 100k
to 1M.) When entering the room, the beam illuminating diode 1 must be cut first. This causes the counter to
count UP one. If (when a person leaves the room) the beam illuminating diode 2 is cut and while this beam is
still cut the beam illuminating diode 1 is cut, the counter will count down one. The output can be used
(with a relay and driver) to switch on a light when a person first enters the room and then to switch the light
off when the last person leaves the room (maximum number of people, 15).
Pins 1,3,4,5,12, and 13 of the 4516 must be connected to battery negative (see vero diagram
below). The "switch-on reset" network (R and C) can have almost any values; try 100k and