mTX: Mavlink for OpenTx and OlliW Telemetry Script

The project has been renamed to mTX ­čÖé

The aim of the mTX project is to make RC radio transmitters which can run the OpenTx firmware being able to handle the MAVLink protocol natively.

The project effectively turns the transmitter into a ground control station for operating your drone. That is, the transmitter not only allows you now to receive the most detailed telemetry data, but also provides a full, bidirectional MAVLink communication link with appropriate bandwidth to the drone and therewith the rich set of capabilities coming with this.

The project has several aspects:

  • Hardware: The solution does NOT need any additional hardware, such as converters, teensys and so on!
  • Radio Firmware: Extension of the OpenTx firmware to handle MAVLink.
  • Telemetry Scripts: Fully practical MAVLink telemetry script.
  • Touch Screen: Lua script support of touch screens when available.
  • mLRS Long-range Radio Link: Seamless integration with the mLRS radio link project.

Comment: I distinguish between drones and racers. As regards the communication link racers don’t need the same capabilities as drones do, in terms of bandwidth and bi-directionality, and the options available for racers can be considered sufficient. This is IMHO clearly not so for drones, and MAVLink is the protocol used by the de-facto standard open source drone projects PX4 and ArduPilot. And this is what this project is about.

The project is fully functional and mature; these videos may give an impression of the state of affairs as of Feb. 2021, but you can find more videos on yt:

Comment: In this video I’m saying that the frequent loss of telemetry connections are due to being indoors. This is wrong. I had upgraded the SiK radios to the latest firmware using MissionPlanner, which screwed it up. Flashing the proper SiK firmware resolved the issue. ­čÖé

This video demonstrates that it works in the „real world“, by means of a drone quick shot:

mTX even supports a touch screen when available, like on the TX16S, which allows you to do amazing things like this:


Third-Party Links:

1. Concept

The idea to add MAVLink support to OpenTx is not new (see e.g. here, here). It also was extensively discussed ca 2 years ago here, and a first albeit very rudimentary implementation was pr’ed here, but both the discussion and the PR went stale long ago.

However, telemetry with sufficient data rate is obviously of great importance, especially for drones, and the currently available options to combine them with OpenTx-based transmitters are – as impressive works they are – little else than hacks and workarounds to get some basic functionality. The FrSky passthrough protocol is a good example. It needs special code on the flight controller, a special converter, the wiring is also not so nice, and the data rate is low. In comparison, MAVLink drone systems typically use full-duplex serial wireless links with baudrates of e.g. 57600 bps. Examples are the abundant 3DR (SiK) telemetry devices, Dragonlink and similar LRS units, wifi-based telemetry units, and so on.

IMHO, hardware-wise, all it really should need is to connect the telemetry device with two Rx,Tx wires to the RC transmitter, or, even better, to just have to plug it into the JR bay in the back of the radio transmitter.

Anything else, like having to use additional modules, really does not make much sense to me. I know that this view is not shared by everyone, but to me this is just obvious. So I started this project, and arrived at the following concept:

A. Hardware

Obviously, I considered it a strict requirement that one should not need any additional hardware like converters, and accordingly rejected any potential solution which did not comply with this. The good news: this is indeed fully achieved.

Some transmitters do not provide suitable connections to the outside. In these cases one has to solder some wires to the transmitter’s main board, and depending on your soldering skills you may consider this very difficult or very simple. But this is really all this project needs hardware-wise at most. Notably, some OpenTx transmitters expose one or more UART ports to the user, such as the RadioMaster TX16S. These transmitters are perfect for the project.

The most seamless integration is however provided in combination with the mLRS radio link project. All you need to do here is to plug a mLRS Tx module into the JR bay on the RC transmitter’s back, and adjust some parameter settings. Done.

Supported transmitters:

  • Jumper T16 and T18
  • Radiomaster TX16S
  • Horus X12S

Comment: I only own a Jumper T16 Pro and a Radiomaster TX16S, and thus can only test myself for these transmitters, and only speak for them. However, it has been confirmed by users in the rcgroups thread that the project also works perfectly fine with the Jumper T18 and Horus X12S. The firmware should be adaptable to other LCD transmitters.

B. Firmware

The mTX additions to the OpenTx firmware can be described by three layers:

MAVLink SDK: This is a higher-level interface to access the MAVLink functionality in Lua scripts, and is really the main driver. The idea here is to make it as simple and convenient as possible to write a telemetry script. For instance, the functionality provided by the well-known Yaapu FrSky Telemetry script can be realized by calling some simple Lua functions, but of course much richer functionality such as camera and gimbal control or guided drone control is also possible. This set of functions is provided by the mavsdk module; that is, in the Lua script they are called as, e.g., mavsdk.getGpsLatLonDeg().

MAVLink API: This is a low-level interface to access the MAVLink functionality in Lua scripts. It provides full access, i.e., allows us to receive and send any MAVLink message, and thus allows us to implement the features not provided by the MAVLink SDK. This set of functions is provided by the mavapi module; that is, in the Lua script they are called as, e.g., mavapi.getMessage(mavapi.M_ATTITUDE).

MAVLink Router: This is another key functionality, as it allows us to connect several MAVLink devices, effectively forming a MAVLink network. So, besides the telemetry device one also can connect e.g. a PC running MissionPlanner or a MAVLink-capable antenna tracker, without any further hardware hickups or modules. Both UARTs of the transmitter (AUX/UART3, AUX2/UART6) as well as the USB port are available for this.

My code additions to OpenTX can be found in the mTX fork. I did also open a corresponding PR to the OpenTx github repository, which however went stale; it appears to not have been of sufficient interest to be considered ­čÖü


Rcgroups user Risto has created some great pdfs documenting the mavsdk Lua functions:

C. Telemetry Lua Script

A further and important part of the project are practical Lua scripts. The cornerstone is the OlliW Telemetry Script. On the one side, it re-implements familiar telemetry features, at least to some extend (and I want to acknowledge that the layout of this part is indeed much inspired by the Yappu FrSky Telemetry script!). However, it clearly also aims at adding new functionality such as gimbal and camera support, and other cool stuff.

Moreover, mTX’s Lua implementation actually also supports the touch screen on the Radiomaster TX16S. How cool is that!

2. Hardware

As indicated in the above, no additional hardware like converters and such is needed. However, unless a mLRS system is used, in which case you just need to plug the mLRS Tx module into the transmitter’s JR bay, some hardware work might be needed, e.g., to get access to Rx & Tx capable pins on the RC transmitter or to establish power for the telemetry device.

For instance, the Radiomaster TX16S exposes two UARTs on the bottom side. So, all you need to do here is to connect your telemetry device to one of these and you are done.

For the Jumper T16 or T18 one has to solder three wires (Gnd, Rx, Tx) directly to the transmitter’s main board. Two options are possible, the UART3 pins or the UART6 pins (the UART6 pins are accessible on the unpopulated Bluetooth module). I have chosen the UART3 pins, but you may prefer those on the unpopulated Bluetooth module area.

The telemetry device also needs power, and what you need to do really depends very much on which wireless link you are using. In my early case (Jumper T16 and 3DR SiK telemetry radio) I soldered two further wires to appropriate points on the transmitter main board and am using a Pololu switch regulator to get 5 V for the telemetry device.

The following video shows what I did with my Jumper T16 Pro. However, I don’t use that anymore since quite a while; the TX16S is the better option, and I have converted to mLRS anyhow ­čÖé

3. Firmware and Script Installation

Somewhat outdated, needs update

A. Installing mTX

The installation of the mTX firmware is simple.

The procedure is as follows:

  • Download the latest firmware binary (openttx-xxx-2.x.x-XXX.bin) from the Github repository.
  • Start OpenTx Companion.
  • Switch off the transmitter.
  • Connect the transmitter via USB to your PC.
  • In OpenTx Companion search the menu „Read/write“ and select the option „Write Firmware to Radio“.
  • Select the firmware binary by clicking the „Load…“ button.
  • Hit the button „Write to Tx“.
  • Be patient, the process can take few minutes.

B. Installing OlliW Telemetry Script

Also the installation of the OlliW Telemetry Script is simple, and essentially works as for all the other scripts out there.

The procedure is as follows:

  • Download the latest SD card content from the Github repository.
  • Power on the transmitter.
  • Connect the transmitter via USB to your PC.
  • This – at least on Windows – will bring up an explorer showing the content of the SD card in your transmitter.
  • Drag and drop the downloaded folders named „WIDGETS“ and „SOUNDS“ into the explorer showing the transmitter’s SD card content. This will copy the files to the transmitter’s SD card.
  • Disconnect the transmitter from USB and switch it off.
  • Power on the transmitter, and install the widget script according to the OpenTx manual.

C. Video Tutorial

The procedures are also described in this video:

Hinterlasse einen Kommentar