Hacking a Cheap PIR Motion Sensor
by Pete McCollum
I recently found that some inexpensive IR "Security Lights" can be easily interfaced to small microcontrollers. The problem with some models is that they operate on voltages that are not commonly found in small microcontrollers. Also, the one or two chips found on the PC board are often marked with proprietary numbers, so it's difficult to understand how it works.
During a recent trip to Wal-Mart, I bought a Regent model MS20 "Motion Activated Security Light" for only $9. It is the cheapest model I have seen, and it is easy to modify for microcontroller use. It has no sensitivity control, and it has a slide switch to select the time-delay when the light turns on. In the "test" mode setting, the unit stays on for about 4 seconds, and it ignores the presence or absence of daylight (in the normal mode, it only turns on when it is dark).
Opening the case, you will find a single PC board about 2" square. It includes the PIR (Pyroelectric Infra Red) sensor, a CdS photocell, a relay, miscellaneous small components, and an industry-standard LM324 quad op-amp. The circuit is intended to be connected directly to the 115 VAC line, so it has some simple circuitry to convert the high-voltage AC down to low-voltage DC. The circuit needs two DC voltages: 24 volts to operate the relay and some of the electronics, and about 5 volts for the remainder. If the relay is eliminated from the circuit, it turns out that the remainder will work just fine on 5 volts only.
I made the following changes:
The output is active-low, so can be easily connected to a microcontroller's interrupt line. Since the output will stay low for about 4 seconds, you might want to connect it to an edge-sensitive input, rather than a level-sensitive input. Or, by further modifying the circuit, it should be possible to reduce the 4 second delay to a shorter interval. The PIR sensor is in a round transistor-style case, so it's field of view can be reduced by mounting a tubular "blinder" on it. For a wider field of view, use the plastic Fresnel lens that is part of the original plastic case.
I've only just begun experimenting with the modified sensor, but it will clearly be a cheap and simple way to add another type of sensing to my current robot project.