|
Project Information
Members
Featured
Downloads
Wiki pages
Links
|
OverviewThis is an Arduino library for communicating with XBees in API mode, with support for both Series 1 (802.15.4) and Series 2 (ZB Pro/ZNet). This library Includes support for the majority of packet types, including: TX/RX, AT Command, Remote AT, I/O Samples and Modem Status. Note: This software requires API mode, by setting AP=2. If you are using Series 2 XBee, you'll need to install API Firmware (they ship with AT firmware), then set AP=2. This software will not work correctly with AP=1 Refer to XBeeConfiguration and WhyApiMode for more info. News
DocumentationAPI docs ExampleI have created several sketches of sending/receiving packets with Series 1 and 2 XBee radios. You can find these in the examples folder. Here's an example of sending a packet with a Series 2 radio: // Create an XBee object at the top of your sketch
XBee xbee = XBee();
// Tell XBee to start Serial
xbee.begin(9600);
// Create an array for holding the data you want to send.
uint8_t payload[] = { 'H', 'i' };
// Specify the address of the remote XBee (this is the SH + SL)
XBeeAddress64 addr64 = XBeeAddress64(0x0013a200, 0x403e0f30);
// Create a TX Request
ZBTxRequest zbTx = ZBTxRequest(addr64, payload, sizeof(payload));
// Send your request
xbee.send(zbTx);
See the examples folder for the full source. There are more examples in the download. See the XBee API project for Arduino < - > Computer communication. To add XBee support to a new sketch, add "#include <XBee.h>" (without quotes) to the top of your sketch. You can also add it by selecting the "sketch" menu, and choosing "Import Library->XBee". Learning/BooksIf you want to learn more about Arduino and XBee, check out these books:
HardwareIf you're just getting started, you'll need the following hardware to use this software. If you want to do Arduino-to-Arduino communication you'll need two Arduino boards, or one board if you only want to do Arduino-to-Computer communication. The Arduino UNO, or MEGA, are good choices as they are compatible with XBee Shields. The Arduino Mega is a popular choice for many as it offers two serial ports, more memory and I/O. You'll need at least two XBee radios. Series 1 are the best choice for most hobbyists. Series 2 XBee radios feature ZigBee. And one Arduino XBee Shield for each Arduino board.
A XBee Explorer is highly recommended for updating firmware and configuring the radio. If you are using Series 2 radios you'll need an XBee Explorer to upload API firmware to the radio (they ship with AT firmware). Here's a kit that includes 2 Series 1 XBee radios, an Arduino Shield (with headers) and XBee USB Explorer For interfacing with Arduino clones that are not shield compatible, such as Modern Device's RBBB, you will need 3.3V power and logic shifter or voltage divider to convert Arduino's 5V to an XBee safe 3.3V. For more info, see Thomas Ouellet Fredericks' AXIC. InstallationArduino 16 (or earlier): Download the zip file, extract and copy the XBee folder to ARDUINO_HOME/hardware/libraries If you are upgrading from a previous version, be sure to delete XBee.o Arduino 17 (or later): Determine the location of your sketchbook by selecting "preferences" on the Arduino menu. Create a "libraries" folder in your sketchbook and unzip the download there. See this for more information. Uploading SketchesThe Arduino has only one serial port which must be connected to USB (FTDI) for uploading sketches and to the XBee for running sketches. The Arduino XBee Shield provides a set of jumpers to direct Serial communication to either the USB (Arduino IDE) or the XBee. When using the XBee Shield you will need to place both the jumpers in the USB position prior to uploading your sketch. Then after a successful upload, place the jumpers in the "XBEE" position to run your sketch. Always remember to power off the Arduino before moving the jumpers. ConfigurationTo use this library your XBee must be configured in API mode (AP=2). Take a look at this for information on configuring your radios to form a network. Other MicrosNot using Arduino? It should be easy to port this library to any microcontroller that supports C++ and serial available/read/write/flush. The only other dependency is the millis() function for milliseconds. SupportPlease report any bugs on the Issue Tracker. Questions/FeedbackQuestions about this project should be posted to http://groups.google.com/group/xbee-api?pli=1 For all other stuff, I can be contacted at andrew.rapp at gmail. |


