Airplane Tracking Using ADS-B Signals
This example shows you how to track planes by processing Automatic Dependent Surveillance-Broadcast (ADS-B) signals using MATLAB® and Communications Toolbox™. You can either use captured signals or receive signals in real time using the RTL-SDR Radio or ADALM-PLUTO Radio. The example can show the tracked planes on a map, if you have the Mapping Toolbox™.
Required Hardware and Software
To run this example using captured signals, you need the following software:
To receive signals in real time, you also need one of the following SDR devices and the corresponding support package Add-On:
- RTL-SDR radio and the corresponding software Communications Toolbox Support Package for RTL-SDR Radio
- ADALM-PLUTO radio and the corresponding software Communications Toolbox Support Package for ADALM-PLUTO Radio
For a full list of Communications Toolbox supported SDR platforms, refer to Supported Hardware section of Software Defined Radio (SDR) discovery page.
ADS-B is a cooperative surveillance technology for tracking aircraft. This technology enables an aircraft to periodically broadcast its position information (altitude, GPS coordinates, heading, etc.) using the Mode-S signaling scheme.
Mode-S is a type of aviation transponder interrogation mode. When an aircraft receives an interrogation request, it sends back a transponder's squawk code. This is referred to as Mode 3A. Mode-S (Select) is another type of interrogation mode that is designed to help avoid interrogating the transponder too often. More details about Mode-S can be found in [ 1 ]. This mode is widely adopted in Europe and is being phased in for North America.
Mode-S signaling scheme uses squitter messages, which are defined as a non-solicited messages used in aviation radio systems. Mode-S has the following properties:
- Transmit Frequency: 1090 MHz
- Modulation: Pulse Position Modulation
- Data Rate: 1 Mbit/s
- Short Squitter Length: 56 microseconds
- Extended Squitter Length: 112 microseconds
Short squitter messages contain the following information:
- Downlink Format (DF)
- Capability (CA)
- Aircraft ID (Unique 24-bit sequence)
- CRC Checksum
Extended squitter (ADS-B) messages contain all the information in a short squitter and one of these:
- Horizontal and Vertical Velocity
The signal format of Mode-S has a sync pulse that is 8 microseconds long followed by either 56 or 112 microseconds of data as illustrated in the following figure.
Run the Example
Type plutoradioADSBExample in the MATLAB Command Window or click the link to run the example. You need to enter the following information when you run the example:
- Reception duration in seconds,
- Signal source (captured data or RTL-SDR radio or ADALM-PLUTO radio),
- Optional output methods (map and/or text file).
The example shows the information on the detected airplanes in a tabular form as shown in the following figure.
You can also observe the airplanes on a map, if you have a valid license for the Mapping Toolbox.
The following block diagram summarizes the receiver code structure. The processing has four main parts: Signal Source, Physical Layer, Message Parser, and Data Viewer.
This example can use three signal sources:
- ''Captured Signal'': Over-the-air signals written to a file and sourced from a Baseband File Reader object at 2.4 Msps
- ''RTL-SDR Radio'': RTL-SDR radio at 2.4 Msps
- ''ADALM-PLUTO Radio'': ADALM-PLUTO radio at 12 Msps
If you assign ''RTL-SDR'' or ''ADALM-PLUTO'' as the signal source, the example searches your computer for the radio you specified, either an RTL-SDR radio at radio address '0' or an ADALM-PLUTO radio at radio address 'usb:0' and uses it as the signal source.
Here the extended squitter message is 120 micro seconds long, so the signal source is configued to process enough samples to contain 180 extended squitter messages at once, and set SamplesPerFrame of the signal property accordingly. The rest of the algorithm searches for Mode-S packets in this frame of data and outputs all correctly identified packets. This type of processing is defined as batch processing. An alternative approach is to process one extended squitter message at a time. This single packet processing approach incurs 180 times more overhead than the batch processing, while it has 180 times less delay. Since the ADS-B receiver is delay tolerant, batch processing was used.
The baseband samples received from the signal source are processed by the physical (PHY) layer to produce packets that contain the PHY layer header information and raw message bits. The following diagram shows the physical layer structure.
The RTL-SDR radio is capable of using a sampling rate in the range [200e3, 2.8e6] Hz. When RTL-SDR radio is the source, the example uses a sampling rate of 2.4e6 Hz and interpolates by a factor of 5 to a practical sampling rate of 12e6 Hz.
The ADALM-PLUTO radio is capable of using a sampling rate in the range [520e3, 61.44e6] Hz. When the ADALM-PLUTO radio is the source, the example samples the input directly at 12 MHz.
With the data rate of 1 Mbit/s and a practical sampling rate of 12 MHz, there are 12 samples per symbol. The receive processing chain uses the magnitude of the complex symbols.
The packet synchronizer works on subframes of data equivalent to two extended squitter packets, that is, 1440 samples at 12 MHz or 120 micro seconds. This subframe length ensures that a whole extended squitter packet is contained in the subframe. The Packet synchronizer first correlates the received signal with the 8 microsecond preamble and finds the peak value. Then, it validates the synchronization point by checking if it matches the preamble sequence, [1 0 0 0 0 0 1 0 1 0 0 0 0 0 0], where a '1' represents a high value and a '0' represents a low value.
The Mode-S PPM modulation scheme defines two symbols. Each symbol has two chips, where one has a high value and the other has a low value. If the first chip is high followed by low chip, this corresponds to the symbol being a 1. Alternatively, if the first chip is low followed by high chip, then the symbol is 0. The bit parser demodulates the received chips and creates a binary message. The binary message is validated using a CRC checker. The output of bit parser is a vector of Mode-S physical layer header packets that contains the following fields:
- RawBits: Raw message bits
- CRCError: FALSE if CRC checks, TRUE if CRC fails
- Time: Time of reception in seconds from start of receiver
- DF: Downlink format (packet type)
- CA: Capability
The message parser extracts data from the raw bits based on the packet type as described in [ 2 ]. This example can parse short squitter packets and extended squitter packets that contain airborne velocity, identification, and airborne position data.
The data viewer shows the received messages on a graphical user interface (GUI). For each packet type, the number of detected packets, the number of correctly decoded packets, and the packet error rate (PER) is shown. As data is captured, the application lists information decoded from these messages in a tabular form.
You can also launch the map and start text file logging using the GUI.
- Start Logging - Save the captured data in a TXT file. You can use the saved data for post processing.
- Launch Map - Launch the map where the tracked flights can be viewed.
The receiver asks for user input and initializes variables. Then it calls the signal source, physical layer, message parser, and data viewer in a loop. The loop also keeps track of the radio time using the frame duration and lost samples reported by the signal source.
The latency output of the signal source is an indication of when the samples were actually received and can be used to determine how close to real time the receiver is running. A latency value of greater than one indicates that the receiver was not able to process the samples in real time. Latency is reported in terms of the number of frames. It can be between 1 and 128. If latency is greater than 128, then samples are lost.
% Request user input from the command-line for application parameters userInput = helperAdsbUserInput; % Calculate ADS-B system parameters based on the user input [adsbParam,sigSrc] = helperAdsbConfig(userInput); % Create the data viewer object and configure based on user input viewer = helperAdsbViewer('LogFileName', userInput.LogFilename, ... 'SignalSourceType', userInput.SignalSourceType); if userInput.LogData startDataLog(viewer); end if userInput.LaunchMap startMapUpdate(viewer); end % Create message parser object msgParser = helperAdsbRxMsgParser(adsbParam); % Start the viewer and initialize radio time start(viewer) radioTime = 0; % Main loop while radioTime < userInput.Duration % Receive baseband samples (Signal Source) if adsbParam.isSourceRadio if adsbParam.isSourcePlutoSDR [rcv,~,lost] = sigSrc(); late = uint32(0); % undefined else [rcv,~,lost,late] = sigSrc(); end else rcv = sigSrc(); lost = uint32(0); late = uint32(1); end % Process physical layer information (Physical Layer) [pkt,pktCnt] = helperAdsbRxPhy(rcv, radioTime, adsbParam); % Parse message bits (Message Parser) [msg,msgCnt] = msgParser(pkt,pktCnt); % View results packet contents (Data Viewer) update(viewer, msg, msgCnt, lost, late); % Update radio time. If there were lost samples, add those too. radioTime = radioTime + adsbParam.FrameDuration + ... double(lost)/adsbParam.FrontEndSampleRate; end % Stop the viewer and release the signal source stop(viewer) release(sigSrc)
You can explore following functions and System objects for details of the physical layer implementation:
- International Civil Aviation Organization, Annex 10, Volume 4. Surveillance and Collision Avoidance Systems.
- Technical Provisions For Mode S Services and Extended Squitter (Doc 9871)