Wireless Communication with XBee Radios
This chapter covered the following concepts:
- There are a wide range of available XBee models.
- You must convert between 5V and 3.3V logic levels to use an XBee with most Arduinos.
- You can configure XBee using either X-CTU on Windows, or the terminal on Linux and Mac.
- There are a variety of options for powering your Arduino that do not require you to stay connected to your computer via USB.
- You can communicate wirelessly between your computer and an Arduino using XBees.
- You can communicate wirelessly between two Arduinos using XBees.
- The millis() function can be used with state variables to create “nonblocking”
code that implements time delays.
- Arduinos (x2) (Uno and Leonardo, or two of either)
- USB Cables (x2) (B for Uno, Micro B for Leonardo)
- Power Supplies (x2) (9V/holder, USB Power Adapter, or AC/DC Adapter)
- SparkFun USB XBee Explorer
- XBee Series 1 Radios (x2)
- XBee Shields (x2)
- Piezo Buzzer
- Common Cathode RGB LED
- 10kΩ Resistor
- 10kΩ Potentiometer
- 150Ω Resistor
- 220Ω Resistors (x3)
- Jumper Wires
- Breadboards (x2)
- In figure 11-18, the wiring diagram does not show the XBee shield mounted on the Arduino. The correct version is shown in the following colored wiring diagram.
Color Wiring Diagrams
Follow along with this XBee video tutorial:
Watch a demo of the wireless doorbell created in the chapter:
All code is licensed via the GNU GPL v3. Code is maintained and updated on GitHub. The download zip linked above always contains the most recent version of the code examples that have been pushed to the GitHub Code Repository.
Taking it Further
Without wires holding you back, the possibilities are limitless! Here are some project suggestions that you can now complete:
- Build the SudoGlove control system.
- Build a wireless multimedia remote for your computer by using Leonardo keyboard emulation on a receiving Arduino.
- Build a remote-controlled car.
- Build a remote weather station and monitor it from your computer or from another Arduino with data displayed on an LCD.
References & Credits
- Figure 11-2: XBee Radio Photo Credit: SparkFun (Photographer Juan Peña), www.sparkfun.com (source)
- Figure 11-3: XBee Datasheet Excerpt Credit: Digi International, Inc., www.digi.com (source, PDF)
- Figure 11-4: XBee Shields Credit: Arduino, www.arduino.cc, SparkFun (Photographer Juan Peña), www.sparkfun.com, Cooking Hacks, www.cooking-hacks.com (source 1, source 2, source 3)
- Figure 11-6: SparkFun USB XBee Explorer Photo Credit: SparkFun (Photographer Juan Peña), www.sparkfun.com (source)
- Figure 11-13: Adafruit USB Wall Adapter Photo Credit: Adafruit Industries, www.adafruit.com (source)
- Figure 11-14: Adafruit Barrel Jack 9V Adapter Photo Credit: Adafruit Industries, www.adafruit.com (source)
- Figure 11-15: Center-Positive DC Symbol: Credit Public Domain from Wikipedia (source)