Wireless Lab

In the final lab for Fundamentals of Physical Computing, we make a wireless doorbell using a bunch of familiar parts, with the addition of an XBee radio. After a little bit of configuration and some careful wiring, there’s really nothing new to be found here. The XBee simply acts like a “wire-free” serial connection, passing anything written to serial, verbatim, to the paired radio. Many thanks to Finley for being my project partner on this, as well as the Touchstone, where we made significant use of wireless comm.

Prep work

All told, the most challenging part of the lab may have been simply getting the radio into the circuit.

Fully soldered XBee breakout board.

Fully soldered XBee breakout board.

Because the XBee uses closely-spaced pins, it can’t fit directly into the breadboard. Sparkfun sells a great breakout board to deal with just this issue, but it comes without headers and requires a lot of tiny joins. 40 in all. It’s actually not a bad way to hone those soldering skills.

Wiring

From there, hooking up the breakout boards is simply a matter of connecting VCC to 3.3v power (the XBees can’t work at 5v, and will fry at 7,) and ground, as well as DOUT to the Arduino Rx pin, and DIN to the Arduino Tx pin. This actually caused a bit of confusion in the studio, as In and Out are obviously device-relative and labeling isn’t standard.

Beyond that, hooking up the button and buzzer, or in our case, an LED, was a straightforward operation.

Programming the radios, and a cautionary tale of XBee + Arduino

The XBee radios are programable through standard AT commands. While experimenting with the radios prior to the lab, we’d attempted to use “screen” on the command line, which is something less than a pleasure. Funnel.cc’s XBeeConfigTerminal makes everything much, much easier, and we were rapidly able to pair the radios that way.

At this point, you’d think we’d be ready to drop the example code into Arduino and upload it to the board, but there’s a slight and important caveat. Because there is only one channel of serial communication on the Arduino, it’s essential that the Rx pin be unplugged from the radio, or any other potential input, prior to attempting to upload code. Otherwise, the board will enter a mode where it’s ready to be programmed, but be confused as to the source of that information. This causes the board to become out of sync with the IDE, and requires a bit of unplugging and re-plugging to get things sorted out. If you’re able to remember this, however, the whole operation goes fairly smoothly.

Simple and feedback doorbells

While the simple doorbell just triggers an alert on the board, the second bit of code sends a confirmation back, and lights an LED on the sending board. By unplugging the Rx and Tx pins, we’re able to show that the feedback really does come from the remote unit.

A demo of the operating (silent) feedback doorbell is below.

Wireless Lab Video from Jeff Kirsch on Vimeo.

Final thoughts

This simple exercise gave us most of the tools we needed to move forward with wireless communication on the Touchstone. While two boards communicating back and forth while running identical code is more difficult to achieve than a pair of boards with different code, the same fundamental lessons (especially unplugging the radios before upload) apply.

Full lab info available here.


About this entry