Drone communications and MAVLink

Separate message, transport and datalink, then experiment with telemetry and SITL step by step

Last updated:

Telemetry equipment and a ground station beside a test drone
AI-generated concept illustration

Separate the three layers of communication

Diagram of three stacked layers: Message (MAVLink) at the top, Transport (serial/UDP/TCP) in the middle and Link (radio/Wi-Fi/cellular) at the bottom, with a marker showing that the Link layer can be swapped without affecting the two layers above

MAVLink defines the format and meaning of messages, while serial/UDP/TCP are transport methods and radio/Wi-Fi/cellular are the connection channels. Changing the network therefore does not guarantee that mission or failsafe behaviour will remain the same.

Specify the system ID, component ID, endpoint, port, baud rate when serial is used, and the required message rates. HEARTBEAT helps show that a system is present, but it does not tell you that the data from every sensor is still fresh.

Measure the data the program actually uses

The data chain from the radio signal to the application, with the tools GNU Radio, Wireshark, pymavlink, MAVProxy and MAVSDK placed at the points where each one works

Start by reading ATTITUDE or position in SITL and record timestamps with units. If you have a packet capture, compare the packet rate with the message rate the application can read; several message types may be in the same traffic.

Tool Suited to
MAVProxy Forwarding, GCS and log analysis
pymavlink Reading/creating messages at the protocol level
MAVSDK High-level telemetry/mission API
Wireshark IP-side packets and timing
GNU Radio Signal/noise/filters in simulation

Link diagram: the drone connects separately to the RC transmitter and to the GCS/telemetry radio, with three points of disconnection: RC loss, telemetry loss and GCS failsafe

Telemetry loss, RC loss and GCS failsafe are different events. Test by stopping forwarding in the simulation and reading the log to see whether the mode changes. Do not assume that every link loss must trigger RTL or should behave the same way.

Signing and data protection

MAVLink2 signing is used to verify message authenticity; it is not encryption of the content. When used over an IP network, data protection methods and access rights must be considered separately from the protocol. Experiments can start with loopback/a local simulator before a radio is available.

Keep evidence so work can be repeated

Keep the topology, firmware/API version, endpoint configuration, packet/application logs and the times the link was cut and restored. When using real radios, frequency/transmit power must be checked according to the equipment and the regulations for the area.

F25: Free-space loss and the received power budget

Variable Meaning and units, input → output Range/source of values
d, f Distance m and frequency Hz (input) Greater than 0; synthetic problem, must be in the far field
c Speed of light m/s (constant) 299792458 in vacuum
Pt, Pr Transmit power at the terminals and received power dBm (input, output) Finite real number; not a dB value
Gt, Gr Antenna gain relative to isotropic dBi (input) Real number; for the same direction and frequency as the problem
Lother Other losses total dB (input) From 0; e.g. cables and connectors, not counting FSPL twice
S Receiver sensitivity dBm (input) Real number; must match the specified mode/data rate
FSPL, M Free-space loss and margin dB (output) Calculated within the model scope; M may be negative

Applied level · Question: assuming the wave travels in free space, how much received power remains? Start from the loss between isotropic antennas according to ITU-R P.525-5 (11/2024), Annex §2.3 equation (5) (P2C01, checked 26 September B.E. 2569 (2026)), then add your own gain and loss budget as follows

FSPL = 20 log10(4πdf/c)

Pr = Pt + Gt + Gr − FSPL − Lother

M = Pr − S

The ratio inside the log is dimensionless because m × Hz ÷ (m/s) cancels out. dBm is a power level referenced to 1 mW, whereas dB is a ratio, so gains/losses can be added to dBm, but two powers in dBm cannot be added directly.

Budget: transmit power 20 dBm, add gains on both sides totalling 4 dB, subtract FSPL of 100.05 dB and other losses of 2 dB, leaving a received power of −78.05 dBm

Example: a synthetic channel

Let d = 1000 m, f = 2400000000 Hz, Pt = 20 dBm, Gt = Gr = 2 dBi, Lother = 2 dB and S = −90 dBm

  1. Substituting, 20 log₁₀(4π × 1000 × 2400000000 / 299792458) = 100.052008 dB
  2. Pr = 20 + 2 + 2 − 100.052008 − 2 = −78.052008 dBm
  3. M = −78.052008 − (−90) = 11.947992 dB, which is a numerical difference within the model

The figure shows the addition and subtraction steps of the budget; it is not a distance-scaled graph. It assumes free space, far field, gain in the direction used and matched polarization, with no obstructions, multipath or interference. A positive margin does not guarantee actual operating range or link quality, and the transmit power figure in the problem is not a radio licensing requirement.

Try it yourself

Change only d to 2000 m and find FSPL, Pr and M. A tolerance of 0.01 in the units of each result is accepted.

Open the F25 answer

FSPL = 106.072608 dB; Pr = −84.072608 dBm; M = 5.927392 dB. Doubling the distance increases the loss by 20 log₁₀2 = 6.020600 dB under the same assumptions.

F27: Data rate and counting lost messages

Variable Meaning and units, input → output Range/source of values
rᵢ Rate of message type i, message/s (input) From 0; measured over the specified period
bᵢ Packet size at the MAVLink layer, byte/message (input) Integer greater than 0; size after serialization including header/checksum/signature
R Bit rate at the MAVLink layer only, bit/s (output) From 0; 1 kbit/s = 1000 bit/s
Nexpected Number sent by the sender in the inspected window, packet (input) Integer greater than 0; sender log of a single channel
Nreceived Number of distinct packets received in that window, packet (input) 0 to Nexpected; wait for the reorder tolerance period before closing the window
Nmissing, loss Number of missing packets and the missing fraction (output) 0 to Nexpected; fraction 0–1, multiply by 100 for %
seq 8-bit MAVLink counter (input) Integer 0–255; the sender/channel and restarts must be known

Applied level · Question: how many bits per second does the data use, and is what is missing from the log real loss or merely late arrival?

R = 8 Σ(rᵢ × bᵢ)

Nmissing = Nexpected − Nreceived; loss = Nmissing / Nexpected

According to MAVLink Packet Serialization, MAVLink 2 Packet Format (P2C02, checked 26 September B.E. 2569 (2026)), a version 2 packet has 12 bytes of overhead before the signature, which adds another 13 bytes when signing is used. The actual payload size may be reduced by trailing-zero truncation, so the size actually transmitted must be counted.

The first row shows a 50-byte packet at 10 messages per second; the next row shows the sequence 254 255 0 2 1 4 and the missing number 3 after waiting for reordering

Example: separating the bandwidth of each layer

A packet with a total size of 50 bytes sent at 10 message/s gives R = 8 × 50 × 10 = 4000 bit/s, or 4 kbit/s, before transport/link overhead. If we additionally assume a 20-byte IPv4 header and an 8-byte UDP header per packet, with no options and no packet aggregation, we get 8 × (50 + 28) × 10 = 6240 bit/s. The transport example is a condition of the problem; Ethernet/Wi-Fi/TLS/retransmission must be counted separately where present, and 6240 is not the wire rate of every system.

For a sender log known to have sent 100 packets and a receiver that received 97 distinct packets after the window closed, loss = (100 − 97)/100 = 0.03 = 3%. This is the loss at the specified logging point; it does not identify RF as the cause.

Scope of seq counting

The counter wrapping 255 → 0 is normal. According to MAVLink Packet Loss Calculation (P2C03, checked 26 September B.E. 2569 (2026)), inference from gaps is valid when all messages from a single channel are seen. Routing that filters messages or merging several channels can lead to wrong inferences; even if the system/component IDs match, the source channel must still be checked.

Assuming packets arrive in order and there is no restart, the gap can be calculated with (seq_now − seq_previous − 1 + 256) mod 256 , but this formula must not be applied directly to reordering, duplicates or losses exceeding one cycle, because the 8-bit number alone cannot distinguish those events. Keep the sender log, an extended sequence, the time boundaries and the policy for waiting for late messages. The next exercise provides sender data to remove the ambiguity.

Try it yourself

Increasing only the rate from 10 to 20 message/s at 50 bytes, how many bit/s are obtained before transport? In another window the sender confirms the sequence 254,255,0,1,2,3,4 and the receiver sees 254,255,0,2,1,4 after waiting fully. How many packets are missing, and what percentage? A tolerance of 0.0001 percentage points is accepted.

Open the F27 answer

8 × 50 × 20 = 8000 bit/s; the sender sent 7 packets and 6 distinct packets were received, so only 1 packet, number 3, is missing: 1/7 × 100 = 14.285714%. Number 1 arriving after 2 is reordering, not additional loss; 255 → 0 is a normal wrap.

Download the synthetic telemetry sequence CSV to work the same problem. Column sender_order is the actual order 1–7, seq_uint8 is the counter, receive_order is the order received after waiting fully (a blank means not received), and window_closed_s is the window-closing time of the problem, not a timestamp from a real device. The whole set is a single sender/channel with no restarts or duplicates.

Try the data rate and loss calculator , choosing the byte scope to match the problem, and continue with data age and MQTT queues to separate completeness from freshness of data

Further reading and references

This content was compiled from documents kindly provided by DTI and the references above. Numerical examples are cases for learning purposes. Read theacknowledgements and content sources

Download the applied formula practice pack (CSV/JSON with answers) · Synthetic data for calculation practice and unit checking

Experiment with telemetry load and incomplete reception rate

Calculations run in the browser without sending data off your machine. Change one value at a time and compare with the formulas in the lesson.

Byte counts must include the overhead of the layer being measured, and link capacity must refer to the same layer. A utilization below 100% does not guarantee link quality. The incomplete reception rate uses a packet set known to be expected, after waiting for reordering and removing duplicates; do not use sequence gaps to conclude RF loss directly.

Example: (50 × 10 + 100 × 2) × 8 = 5,600 bit/s; compared with 20,000 bit/s this gives 28%. Incomplete reception (100 − 95)/100 = 5%. These two values measure different things and are not inferred from each other.

Used in courses

How to cite this page

Drone Institute, Rangsit University. (2026). Drone communications and MAVLink. In UAS Technology Knowledge Hub (B.Tech.). https://rsu-uat.pk-research.work/en/kb/knowledge/communications/

Original from Drone-Hub: https://drone.pk-research.work/knowledge/communications/ · © PK-Research