ChoosingAnXBee DevelopersGuide GettingStarted GettingStartedWithEclipse XBeeConfiguration XBeePins
Overview
This is a Java API for communication with XBee/XBee-Pro series 1 (802.15.4) and series 2 (ZNet 2.5 and ZB/ZigBee Pro) OEM RF Modules, in API mode. The objective of this project is to provide a flexible and simple to use API to interact with XBee radios. In terms of flexibility, the goal is to not constrain you to a particular implementation (e.g. GUI, Web App), but instead let you decide how to use it. This software has been tested on Windows, Mac, and Linux and can run on any other platform that supports Java 5 or greater and RXTX.
News
- 5/10/09 Version 0.5.5 is available and includes many updates. See ReleaseNotes for details.
- 3/29/09 I have released XBee Arduino. This is a port of XBee API to the Arduino platform, allowing you to send/receive packets on Arduino.
- 1/29/09 I have released XBee XMPP. This project is built on XBee-API and uses XMPP for remote communication with an XBee network. This allows you to share an XBee with multiple applications, that can exist on different machines.
- 1/25/09 Version 0.5.1 of the XBee API is now available. This release contains two bugfixes. See ReleaseNotes for details.
- 1/17/09 Version 0.5
- 8/3/08 Version 0.4
- 6/10/08 Version 0.3.1
- 4/29/08 Version 0.3
Documentation
Examples
Here are a few examples that demostrate some common functionality:
Turn on an I/O port on a remote Series 2 (ZNet/ZB Pro) XBee:
XBee xbee = new XBee();
xbee.open("COM5", 9600);
// this is the Serial High (SH) + Serial Low (SL) of the remote XBee
XBeeAddress64 addr64 = new XBeeAddress64(0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0, 1);
// 5 is Digital Output High
ZNetRemoteAtRequest request = new ZNetRemoteAtRequest(addr64, "D0", new int[] {5});
xbee.sendAsynchronous(request);
ZNetRemoteAtResponse response = (ZNetRemoteAtResponse) xbee.getResponse();
if (response.isOk()) {
System.out.println("Successfully turned on D0");
} else {
System.out.println("Attempt to turn on D0 failed. Status: " + response.getStatus());
}
// shutdown the serial port and associated threads
xbee.close();
Receive I/O samples from a remote Series 1 (802.15.4) XBee:
XBee xbee = new XBee();
xbee.open("COM15", 9600);
while (true) {
RxResponseIoSample ioSample = (RxResponseIoSample) xbee.getResponse();
System.out.println("We received a sample from " + ioSample.getSourceAddress());
if (ioSample.containsAnalog()) {
System.out.println("10-bit temp reading is " + ioSample.getSamples()[0].getAnalog1();
}
}There are many more detailed examples included in the code for both ZigBee and 802.15.4. Here are just a few:
This example contains a few sample configurations to get your ZigBee coordinator and end devices configured quickly, without needing X-CTU (windows only) ZNetApiAtTest.java
Example of sending packets from a ZigBee coordinator to an end device ZNetSenderTest.java
This example receives the packets sent in the previous example ZNetReceiverTest.java
Feature Support
The majority of the XBee specification has been implemented for both 802.15.4 (Series 1) and ZNet 2.5/ZB Pro (Series 2). See FeatureSupport for a full listing of supported API types.
About
I received my first pair of XBee Pro radios in Nov '07, after learning about them on the Arduino website. I quickly learned that to take advantage of the real power in XBee radios (e.g. I/O Samples, ACK/Delivery Status, Remote AT etc.), you need to configure the radio in API mode. I searched for open source XBee software with support for API mode, but couldn't find anything, so I decided to write my own. I started coding on 12/15/2007 and after about 300 commits and several months later I released the software here, on Google Code.
Support
Please report any bugs on the Issue Tracker For questions regarding this software, not covered in the documentation, use the Forum
Questions/Feedback
I can be contacted at andrew.rapp [at] gmail