MAVLink (Micro Air Vehicle Link) is a lightweight binary messaging protocol that carries telemetry, commands, missions and parameters between an unmanned vehicle and the software around it. In drone software & autonomy it is the common language of open autopilots such as ArduPilot and PX4, of ground control stations such as Mission Planner and QGroundControl, and of companion computers that run autonomous behaviors.
The protocol was first released in 2009 and is now maintained as an open project within the Dronecode ecosystem. It is deliberately simple: messages are defined in XML files, turned into source code by a generator, and exchanged as compact packets over almost any link, from a 57,600 baud telemetry radio to a UDP socket on a flight-test laptop.
How MAVLink packets are built
A MAVLink packet is a small, self-delimiting frame that wraps one message with addressing and integrity data. Each frame starts with a magic start byte, carries the sender’s system ID and component ID, a sequence number for detecting lost packets, a message ID and a 16-bit checksum.
The checksum is not computed over the bytes alone. Each message definition contributes a CRC_EXTRA seed derived from its field layout, so two endpoints that were built from mismatched XML definitions reject each other’s packets instead of silently misreading them. This guard is the most common reason a new custom message appears to vanish on the receiving side.
The following table compares the two protocol versions found in the field today.
| Property | MAVLink 1 | MAVLink 2 |
|---|---|---|
| Start byte | 0xFE | 0xFD |
| Header and checksum overhead | 8 bytes | 12 bytes |
| Message ID range | 0 to 255 | Up to about 16.7 million (24 bits) |
| Maximum payload | 255 bytes | 255 bytes, with trailing zero truncation |
| Extension fields | Not supported | Supported without breaking old receivers |
| Packet signing | Not available | Optional 13-byte signature |
MAVLink 2 is the current default in both major autopilot stacks. Its payload truncation drops trailing zero bytes before transmission, which offsets much of the larger header on slow radio links.
Message sets and microservices
MAVLink content is organized into dialects, which are XML files that list messages and enumerations. The common.xml dialect holds messages that every compliant system should understand, while files such as ardupilotmega.xml add autopilot-specific extensions. Code generators such as mavgen produce libraries in C, Python, C++, Java and other languages.
Higher-level behavior is defined as microservices, which are small conversations built from several messages with defined handshakes, retries and acknowledgments. The table lists the microservices that matter most in daily operations.
| Microservice | Key messages | Purpose |
|---|---|---|
| Heartbeat | HEARTBEAT | Announces presence, vehicle type and mode, usually at 1 Hz |
| Mission protocol | MISSION_COUNT, MISSION_ITEM_INT, MISSION_ACK | Uploads and downloads waypoint missions, fences and rally points |
| Parameter protocol | PARAM_REQUEST_LIST, PARAM_VALUE, PARAM_SET | Reads and changes autopilot configuration values |
| Command protocol | COMMAND_LONG, COMMAND_INT, COMMAND_ACK | Arms, takes off, changes mode, triggers cameras |
| File transfer protocol | FILE_TRANSFER_PROTOCOL | Moves logs and parameter files over the link |
| Offboard setpoints | SET_POSITION_TARGET_LOCAL_NED | Lets a companion computer steer the vehicle |
Telemetry streams such as ATTITUDE, GLOBAL_POSITION_INT and SYS_STATUS are sent periodically. A ground station requests the rate of each stream with the MAV_CMD_SET_MESSAGE_INTERVAL command, which replaced the older and coarser data stream requests.
Addressing, routing and transports
Every MAVLink node has a system ID from 1 to 255 that identifies the vehicle or station, and a component ID that identifies a part of it, such as the autopilot, a camera or a gimbal. Ground control stations conventionally use system ID 255, and each vehicle in a fleet needs a unique system ID to avoid confused telemetry.
Because MAVLink is transport-agnostic, routers such as mavlink-router or MAVProxy forward packets between serial ports and network endpoints. The autopilot itself also routes messages between its links, so a camera on one serial port can be commanded from a ground station on another.
The following table shows typical transports and where each is used.
| Transport | Typical setting | Typical use |
|---|---|---|
| Serial telemetry radio | 57,600 baud, 433 or 915 MHz | Long-range link to a ground station |
| Companion computer UART | 921,600 baud | High-rate data to onboard computers |
| UDP | Port 14550 for ground stations | Simulation, Wi-Fi and cellular links |
| TCP | Configurable port | Reliable links to tools and log servers |
| USB | Virtual serial port | Bench configuration and firmware setup |
MAVLink compared with related interfaces
MAVLink is a wire protocol, not an application programming interface, which is why several layers are built on top of it. MAVSDK wraps MAVLink in a high-level API for missions and offboard control, while MAVROS bridges MAVLink to the Robot Operating System. Proprietary ecosystems take another path: the DJI Mobile SDK exposes vehicle functions through a closed vendor interface instead of an open protocol.
| Interface | Layer | Main audience |
|---|---|---|
| MAVLink | Binary wire protocol | Autopilot and ground station developers |
| MAVSDK | High-level library over MAVLink | Application and integration developers |
| MAVROS | ROS bridge over MAVLink | Robotics and research teams |
| DJI Mobile SDK | Proprietary vendor API | Apps for DJI aircraft |
Inside the onboard flight software, PX4 uses its own uORB publish and subscribe bus for internal data. MAVLink is used only at the boundary of the vehicle, where messages leave for the ground station, payloads or a companion computer.
Security limits and common integration mistakes
MAVLink provides no encryption. Any receiver on the same frequency or network can read telemetry, and without protection any sender can inject commands. MAVLink 2 signing adds authentication with a 32-byte shared secret key, a timestamp and a truncated SHA-256 signature, which blocks spoofed and replayed packets but does not hide content.
Operators who need confidentiality therefore run MAVLink inside an encrypted transport, such as a VPN over a cellular modem or an encrypted radio. Signing also requires careful key distribution, because a vehicle that rejects unsigned packets cannot be reached by a ground station with a missing or wrong key.
The table summarizes problems that integrators meet most often.
| Symptom | Likely cause | Fix |
|---|---|---|
| Custom message never arrives | CRC_EXTRA mismatch from different XML files | Regenerate code on both ends from one dialect |
| Two vehicles appear as one | Duplicate system IDs | Assign a unique ID to every vehicle |
| Telemetry lags or drops | Stream rates exceed link bandwidth | Lower message intervals on slow radios |
| Commands ignored | Wrong target system or component | Check addressing and COMMAND_ACK results |
| Unknown sender takes control | Unsigned link exposed to a network | Enable signing and an encrypted transport |
A plain-language summary
MAVLink is the shared language that a drone and its controllers speak. The drone keeps reporting short status notes, such as where it is, how fast it moves and how full its battery is. The pilot’s software answers with short instructions, such as take off, fly to this point or come home.
Think of it as a standard set of postcards with fixed boxes to fill in. Because everyone uses the same postcards, a drone built by one team can talk to planning software written by another. The main caution is that these postcards are readable by anyone listening unless extra protection is added.
An example from practice
A survey company flies a PX4-based quadcopter over a quarry. A SiK telemetry radio at 57,600 baud links the aircraft to QGroundControl on a field laptop, while a small companion computer on the drone talks to the autopilot over a 921,600 baud serial link. Both connections carry MAVLink, and mavlink-router on the companion computer merges them.
Before takeoff, the operator uploads a 42-waypoint mission with the mission protocol, and the ground station confirms each item with an acknowledgment. During flight, the companion computer reads GLOBAL_POSITION_INT at 10 Hz to geotag images and sends a camera trigger command at each survey line.
When a second drone joins later in the day, the team gives it system ID 2 and enables signing on both aircraft. The result is two vehicles monitored from one screen, with no confused telemetry and no accepted commands from unknown senders.