# The 1090 Megahertz Riddle (second edition)

A Guide to Decoding Mode S and ADS-B Signals

# Quick Start: hardware and software to receive Mode S signals

Chapter 1 introduced several fundamental concepts about Mode S communication. This chapter focuses on the practical aspects of Mode S data, specifically, how to receive and obtain information that is transmitted in Mode S downlink communications. Mode S signals are transmitted using 1090 megahertz radio waves. Hence, the receiver and antenna have to be designed to work with this frequency. Nowadays, all necessary components required to obtain the Mode S data can be easily made with low-cost off-the-shelf components. Several open-source software tools are available to support the extraction and decoding of data from Mode S signals. In this chapter, we explain how to step up a functional hardware and software system to receive Mode S data.

## Range

Since Mode S uses L band high-frequency signals that follow the line-of-sight propagation, any obstructions between the transmitter and receiver can cause a significant amount of signals to be blocked. Assuming no obstacles between an aircraft and receiver and the transmitter has a sufficient amount of power, the maximum range of the receiver is determined by the curvature of the earth. Figure 1.1 illustrates how the maximum range of the receiver can be obtained.

Knowing the altitude of the receiver antenna, it is possible to determine the maximum range ($$d$$) of a Mode S receiver as:

\begin{aligned} d &= (\alpha_r + \alpha_t) R \\ & = \left( \arccos \frac{R}{R+h_r} + \arccos \frac{R}{R+h_t} \right) R\end{aligned}

where $$R$$ is the radius of the earth, while $$h_t$$ and $$h_r$$ are the height of the aircraft and receiver above the sea level. Using this equation, we can calculate the maximum receiving range for aircraft flying at different altitudes. In Figure 1.2, the maximum range curves calculated using several receiver heights are shown.

It should be noted that this figure shows the maximum radio range due to the curvature of the Earth. However, in real-life applications, Mode S signal follows the Friis transmission model, which states that the maximum distance also depends on the power of the transmitter, as well as the directivities of the transmission and receiving antennas. When considering these factors, the actual radio range for the receiver might be more limited than the theoretical values shown in the previous figure.

## Antenna

A large variety of commercial off-the-shelf antennas can be deployed to receive Mode S signals. In principle, any antenna designed for the radio frequency around 1 GHz can be used for receiving Mode S signals.

However, it is not difficult to design your own antenna. The carrier frequency of Mode S is 1090 MHz, which corresponds to the wavelength of 27.5 centimeters. In order to have an antenna that is tuned to this specific frequency, one can design the antenna simply using a piece of a conductor (metal wire) and a coaxial feeder cable. In Figure 1.3, a few common antenna designs are shown.

The monopole antenna and the dipole antenna both are half-wavelength ($$\lambda/2$$) antennas with a total conductor length of 13.75 cm. The ground plan antenna is a quarter-wavelength ($$\lambda/4$$) antenna, where the main pole is 6.875 cm.

For a remote installation where the antenna is far from the receiver (i.e. long coaxial cable between the antenna and receiver), the high-frequency signal of Mode S can attenuate quickly. When the signal has arrived at the receiver end, the signal to noise ratio can become quite high. To overcome this limitation, an active antenna may be used.

The active antenna (see Figure 1.4) has a low-noise amplifier integrated at the antenna side. Sometimes, it also includes a band-pass filter that is designed for 1090 MHz. The active antenna requires additional powering. Power is commonly supplied through a bias-tee device connected at the receiver end, which is on the left-hand side of the diagram. On the right-hand side, the radio frequency is mixed with the DC component, which allows the electronic circuit to be powered close to the receiver end.

Many modern Mode S receivers are built using software-defined radio (SDR). An SDR usually can be tuned to a wide range of radio frequencies. The user can conveniently select the center frequency of the receiver and the sampling rate, as well as defined the bandwidth of the onboard low-pass filter if it is supported.

For receiving ADS-B (and other types of Mode S message), a RTL-SDR is the most common type of low-cost receiver to choose. Many different brands of RTL-SDR receivers exist; they are often built with the Realtek RTL2832U chipset. It can work with radio frequencies from 24 to 1766 MHz. The maximum sampling rate is 2.8 million samples per second (MSPS). Given that a Mode S bit consists of a pulse cycle of 2 microseconds (see Figure [fig:mode_s_uplink_pulses]), the minimum SDR sampling rate required for Mode S is 2 MSPS. RLT-SDR devices just barely manage to meet this requirement.

Note The maximum frequency range of RTL-SDR can be from 0 to 2220 MHz. However, the sensitivity drops off significantly outside the 24 - 1766 MHz range. The sampling rate can actually go up to a maximum of 3.2 million samples per second, but some samples may be dropped at this sampling rate. Hence, it is not stable.

SDRs that offer a higher performance also exist. They often support a larger frequency range with higher sampling rates. Some offer multiple transmitting (TX) and receiving (RX) channels. In Table 1.1, a few examples of common SDR devices are given. The performance of RTL-SDR is listed as a comparison.

Examples of common software defined radio devices
RTL-SDR AirSpy R2 HackRF 1 LimeSDR BladeRF 2
Frequency (from) 24 MHz 24 MHz 1 MHz 100 KHz 47 MHz
Frequency (to) 1766 MHz 1700 MHz 6000 MHz 3800 MHz 6000 MHz
Max sample rate 2.8 MSPS 10 MSPS 20 MSPS 61.44 MSPS 61.44 MSPS
RX channels 1 1 1 2 2
TX channels 0 1 1 2 2
Open hardware No Partially Full Full Partially

## Software tools

Several software tools are also available to work with some of these SDR devices and decode Mode S and ADS-B signals directly. In this section, we explain how to use two open-source tools, which are dump1090 and pyModeS.

### dump1090

dump1090 is the most well-known open-source Mode S decoder currently available. The software is written in C programming language and was originally developed by Salvatore Sanfilippo 1 under the BSD three clause license.

Since its release in 2013, the repository has been forked and extended intensively on GitHub, creating more than 900 forks so far. Many of the branched versions contain different variations, such as support for additional hardware, additional decoded Mode S messages, and additional output format. Currently, one of the most comprehensive forks is the repository maintained by FlightAware.2 The following examples will be based on the FlightAware version of dump1090, using a Debian based Linux system.

#### Installation of dump1090

The latest version of dump1090 source code can download as follows:

$git checkout https://github.com/flightaware/dump1090.git Before compiling the code, following dependencies must be installed: sudo apt-get install build-essential debhelper librtlsdr-dev \ pkg-config dh-systemd libncurses5-dev libbladerf-dev Next, we can compile the source code as: $ cd dump1090
$make It is worth noting that the FlightAware version of dump1090 supports both RTL-SDR and BladeRF devices by default. #### Default usage of dump1090 Once it is compiled and the RTL-SDR receiver is connected, we can run the following command to start receiving and decoding signals: $ ./dump1090

With the default option, Mode S messages and decoded information are displayed in the terminal. For example:

*8d451dbd9905b5018004005979c5;
CRC: 000000
Score: 1800
Time: 9214131.08us
DF:17 AA:451DBD CA:5 ME:9905B501800400
Extended Squitter Airborne velocity over ground, subsonic (19/1)
Air/Ground:    airborne
Ground track   271.4
Groundspeed:   436.1 kt
Geom rate:     0 ft/min
NACv:          0

#### Raw Mode S messages

If we only want to display the raw messages, the –raw option can be provided, as follows:

$./dump1090 --raw In this case, the terminal output will only contain the raw messages: *5d4074358ad00c; *8d407435990dbd01900484f66c3c; *8d40743558af828cd326fe0c2fe9; *a00015b8c2680030a80000318667; *a80011b1e0da112fe0140060939f; *a00015b8c2680030a80000318667; *5d4074358ad030; *5d4074358ad030; #### Interactive mode dump1090 can also provide a live view of all aircraft seen by the receiver through the use of the –interactive option: $ ./dump1090 --interactive

An example of the terminal output is shown in Figure 1.5.

### pyModeS

pyModeS is an open-source Mode S decoder project that I started in 2015, during my PhD research at TU Delft. It is a library that was originally designed to focus on lower level inference and decoding of individual raw Mode S messages. Many users of pyModeS were researchers or developers who needed a Mode S decoder package in the Python programming language. Later on, hardware support and live decoding were added, which made it more akin to dump1090 of late.

#### Installation of pyModeS

As a Python library, it is possible to install the most recent stable version of pyModeS as:

pip install pyModeS

The latest development version for the GitHub can be installed as:

pip install git+https://github.com/junzis/pyModeS

#### Live traffic view

pyModeS provides the possibility to view live traffic through the modeslive command. The usage of this command is shown as follows:

$modeslive [-h] --source SOURCE [--connect SERVER PORT DATAYPE] [--latlon LAT LON] [--show-uncertainty] [--dumpto DUMPTO] arguments: -h, --help show this help message and exit --source SOURCE Choose data source, "rtlsdr" or "net" --connect SERVER PORT DATATYPE Define server, port and data type. Supported data types are: ['raw', 'beast', 'skysense'] --latlon LAT LON Receiver latitude and longitude, needed for the surface position, default none --show-uncertainty Display uncertainty values, default off --dumpto DUMPTO Folder to dump decoded output, default none When an RTL-SDR device is connected, the following command can be used to display live traffic: $ modeslive --source rtlsdr

Data source can also be supplied through the network (for example, from dump1090 TCP output stream) as:

$dump1090 --net --quiet$ modeslive --source net --connect localhost 30002 raw

An example of the live view is shown in Figure 1.6.

#### Programming interface

Since pyModeS is designed as a low-level development library, its decoding functionalities can be easily accessed in Python. Some examples of accessing pyModeS are shown here.

Core functions that provide access to extract the Downlink Format, ICAO address, ADS-B Type Code, as well as to perform parity check. For example:

import pyModeS as pms

pms.df(msg)         # Downlink Format
pms.icao(msg)       # Infer the ICAO address from the message
pms.crc(msg)        # Perform parity check
pms.typecode(msg)   # Obtain ADS-B message Type Code

ADS-B related functions allow information such as identity, position, and velocities to be decoded. For example:

# position messages
pms.adsb.position(msg_even, msg_odd, t_even, t_odd)

# velocity messages
pms.adsb.velocity(msg)

There are also a large number of functions designed to infer and decode Mode S downlink messages. For example:

# Mode~S DF=4/20 altitude code
pms.common.altcode(msg)

# Mode~S DF=5/21 squwak code
pms.common.idcode(msg)

# Infer the Modes-S BDS code
pms.bds.infer(msg)

# BDS 4,0
pms.commb.selalt40mcp(msg)  # MCP/FCU selected altitude (ft)
pms.commb.selalt40fms(msg)  # FMS selected altitude (ft)
pms.commb.p40baro(msg)      # Barometric pressure (mb)

# BDS 5,0
pms.commb.roll50(msg)       # Roll angle (deg)
pms.commb.trk50(msg)        # True track angle (deg)
pms.commb.gs50(msg)         # Ground speed (kt)
pms.commb.rtrk50(msg)       # Track angle rate (deg/sec)
pms.commb.tas50(msg)        # True airspeed (kt)

# BDS 6,0
pms.commb.hdg60(msg)        # Magnetic heading (deg)
pms.commb.ias60(msg)        # Indicated airspeed (kt)
pms.commb.mach60(msg)       # Mach number (-)
pms.commb.vr60baro(msg)     # Barometric altitude rate (ft/min)
pms.commb.vr60ins(msg)      # Inertial vertical speed (ft/min)

There are several commonly used functions related to Mode S decoding. A complete list of the APIs can be found in the pyModeS library API documentation.

In the rest of this book, most of the decoding details with be explained, which will often reflect the source code from pyModeS.

1. https://github.com/antirez/dump1090↩︎

2. https://github.com/flightaware/dump1090↩︎

Site maintained by @junzis. Build with LaTeX, Pandoc, and GitHub