Everything for Electronics

From the Q&A

With TJ Byers

The In-N-Out Sensor


 I have a motion light for the bathroom that is set for two minutes. I would like to replace it with an infrared sensor that would come on when I walk in and off when I go out.

— Clarence Hawkins


An IR heat sensor won’t work as you plan because it will give false readings from a lingering shower, space heater, and other heat sources that remain after you’ve left the bathroom. How about an ingress/egress detector that would monitor your direction into or out of the room and control the light accordingly? All it takes is a pair of photosensors steering a logic circuit, as shown in the diagram below.

The circuit works by determining which photosensor is activated first. Let’s say the light source to Q1 is interrupted first. This causes the monostable timer (4001 gates) to start and lock the states of Q1 (HIGH) and Q2 (LOW) into the 4027 flip-flop. This causes the Q output of the flip-flop to go high and pull in the relay. It also locks out the sensors for one minute so that further movement will be ignored. When you exit, Q2 is blocked and the Q output goes low, causing the relay to drop out.

Placement of the sensors is critical. Obviously, they have to be placed horizontally, one in front of the other. And they have to be spaced far enough apart so that both aren’t darkened at the same time, yet close enough to be illuminated from a convenient light source — which can include IR LEDs, a night light, or ambient room light. The sensitivity pots adjust the trip point of the sensors. Cadmium sulfide photocells can be used in place of phototransistors Q1 and Q2.