MegunoLink Pro now supports XBee series 2 radios modules operating in API mode using the XBee connection in the connection manager. XBees running in transparent mode can still be used with the traditional serial (COM) connection.
With MegunoLink’s XBee Series 2 connection you can now:
- Receive serial data transmitted from remote XBees to a connected local XBee.
- Send serial data from the local XBee to individual remote nodes.
- Change some of the basic settings on local and remote XBees.
Useful Resources
XBee is a wireless communication module that Digi built to the 802.15.4/ZigBee standard. If you are unfamiliar with XBees and/or the ZigBee protocol, refer to the following links to get you started:
Robert Faludi has written a great book on ZigBee mesh networking called Building Wireless Sensor Networks which goes into great detail on XBees and has a number of xample projects which use XBees in conjunction with Arduino hardware.
Things you might need:
- XBee Series 2 or the pro version.
- An adapter board for connecting your XBee to a computer.
- An adapter board for connecting your XBee to an Arduino.
- XCTU software for putting firmware onto your XBee modules.
- An Arduino XBee library for communicating with XBee modules in API mode.
XBee Configuration
To use your XBee Series 2 modules with MegunoLink you require the following:
- XBee series 2 (or Pro S2B) modules.
- An adapter to connect your XBee to your computer.
- XCTU for programming the XBee modules with the correct firmware versions.
To get started with your Xbee project you will first need to connect your XBee module to your computer and use XCTU to program it with the correct firmware. Note, all ZigBee mesh networks require one (and only one) device to act as a coordinator for the network. What firmware?!!
MegunoLink Pro
To use your XBee with MegunoLink Pro you need to first open MegunoLink and add an XBee Series 2 connection in the Connection Manger visualiser. You will need to select the COM port the XBee is connected to and adjust the baudrate to match (default is 9600). After the configuration is complete click the Connect button.
You should now have a connection with your XBee. To confirm communication with the XBee, open the XBee Manager visualiser and set the source to your new XBee Connection. Click the Get button in the Local XBee tab. If the local XBee and its connection has bee configured correctly it will retrieve some of the useful settings exposed by MegunoLink.
The local settings include:
- Firmware version – this can be updated and changed using XCTU.
- Hardware version – the version identifier for the XBee hardware.
- RSSI – the signal strength from the last packet the local XBee received.
- Operating Channel – the channel the XBee network is operating on. This is determined automatically by the coordinator when establishing a network.
- PAN ID – this is the personal area network ID. It’s a hexadecimal value between 0x0 and 0xFFFF. XBees can only communicate with each other if they are on the same PAN ID.
- Baud rate – this is the baud rate of the physical communication layer (serial connection).
- Escaped Characters – this determines whether the XBee packets use escape characters or not.
- Node Identifier – this is a human-readable name to give your XBee. It can be up to 20 characters in length.
The buttons at the bottom control the XBee manager:
- Get – retrieves the settings from the local XBee.
- Set – this will update the local XBee with the currently selected settings. These settings are volatile until the Write button is pressed.
- Write – this will commit the updated settings to non-volatile memory so power cycling will not reset them to a previous state.
- Fac. Reset – this will carry out a factory reset initialising the settings to their default values.
Remote XBees
The XBee manager also lets you easily retrieve and change settings on remote XBees on the local XBee’s network. To retrieve or change remote settings first click the remote settings tab in the XBee Manager visualiser. Click the Node Discover button at the top of the XBee Manager visualiser. This will populate the remote address drop-down menu with all of the available remote XBees. Remote XBees can be configured in the same way as the Local XBee was. Simply select the address, update the settings then Set/Write them into the remote XBees local memory.
Sending Data to Remote XBees
All of the traditional approaches for sending data in MegunoLink should work with the XBee Series 2 connection including the Monitor and Interface Panel. There is also a Transmit Payload tab on the XBee Manager to send short messages when testing your wireless networks. Simply type a string or byte and add it to the packet. Select the destination address and hit send. The packet size is limited to 72bytes.
Things to Note
- MegunoLink expects recieved packets to have escaped characters added. Your XBees should have escaped characters set to yes (AP = 2 if using XCTU to configure the XBee). Check out the article called Escaped characters and API Mode 2 on the Digi website for more information on escape characters.
- If you change the baud rate of the local XBee you will also have to change the baud rate of the XBee connection in the Connection Manager visualiser. If you change the baud rate of the remote XBees you can still communicate wirelessly with MegunoLink however it will likely cause a problem between the remote XBee and whatever it was talking to.
- If you perform a node discover then disconnect a Xbee on the network (or add a new XBee) you will need to perform another node discovery to update the address list.
- Changing the PAN ID of a coordinator will cause it to create a new network on a new operating channel. If you want your remote XBees to join this new network you will also need to update their PAN ID and then perform a network reset.