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.





No comments:

Post a Comment