Monday, November 2, 2009

Motion Activated IR Transmitter


This Halloween my girlfriend and I wanted to experiment with motion-activated decorations. We decided to make a device that is small enough to fit into a pumpkin and can perform the following functions: A) act as a decorative pumpkin light, B) contain a passive infrared (PIR) motion sensor, and C) use an infrared transmitter to control other props.

We chose to use a PIR motion sensor because they are cheap ($5-$10) and readily available (including most RadioShacks). We chose to use an IR transmitter because the components are cheap (<$5 for an IR LED and 38kHz receiver pair) and we didn't want to have wires strung around the yard. We used a really cheap strobe light from Target ($2) as the main housing. After removing all of the existing electronics we replaced the cheap LEDs in the reflector with one IR LED and mounted a 2"x2" breadboard inside on standoffs. We snaked an RGB LED out of the back of the housing on a harness composed of 22gauge solid wire so it was bendable and positionable. Then we put a 1/8" stereo jack on the back panel of the housing so the PIR sensor module would be removable.

The PIR sensor itself was bolted inside a small disposable tupperware container so it could be concealed anywhere within 6' of the main pumpkin itself (for example in a smaller adjacent pumpkin or just in the bushes). We used a regular 1/8" stereo cable for the harness because the PIR sensor only requires 3 wires.

I used a cheap ($1.40) AVR microcontroller to control everything. When the sensor is idle the LED flickers green and blue and behaves like a normal pumpkin light. When the motion sensor is tripped the pumpkin sends a command using the RCA protocol (the same as the original XBox DVD remote) and then flickers red for 3 minutes before resetting.

The code (AVRStudio4 C) compiles to less than 1KB and is available under the GPL by request.

No comments:

Post a Comment