MAVLink
Warning
Although MAVLink has been in development for some time, and has been tested by a community of early adopters using ArduPilot crafts, MAVLink support is still a recent addition. There may be unexpected bugs; Exercise due caution.
NOTE
Enabling MAVLink forces the use of Hybrid or 16ch/2 switch mode. Wide switch mode is not supported. Enabling MAVLink forces a telemetry ratio of 1:2
Description¶
ExpressLRS now has full bi-directional MAVLink support, enabling native MAVLink telemetry downlink and RC control uplink. Users can now enjoy seamless integration of telemetry and RC control.
Hardware Requirements¶
Unlike airport, you do NOT need a second RX/TX pair for RC control, since ELRS' implementation allows you to do BOTH telemetry and RC control over one link.
To start using MAVLink, you just need one ESP ELRS transmitter, and one ESP ELRS receiver. The majority of recent ELRS hardware is ESP based, and will be compatible with MAVLink. An easy way to check is, if the RX/TX have WiFi, then it is ESP based.
NOTE
If you are using an internal TX module (e.g. a TX16S with internal ELRS), you will be required to use the TX Backpack to connect to you GCS via WiFi (USB cable between the TX and the PC is not an option for internal modules). See WiFi Connectivity below.
NOTE
If you are planning to use 915/868MHz, note that the data rate will be significantly slower than on 2.4GHz. This will result in especially slow parameter downloading, and with 200Hz packet rate at 915MHz, it takes 2+ minutes to pull parameters.
Flashing and Configuring MAVLink-RC¶
Ensure both your transmitter module, the embedded TX-Backpack (if using WiFi forwarding), and your receiver are up to date with the latest release versions:
- For the main ELRS firmware, follow the Firmware Update Guide for detailed instructions.
- For the TX-Backpack, follow the Transmitter Backpack Firmware Guide for detailed instructions.
The minimum versions to use this feature are: - Transmitter / receiver firmware: 3.5.0
- TX Backpack firmware: 1.5.0
-
Using the guides above, flash both the RX and TX
-
Turn on both the RX and TX, and ensure they connect properly
-
In ELRS LUA script, select
Other Devices
, select your receiver, and set theserial protocol
toMAVLink
. This configures the RX to output MAVLink protocol on the UART. -
Back out to the LUA scripts main menu, and select the new
Link Mode
option. Change it fromNormal
toMAVLink
. This configures the TX module to send / receive MAVLink. -
Configure your usual power, packet rate, etc. The telemetry ratio will be preset to 1:2 (and cannot be changed while in MAVLink mode).
-
(Optional) Configure Source and Target SysIDs
-
Power-cycle the receiver
-
Go to
Other Devices
and select your receiver -
Set
Target SysID
to the vehicle SysID -
Set
Source SysID
to preferred GCS SysID
-
-
Wire the RX to a free UART on your flight controller that is suitable for TLM + RC. A DMA-capable UART is recommended.
For the below steps, when a UART connection is mentioned, it will be written as SERIALx
. Replace x
with the UART number you are using.
- Configure
SERIALx_PROTOCOL=2
,SERIALx_BAUD=460
, andRSSI_TYPE=5
- Connect the TX module to the computer running the Ground Control Station via a USB cable (or alternatively via WiFi - See WiFi Connectivity below)
- Select the COM port on the GCS, and connect using
460800
baud
For the below steps, when a UART connection is mentioned, it will be written as SER_TELx
. Replace x
with the UART number you are using.
- Configure SER_TELx_BAUD to
460800 8N1
- Configure MAVLink with MAV_0_CONFIG to
TELEM2
- Configure MAVLink sending rate with MAV_0_RATE to
9600 B/s
UNSUPPORTED, CURRENTLY IN DEVELOPMENT - Released versions (up to version 7) of iNav cannot use MAVLink due the limitations highlighted in the Betaflight tab. As of version 8.0, which is currently not released yet, these limitations have been partially resolved and there is limited MAVLink support.
For testing of development version: For the below steps, when a UART connection is mentioned, it will be written as UARTx
. Replace x
with the UART number you are using.
- In the Ports tab, set the UARTx
Telemetry Protocol
toMAVLink
, and the baud rate to460800
. Make sureRX Serial
is disabled. - In the Receiver tab, set the Receiver type to
SERIAL
and theSerial Receiver Provider
toMAVLink
. Leave inverted & half-duplexdisabled
.
Betaflight contains an incomplete implementation of the MAVLink protocol standard (lacking RADIO_STATUS flow control). This causes an Betaflight aircraft to saturate the bandwidth of a telemetry link using soft flow control, and renders it unusable, ergo breaking support with ExpressLRS MAVLink.
WiFi Connectivity¶
For TX modules that have an onboard Backpack, the MAVLink data can be sent / received via WiFi to a PC or tablet etc. that is running the GCS software. This provides for a cable-free solution on your handset, as it removes the need for a USB cable between the TX and the GCS device.
To setup WiFi forwarding for MAVLink:
-
Ensure the TX Backpack is running version
1.5.0
or later -
In the ELRS LUA script, select
Backpack
, scroll to theTelemetry
option, and change the value toWiFi
-
If you are NOT using Home WiFi on the Backpack, a new WiFi access point will be available to connect to. Use your PC or tablet etc. to search for and connect to a WiFi network with SSID of
ExpressLRS TX Backpack xxx
(wherexxx
will be part of your UID). The WiFi password isexpresslrs
. Alternatively, if you ARE using Home WiFi on the Backpack, the Backpack will automatically start WiFi and connect to your router. -
Power on the craft, so that the TX and RX have an active link.
-
On your PC or other GCS device, open your GCS software (e.g. Mission Planner) and set the connection type to
UDP
. Click connect, and use the default UDP port of14550
. The GCS should successfully connect to the craft and start downloading params.
Attention!
DO NOT manually put the TX Backpack into WiFi mode via WiFi Connectivity -> Enable Backpack WiFi
. It's not in the steps above for a reason. When you set Telemetry
into WiFi
mode, the backpack automatically starts its WiFi mode, and so, there's no need to manually kick it into WiFi mode.
Implementation Details¶
RC Interleaving¶
When set to MAVLink mode, ELRS changes the allocation of uplink and downlink frame as follows:
- Uplink frames from TX to RX continue to include stick/switch data in the standard ELRS format
-
Uplink frames are opportunistically replaced with MAVLink data from your GCS to your aircraft, which is limited to a maximum of 50% of the link's upstream bandwidth. In general, MAVLink from GCS to the aircraft consumes very little bandwidth, due to it being mainly GCS heartbeats.
-
Downlink telemetry frames from RX to TX are completely replaced by MAVLink data
- Your TX converts the MAVLink telemetry into standard CRSF format which is understood by EdgeTX
Stubborn Sender¶
ELRS uses its stubborn telemetry sender system for MAVLink messages - this system retries packets which weren't delivered, keeping MAVLink link quality high over longer distances and/or with interference.