skip navigational linksPJRC
Shopping Cart Checkout Shipping Cost Download Website
Home MP3 Player 8051 Tools All Projects PJRC Store Site Map
You are here: Teensy Teensyduino Libraries XBee Search PJRC

PJRC Store
Teensy, $16
Teensy Pins, $19
Teensy++, $24
Teensy++ Pins, $27
USB Cable, $4
Teensy
Main Page
Getting Started
How-To Tips
Code Library
Projects
Teensyduino
Reference

XBee Library

The XBee library, written by Andrew Rapp, is for communicating with XBee wireless modules in API mode.

Download: XBee.zip (Version 0.2.1, modified for Teensy)

This library has been confirmed working up to 38400 baud on Teensy 2.0.

Hardware Requirements

The simplest way to use XBee with Teensy is this adaptor board.

XBee
Pin
FunctionTeensy 2.0
Pin
Teensy++ 2.0
Pin
13.3V Power(use 3.3V regulator)
2Data: XBee -> Teensy72
3Data: Teensy -> XBee83
10Ground11

Configured for TeensyConfigured for Teensy++

Configuring XBee with X-CTU Software

XBee modules need to be configured with the X-CTU software.

Before running X-CTU, upload the USBtoSerial example, found in File > Examples > Teensy > USB_Serial > USBtoSerial.

Tools > USB Type must be set to Serial before upload to Teensy.

When you run X-CTU, select the "USB Serial" port which is Teensy (running the USBtoSerial sketch), and then click "Test / Query". If "Test / Query" fails, check your connections and power to XBee.

To access XBee's settings, click the "Modem Configuration" tab, and then click "Read".

From here, you can configure your XBee for API mode.

Using the XBee Library Examples

The XBee examples use the NewSoftSerial library because the Arduino Serial port is need to talk to XBee. On Arduino, you would need to connect another USB-Serial converter to the NewSoftSerial pins.

On Teensy there is no need for NewSoftSerial and an extra USB-Serial converter. You can use the USB port, because XBee uses the completely separate Uart pins. To make the examples work easily, remove the NewSoftSerial object, and add a #define to use Serial in place of "nss".

//NewSoftSerial nss(ssRX, ssTX);  // not needed for Teensy
#define nss Serial                // "nss" prints to Arduino Serial Monitor

 

 

 

TODO: help wanted... to write the rest of this page with actual usage examples. Here is the main XBee library page.

 

TODO: test this adaptor with the new wifi modules (update: Oct 20, 2011: a pair of WiFi modules are on order... plan to test soon and add photos + results here)