Skip to content

XBee Radios

Connor Novak edited this page Sep 17, 2019 · 10 revisions

Overview

XBee radios are a (relatively) easy way to communicate with your Arduino wirelessly in the same manner that you would through the Serial Monitor. Here's a quick explanation of XBee radios, taken from SparkFun's Xbee Buying Guide (link):

"According to Digi “XBee modules are embedded solutions providing wireless end-point connectivity to devices. These modules use the IEEE 802.15.4 networking protocol for fast point-to-multipoint or peer-to-peer networking. They are designed for high-throughput applications requiring low latency and predictable communication timing.“ So basically XBee is Digi’s own Zigbee based protocol. In layman’s term they are wicked cool, and fairly easy to use wireless modules."

XBees can be used in various configurations with Arduinos. A typical setup is one XBee[5] connected with an XBee shield[4] to an Arduino Uno for the rover side, and an XBee USB Explorer connected to another XBee.

Basic Setup:

Goal: Send commands from your computer through an XBee connected to an explorer board. The Computer-side XBee will send commands to an XBee attached to the shield on your Arduino and allow you to toggle the onboard LED. To do that, first set up the computer side of the link, then the Arduino side of the link.

Computer Side:

XCTU software has multiple functions. It's primary function is to allow you to change settings on your XBee radios and update their firmware. These steps are how you ensure that your radios talk to each other and not other radios. The software also acts as a Serial Monitor that tells you what is happening on the

  1. Download XCTU Software for Linux from Digi's Install XCTU - Linux page (link). These instructions will place the 40002881_T.run file in your Downloads folder.

  2. Navigate to your Downloads folder via Terminal cd ~/Downloads and mark the file as executable with command chmod u+x 40002881_T.run`.

  3. Run executable with command ./40002881_T.run (Note: This might throw an error, continue on to the next step anyway). Running this file will start the XCTU installation.

  4. Upon reaching the window that asks you for the install location, choose a location.

  • If this location has special permissions (ex. installing in /opt), you will need to do a bit more configuring (see next step).
  1. Finish the installation (You can delete the .run file now if you wish). If you installed into a special permissions folder, follow these directions:

  2. Open application through Desktop with command sudo ./XCTU.desktop while in your install location

  • Note: If this does not work for you, cd to /opt/Digi and try running the open application command there
  1. Follow Sparkfun's Exploring XBees and XCTU Tutorial to set up the XBee network (link).
  • When discovering XBee radio, if XCTU says to reset the radio, short pins 10 and 5 on the Adapter board (source).
  • XCTU Documentation (link)

Arduino Side:

Sparkfun XBee Shield

Arduino Uno
  1. Follow Sparkfun's XBee Shield Hookup Guide (link). This guide provides a walkthrough of the shield and some example code. If you are constantly receiving data through serial monitor, see the Troubleshooting section below.

  2. More example code is available at olinrobotics/learning-resources under /xbee (link).

Arduino Mega

Due to the Mega's configuration of hardware and software serial-available ports, SoftwareSerial on the 2 and 3 pins doesn't work. To use this shield, you need to use different SoftwareSerial pins, and modify the shield electrically. Follow the instructions in the "Software Serial Note" in the step 1 tutorial for Unos (above), and modify the port numbers in the example code to match.

Sparkfun Wireless Motor Driver Shield

Arduino Uno
  1. Follow Sparkfun's Wireless Motor Driver Shield Hookup Guide (link).

  2. More example code is available at olinrobotics/learning-resources under /xbee (link).

Arduino Mega

Due to the Mega's configuration of hardware and software serial-available ports, SoftwareSerial on the A0 and A1 pins doesn't work fully. You can receive data, but not send it from the computer side. To use this shield, you need to use HardwareSerial. Follow the above instructions for Arduino Unos, but use the HardwareSerial example code and switch settings.

Using XBee with Terminal

For Linux Users, If you want to use the terminal to communicate with the robot rather than XCTU or the Serial monitor through a cable, follow Sparkfun's Serial Terminal Basics Tutorial (link)

Using XBee with Python

  1. To communicate using XBees within Python, use the xbee library

Using XBee with C++

To communicate using XBees from within a C++ program, you need to be able to read and write from serial ports. One library that enables this functionality is LibSerial.

  1. Go to crayzeewulf's GitHub Repository for libserial and follow the instructions in the README.md (link) to install libserial.
  2. Work through the tutorials in the LibSerial documentation (link), or work with the example code in the examples directory of the libserial repository (link).

Links:

[1]: Sparkfun XBee Buying Guide (link)
[2]: Rob Faludi Programming Arduino Wirelessly (link)
[3]: Arduino Wireless Programming w/ XBee Instructable (link)
[4]: Sparkfun XBee Shield (link)
[5]: Mouser XBee Pro S3B (link)
[6]: Sparkfun XBee Explorer USB (link) [7]: XCTU Software Installation (link) [8]: Digi Forum PC-XBee c++ Communication Thread (link) [9]: Arduino Forum XBee Arduino Thread (link)

Troubleshooting:

Table of Contents

Tutorials

Thrusts

  • Overview - Overview of Thrust Work
  • GRAVL - Ground Robotic Autonomous Vehicle Lab
  • HIRo - Human Interactions Robotics Laboratory
  • ORCAS - Olin Robotic Collaborative Autonomous Submersibles
  • Baymax- Eusocial Robotics
  • MORA - Miniature Oscillating Robot Agent (robofish swarms!)

General Documentation

Clone this wiki locally