Monday, November 2, 2009

Custom NXT IR Receiver

After building our pumpkin motion detector we wanted to build a Halloween prop to control with it. We decided to use a Lego NXT because we didn't need the prop to be permanent and we wanted to prototype it in a hurry.

The plan was to hang a giant spider from a rope that would be suspended under the eaves of the house on the front porch. When an IR command is received (from a motion detector hidden in a pumpkin) the spider would rush out from behind a web-decorated tree and advance toward the sidewalk.

We created a NXT platform that rolls along a rope by hanging from a single tank track. Two motors were required for torque because it had to move a very large spider. The motors were geared up to increase speed because we wanted it to emerge suddenly.

To allow the NXT to receive IR commands I created a custom I2C slave with a 38kHz IR receiver on it. I also included two reed switches that are used to detect magnets. By attaching magnets to the ends of the rope the NXT can detect when it has reached the end of its travel. The total cost of the sensor was fewer than $15 (including the NXT cable and enclosure).

The sensor fits nicely in a small project box and is easy to attach to the NXT by building a cage around it. I attached the magnet sensors to the project box itself so they sat directly under the rope.

An IR receiver is rather handy to have for the NXT. I decided to use the RCA IR protocol because I have several remote controls around the house (including an original XBox DVD remote) that can now be used for NXT control. In this case I am using an IR transmitter that I also built to send commands automatically.

Because the sensor still has plenty of processing power to spare it is ready to be extended to suit whatever need may arise in the future. The source code (AVRStudio4 C) is available for free under the GPL by request.





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.

Sunday, November 1, 2009

Newspaper Box Halloween Prop


My girlfriend designed this simple Lego NXT robot to startle people who came up to our doorstep. The bot uses an ultrasonic sensor (attached to the box and hidden in spider webs) to determine when someone has stepped in front of our newspaper box. It then turns on the light sensor's red LED for dramatic effect and then thrusts a large spider (attached to the bot by a chopstick) out towards the visitor. Approximately 2 out of 3 trick-or-treaters were caught off guard.

Here is a video of it in action: http://www.youtube.com/user/ph0015d4y#p/a/u/0/8ITSmziMPSs



DIY Pumpkin Light

Becca and I found these little "tap lights" at the dollar store and liked the housings (they come in various shapes including crescent moons and simple domes). We purchased this one and replaced the incandescent bulb inside with a cheap microcontroller and three LEDs. We kept the original battery compartment (4xAA) and push switch.

Becca chose white, green, and blue LEDs to match the housing. She wanted the colors to fade in and out while cycling pseudo randomly.

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

A video of it in action: http://www.youtube.com/watch?v=QhdMVfQuDV0