Page 1 of 1

Setup Xbee radios for ARDUPILOT and ARDUCOPTER Telemetry

Posted: Fri Jun 01, 2012 - 5:24 pm
by moltosenso
This tutorial describes how to use the moltosenso Network Manager software to set up and remotely control Xbee radios used for Telemetry purposes with ARDUPILOT and ARDUCOPTER.

Disclaimer:
moltosenso Network Manager is a software suite that provides tools to set and control Digi International modules. Xbee are included.
moltosenso Network Manager releases can be found on our Download Page.
For issues related with moltosenso Network Manager usability, write on this forum. Experts will answer to your questions.
moltosenso is not responsible for any direct or indirect damages on equipments, software, things and people as a consequence of the application of this tutorial.
moltosenso is not affiliated neither with Digi International nor with DIY Drones - 3D Robotics.
This tutorial has a similar structure and sometimes report similar sentences of the tutorials that can be found at these links:
Comments and suggestions are welcome: they will be revised and added to this one.


Setting up the Xbee modules with moltosenso Network Manager
These instructions apply to Digi International Xbee @ 868MHz, Xbee @ 900MHz and Xbee series-1 and series-2 @ 2.4GHz modules. If you have the DIY Drones Telemetry Kit, your Xbee modules are already set up and ready to go. But if you're setting up your own, here are some instructions:

  1. The Xbee modules ship with a default baud-rate of 9600bps. The APM's serial port speed is 57600 bps; so, set your Xbee modules to match this speed or, if you want to use a different speed for the APM, you can change that by entering the line:

    Code: Select all

    #define SERIAL3_BAUD [whatever baud rate you want]

    in the APM_Config.h file.
  2. Connect each module you own to the USB adapter board, plug the USB cable into your PC, and use the moltosenso Network Manager (IRON or superior release) to manage the module.
  3. Open the software, go to the “Port Setup” tab, click on the “Scan” button under “Available Ports”, then select your device from the dropdown menu, set the Baud Rate to 9600bps, chose “Flow Control” software, leave everything else as it is and then click on “Open Port”. You can avoid all these steps, by purchasing the moltosenso Network Manager Bronze and clicking on the "Automatically Scan Ports" button.
  4. The node, if not sleeping, shows up in the “Detected Devices” pane. By clicking on the relative line, it becomes the “Current device”.
  5. Now the other tabs are enabled, so you can click on to the “Node Settings” tab to go and change the speed (baud rate) of the plugged module.
  6. Click on the unique node that shows up in the upper pane and click on the “Get All” button.
  7. Scroll down and find the “BD” parameter (baud rate). It is set on 3 (9600bps). Change the value to 6 (57600bps) and click on the “Set” button. Now the software is not able to communicate with the module since the baud rate on the node has been changed.
  8. Come back again to the “Port Setup” tab and click on “Close Port”. Then click on “Scan”, select the device in the dropdown menu, set the new baud rate to 57600bps and click on “Open Port”. Again, if you own the Bronze release, just click on the "Automatically Scan Ports" button.
  9. Go to the “Node Settings” tab and click on the “Write Permanently” button, so the parameters are permanently transferred on the non volatile memory of the module.
  10. Give your modules a unique Network ID (VID), so they can be easily paired and make sure you have set it the same on all modules. (Note: If you will be flying near other UAV planes make sure to verify the Network IDs are unique and not used by others in your vicinity.)

This is how the “Node Settings” tab of moltosenso Network Manager should look like when you click the “Get All” button:

Image

Note: If you bought your Xbee @ 900MHz modules from Sparkfun, rather than the official DIY Drones kit, please note that they sometimes ship it with the wrong firmware.
If your Xbee module is reporting in “Current Device” pane of “Port Setup” tab that it's an XBP09-DM (rather than the correct XBP09-DP), do the following:
  1. download the XBP09-DP firmware in .ebl format (non .ebl firmware won't work with FW upload of moltosenso Network Manager);
  2. go to the “Node Settings” tab and click of the “FW Upload” button;
  3. in the wizard click on “Choose FW file and upload” button and select the downloaded file, choosing the port parameters reported on the user manual of your module (for Xbee @ 900MHz the baud rate should be 9600bps, while for Xbee @ 2.4GHz the baud rate should be 115200bps);
  4. leave the software to upload the firmware, then change the baud rate and Modem VID, starting from step 5. of the first list.


Testing the connection
You can easily observe your APM telemetry, by following the next steps on your moltosenso Network Manager (IRON or superior release):
  1. plug to the computer the module that acts as the base-station and follow instructions described at step 3. of the first list;
  2. click on the "Terminal";
  3. you should see, in the "Output" box, the APM telemetry coming in at anytime the APM microcontroller execute a "Serial3.println" instruction.

Range Test
If you need to test the transmission range between your Xbee modules, follow these instructions:
  1. plug to the computer the module that acts as the base-station and follow instructions described at step 3. of the first list;
  2. click on the "Network" menu and choose the "Network Discovery" option;
  3. the "RSSI Test" tab become selectable, click it;
  4. choose the remote device from the "Remote Module Selection" list;
  5. select the packet transmission period (in AT mode the range is from 3s to 10s);
  6. select a suitable scale for the plot;
  7. click on the PLAY button.

The first two widgets in the middle of the Tab give an instantaneous idea of the RSSI value measured on both the local node (on the left) and on the remote node (in the middle). They report the instantaneous numerical value and the corresponding representation with a bar graph.
Then, the widget on the right provides the number of sent and received packets and the Packet Error Rate (PER), so the ratio between sent and received packets.
In the lower part of the Tab there is the plotting area, where the behavior in time of the RSSI for both the local and the remote device is shown.
For the modules used here, you should have connection for around a mile.

Note: with moltosenso Network Manager it is not necessary to connect the plane-side Xbee module's RX and TX pins together (creating a loopback circuit) in order to get the locale RSSI value. This is possible only if Xbees are flashed with an API firmware, because moltosenso Network Manager uses a special transmission packet to force the remote node to reply back with its real RSSI value.
Unfortunately, due to a limitation of Xbees flashed with an AT firmware, it's not possible to get the RSSI value from the remote node in this condition. BUT, do not worry: from the reciprocity theorem of the antenna theory, the RSSI values of both the local node and the remote node result similar, if the transceivers and the antennas' radiation are identical at the local as well as at the remote node. This means that, in most cases, the RSSI value measured on the local node regarding an incoming packet from a specific remote node is more than sufficient to derive the reliability of the channel between the local node and that specific remote node.

Note: if you've got an Xbee plugged to your APM, the USB cable will probably not provide enough power by itself to drive them both. Please also have an ESC and LiPo connected to the RC pins to provide additional power. (You can tell that you've got a low power ("brownout") condition if you just have the red C LED blinking dimly, or the APM board is otherwise intermittent.)


Recover your Xbee firmware
Note: Sometimes Xbee modules get corrupted. If you're finding that yours stops working (green LED on Adafruit adapter doesn't come on), instructions to reload the firmware follow, using the USB adapter board:
  1. Connect the module to the computer using your interface board;
  2. open the moltosenso Network Manager (IRON or superior release);
  3. go to "File" menu and choose the "Firmware Recovery..." option;
  4. click on the "Scan" button, select the module and set the port parameters according to what it is reported on the user manual of the module (for Xbee @ 900MHz modules the baud rate should be 9600bps, while for Xbee @ 2.4GHz modules the baud rate should be 115200bps); do not forget to choose Software Flow control;
  5. click on the "Choose FW file and upload" button;
  6. select for Xbee @ 900Mhz modules the "XBP09-DP" firmware, for Xbee @ 868Mhz modules the "XBP08-DP" firmware, for Xbee-Pro 802.15.4 series-2 @ 2.4GHz modules select "XBP24-B", while for Xbee-Pro ZigBee series-2 @ 2.4GHz modules select "XBP24-ZB";
  7. start the upload.

The module should be flashed with the chosen firmware.
Once you've confirmed that it's working again, make you sure you reset its baud rate (typically 57k for APM) and VID number to match your other module.


Thank you for following this tutorial.
Now you are ready to come back to one of these links:

Re: Setup Xbee radios for ARDUPILOT and ARDUCOPTER Telemetry

Posted: Sat Jun 23, 2012 - 10:48 pm
by ChrisO
All I get after "Open Port" is:
Unix SerialPort - Serial Port /dev/ttyUSB0 successfully opened
Writing "+++" on serial port
PortManager - ND Timer Expired

It is the correct port, I can access the xbee with a terminal program.
Any idea?

Thanks
Chris

Re: Setup Xbee radios for ARDUPILOT and ARDUCOPTER Telemetry

Posted: Thu Jun 28, 2012 - 9:30 am
by moltosenso
Thank you Chris for your question.
As you already commented with our Technical Support, this issue is often related to the sleeping behavior of the node.
If the port is correctly opened and the inquiry ends with a timeout that expires, it barely means that your node is sleeping.
There are several ways to circumvent this issue, they are explained in the module user manual.

Hope this help.
Regards.


ChrisO wrote:All I get after "Open Port" is:
Unix SerialPort - Serial Port /dev/ttyUSB0 successfully opened
Writing "+++" on serial port
PortManager - ND Timer Expired

It is the correct port, I can access the xbee with a terminal program.
Any idea?

Thanks
Chris

Yes

Posted: Tue Aug 21, 2012 - 5:56 am
by IromGormoUh
+1. this is very interesting

Re: Setup Xbee radios for ARDUPILOT and ARDUCOPTER Telemetry

Posted: Tue Sep 11, 2012 - 2:02 pm
by kostasm
Note: with moltosenso Network Manager it is not necessary to connect the plane-side Xbee module's RX and TX pins together (creating a loopback circuit) in order to get the locale RSSI value. Consider that RSSI value at the remote node should not differ a lot from the local value. Connect these pins only if you need the RSSI value at the remote node and the Packet Error Rate (PER).


What exactly the bold text means?
My interpretation is that there is an approximation of the Tx value and only the Rx is extracted from the ZigBee Packet. Am I correct? Could you elaborate more on that?

Is it possible to extract the real RSSI value from every node in order to better monitor the network?

Thanks in advance!!
kostasm

Re: Setup Xbee radios for ARDUPILOT and ARDUCOPTER Telemetry

Posted: Tue Sep 18, 2012 - 3:57 pm
by moltosenso
Thank you Kostam for your question.

The values shown are exactly those provided by the two nodes (no approximations are introduced).

This is possible because the moltosenso Network Manager uses a special transmission packet to force the remote node to reply back with its real RSSI value. We wanted to put emphasis on this fact, that we do not need an hardware loopback.

About the bold sentence: since there is a condition where the user is not able to get the RSSI value, due to a limitation of the Xbee's AT firmware, then the bold sentence had the aim of providing a "workaround" to this problem. It only asserts, from the reciprocity theorem of the antenna theory, that both the RSSI values of the local node and the remote one are similar, if both the transceivers and the antennas' radiation are identical at the local as well al at the remote node (that is what happens in most cases).

Anyway, we've rewritten the sentence now, let us know if it is more clear.

Kind regards.