Softivation

Configuring XBee Series 2C modules and connecting them to a drone

Setting up two XBee Series 2C modules as Coordinator and Router with XCTU, testing them by sending messages in the console and connecting them to the flight controller's telemetry port.

Furkan IŞIKAY Updated: 7 min read

XBee is a small radio module that talks on a Zigbee network. When you put two modules on the same network, one stays on the computer and the other on the drone, and they carry the serial line between them wirelessly. In this article we set up two XBee Series 2C with XCTU, test them by sending messages to each other, then connect them to the drone. The article is written for XBee Series 2C (S2C) and the current version of XCTU. The setting names are the same on the newer XBee 3 modules.

How the two XBees sit on the drone

The Coordinator on the computer and the Router on the drone talk with the same PAN ID
Look at the shared PAN ID line in the middle: the Coordinator forms the network and the Router joins it. Mission Planner connects through the COM port as if it were connected by cable.

What you need

  • Two XBee Series 2C modules. The ones in the images are XBee Pro 63 mW: one with a wire antenna (XBP24CZ7WIT-004), one with a PCB antenna.
  • Two XBee Explorer USB boards. The module plugs onto this, and the board shows up on the computer as a COM port.
  • XCTU from Digi's website (Windows, macOS, Linux).
The modules and XBee Explorer boards used
Look at the wire-antenna module on the left and the PCB-antenna one next to it. Each has its own Explorer board and USB cable.

If no COM port appears when you plug in the Explorer, install the driver first: XBee Explorer doesn't show up on the computer.

1. Adding the modules to XCTU

  1. Plug the modules into the Explorers and connect both to the computer. One computer is enough.
  2. Open XCTU and click the "Add a radio module" button at the top left.
  3. In the window that opens, select the module's COM port. Leave the baud rate at 9600 (the new module's factory speed) and click Finish.
  4. The module appears in the Radio Modules list on the left. Do the same for the second module.
The add module button in XCTU
Look at the marked button at the top left: Add a radio module opens from here.
COM port and baud rate selection
Look at the numbers: first the COM port, then the 9600 baud rate, and Finish last.

If the module doesn't show up in the list and an "Action Required" window opens: XBee Action Required error fix.

2. Firmware: make both the same and up to date

When you click the module in the list, its settings open on the right. Function Set and Firmware Version are at the top. They must be the same on both modules: on Series 2C, "Zigbee TH Pro" ("Zigbee TH" on non-Pro modules) and the latest version. On Series 2C, the Coordinator and Router use the same firmware; the role is determined by the CE setting below. If they differ, first update them as in the Updating XBee module firmware (with XCTU) article.

The module's settings page in XCTU
Look at the area with the red frame: when you click the module, its settings open on the right, section by section.

3. Note each module's serial number

In the Addressing section of the settings page, there are the Serial Number High (SH) and Serial Number Low (SL) lines. These can't be changed and differ on every module. Write down the SH and SL values of both modules; in a moment we'll enter each module's number into the other.

4. Settings

One module will be the Coordinator (forms the network) and the other the Router (joins the network). The Coordinator stays on the computer and the Router goes on the drone. After typing each value, click the pencil icon next to the line; only then is the value saved to the module.

SettingCoordinatorRouter
PAN ID (ID)33123312
Coordinator Enable (CE)Enabled [1]Disabled [0]
Zigbee Stack Profile (ZS)00
Destination High (DH)Router's SH valueCoordinator's SH value
Destination Low (DL)Router's SL valueCoordinator's SL value
Baud Rate (BD)57600 [6]57600 [6]
API Enable (AP)Transparent [0]Transparent [0]

PAN ID is the network's name and must be the same on both modules. You enter a hexadecimal number (0–9 and A–F, up to 16 digits); 3312 is an example, choose your own. That way you won't get mixed up with another XBee network nearby.

The baud rate is 57600 because ArduPilot's telemetry port talks at this speed by default. In Transparent mode, the module outputs from one end exactly what comes in at the other; this is the right mode for MAVLink.

The most common mistake: writing the module's own SH and SL values into DH and DL. The module talks to itself, and what you type in the console never reaches the other side. Enter each module's counterpart's number.

Coordinator: Networking section
On the Coordinator, look at the ID 3312 and CE Enabled [1] lines.
Coordinator: Addressing section
Look at the DH and DL lines: the Router's SH and SL values go here.
Coordinator: Serial Interfacing section
Look at the BD 57600 [6] and AP Transparent mode [0] lines.

After you change the baud rate, XCTU talks to the module at 57600. If the module drops off the list, select 57600 when you add it again.

5. Testing by sending messages

  1. Switch to the "Consoles working mode" button (the screen icon) at the top right of XCTU.
  2. Select the Coordinator from the left and click Open, then select the Router and open it too.
  3. Type something in the Coordinator's console. The same text appears in red in the Router's console.
  4. Now type from the Router; it should appear on the Coordinator. If it passes in both directions, the network is ready.
A message sent from one module
Look at the typed message and the Send Data button: the packet leaves from the Coordinator.
The message on the other module
Look at the red line in the Router's console: the message reached the other side.

If the message doesn't go through, check that the PAN IDs match, that DH and DL are the other module's number, and that both modules have the same baud rate.

6. Connecting to the drone

A warning when attaching the Router to the drone: XBee runs on 3.3 V, and it burns out if you give it 5 V directly. Use an XBee adapter with a voltage regulator (or the regulated version of a second Explorer). The adapter's TX goes to the board's TELEM1 RX, its RX to TX, and 5V and GND go to the board's 5V and GND.

On the flight controller, enter these values from Mission Planner:

Parameter file
SERIAL1_PROTOCOL = 2    # MAVLink 2
SERIAL1_BAUD = 57       # 57600

On the computer, select the Coordinator's COM port at 57600 and click CONNECT. The real gain of XBee is that it can form a network: you can connect multiple vehicles to a single Coordinator. If you want long range on a single vehicle, SiK radios have lower latency; we covered the difference in the What are MAVLink and telemetry article.

Example: Plugging the Router into the Pixhawk's TELEM1

Plug the Router into TELEM1 through the voltage-regulated adapter and set SERIAL1_PROTOCOL 2, SERIAL1_BAUD 57. Leave the Coordinator in the Explorer on the computer. Say the port shows up as COM8 in Device Manager.

Select COM8 and 57600 in Mission Planner and click CONNECT. The parameters download, and the artificial horizon on the HUD rotates as you tilt the board. The vehicle is now connected wirelessly.

Error Messages and Their Meanings

No Heartbeat Packets Received

Mission Planner opened the Coordinator's port but no MAVLink came from the board. Check whether both modules have BD 57600 and AP Transparent, whether the board has SERIAL1_BAUD 57, and whether TX and RX are crossed.

Could not find any radio module connected to the specified port and with valid settings.

After you set the baud rate to 57600, XCTU looks for the module at the old speed. When you add the module again, select 57600 or search at all baud rates.

What's next

We cover radio selection, range calculation and swarm communication in the Drone Communication Technologies course. The first lesson is free for members.

Resources

Was this article helpful?

Free resourceTEKNOFEST UAV software readiness checklistCheck off your UAV software readiness stage by stage on a printable list.