Using RF1276 radios for wireless telemetry with APM

Release time:2016-07-03



Adding wireless telemetry is not difficult and can extend the capabilities of your UAV immensely. We recommend RF1276 module. If you are in Europe, where 900Mhz is not allowed, you can use a 868MHz band RF1276 LoRa.
On APM 2, you cannot use RF1276 while your APM board is connected to the USB port.
That’s because the RF1276 and USB share the same serial port, with some clever multiplexing to detect if the USB cable is plugged in and switching output to the USB if so. Although that has the huge win of freeing up a serial port for some other use (want to connect an Android phone anyone?), it does mean that you need to disconnect the board from the USB cable and power it some other way when testing wireless telemetry on your bench.
  • Wiring it up


Connect the RF1276 to APM 2 as shown above. RF1276 should be in normal mode.
We recommend the cable, which comes with the official Wireless Telemetry kit shown above. It is designed to connect the RF1276 to APM, as it will provide the neatest and safest connection
On APM 2.5, use the dedicated telemetry port and supplied cable, as shown:
If you’re using a USB adapter, simply connect it via a USB cable as shown:
If you’re using an usb adapter on the ground side, connect it to a usb cable and plug that into your PC or laptop.
The RF1276 modules with a default of 9600bps for UART port, which you must change to match the APM’s serial speed of 57600 bps via RF tool.  set RF1276 modules to match this speed. (If you want to use a different speed, you can change that by entering the line
#define SERIAL3_BAUD [whatever baud rate you want]
in the APM_Config.h file.)
Connect each one of the them to the USB adapter board, plug the USB cable into your PC, and RF tool to select the right serial port and communicate with them. Remember to initially set the utility to 9600bps to contact the new RF1276, and than after you’ve changed the speed, change the RF1276 serial speed accordingly.
Testing the connection
If you open up a terminal program on your laptop (you can use the Arduino IDE’s serial monitor for this, too), select the correct serial port, and set the baud rate to whatever you set the RF1276 modules to above (the default is 57600). Once you do this, you should see APM telemetry coming in. Anytime there is a “Serial3.println” in the code, that data will be sent through the RF1276 to the ground. You can record any data you want, and even datalog from the ground! You can also open the Ground Station software, setting the right port and baud speed) and it should begin to show APM data.
Additionally, if you want to test the range of your RF1276 link, connect the plane-side RF1276’s RX and TX pins together to create a loopback circuit and use the X-CTU utility’s range test function. For the modules we are using you should get around 8 miles.
ArduPilot Mega has four serial ports so all the usual Arduino serial commands now take a specifier to say which port you want to read from or write to. For example: Serial1.print(), Serial2.print(). The port connected to the USB/FDTI connector is Serial0. The port connected to the Telecom pins is Serial3.
1)
Plug your RF1276 into one USB port and your APM into another. Use Arduino to load the demo code, and then in the Arduino IDE set the serial port to the one assigned to your APM board. Then open the serial monitor, setting the baud rate to 115200. You should see “Port 0″ repeated as follows, showing the output from the APM’s USB port:
2)
Now switch the serial port to the one your RF1276 is assigned to and reopen the serial monitor, setting the baud rate to 57600 (which is the speed 6 should already be programmed for). You should now see “Port 3″ repeated, showing the output from APM’s RF1276 port.