I've had quite a few people getting in contact asking for support with the initial setup and configuration of libxbee. As a result, I felt that it would be worthwhile writing this guide. libxbee is very straight forward, once you understand the principals involved.
The other end of the XBee link does not have to match API mode or baud rate. The XBee connected directly to libxbee must be configured as below, but other modules in the network may be configured 'transparent' access or a different baud rate.
There are two configuration options that must be correctly configured for libxbee to communicate with XBee modules. Aside from the API mode and the serial interface, the XBee module can be configured differently.
I have experienced issues with XBee modules not operating correctly in API mode 2, so I would advise against its use.
Having said this, it is possible to run libxbee in API mode 2 - you must uncomment the
XBEE_API2 line in
config.mk and then rebuild the library.
The modules that are connected directly to libxbee should be configured in API mode 1 (see the
In some cases this will require the correct firmware to be loaded - for example the XBee ZigBee modules.
You must of course match the baudrate configuration between libxbee and the XBee module. Baudrates higher than 57600 have been repoted to have issues due to the error in clock division - I usually use 57600 baud.
libxbee expects to use hardware flow control (the RTS and CTS signals) by default.
For this, the XBee modules must be configured correctly.
These signals are usually present as a mode for Digital I/O pins 6 and 7 - see the
I recommend that you use hardware flow control, however in some cases it is not a viable option.
If you want to run without hardware flow control, you must uncomment the
XBEE_NO_RTSCTS line in