Sunday, September 23, 2007

Wireless LED Glow

I can make an LED glow wirelessly!

xbee_glow
Originally uploaded by 0x000000


okay, here's what it involves: 2 XBee radios, 2 microcontrollers (I used arduino minis), 2 power sources, 2 variable resistors, and a couple LEDS to control (i'll call these analogue LEDs from here on out). I tried to keep my wires on my board tidy, as wires generate their own radio waves which can create interference with the radio signals your xbees are trying to send out. I didn't do the absolute best job with the tx/rx wires, but it didn't seem to cause any transmission problems, so I let it slide.

Basically, this exercise controls the brightness of an LED on one board (the analogue LED), from another board, via values generated from a potentiometer and sent out wirelessly through an xbee radio. So we go pot 1 --> microcontroller1 --> xbee 1 --> xbee2 --> microcontroller 2 --> analogue LED 2. And this of course, works going the other way as well. Each board can control the brightness of the other's analogue LEDs.

One little pitfall that derailed me for a moment, was having the analogue LED on an analog i/o pin vs a digital i/o PWM pin. While it was tied to an analog i/o pin, i wasn't able to turn it on at all. Make sure the analogue LED is on a digital i/o PWM pin, which you then analogWrite to in order to get it to glow.

No comments: