ADSB# – A simple and cheap ADS-B receiver using RTL-SDR

ADS-B, an acronym for Automatic Dependent Surveillance-Broadcast is a technology that allows tracking aircrafts using high speed radio transmissions. I have never had much interest in this technology until recently. While I was fiddling with this mode with Ian, we discovered a very simple way of demodulating this digital mode using the cheap DVB-T/FM (rtlsdr) dongles. This diagram explains how it works:

Simple ADS-B Demodulator

The final application, ADSB# (read ADSB-Sharp) is released under the MIT license and looks a bit like this:

ADSB#

The executable can be downloaded here. The sources are also available here.
Henry Forte also wrote a nice documentation to get started. You can view it here.
Configure your plotting software to use 127.0.0.1:47806 in AVR format.
I’m working with Osmocom on a C port of this POC application. Check Keen’s git repository.
There’s also another version by Salvatore Sanfilippo that uses the same decoding method developed in the latest versions of adsb#. Have a look on it here. Very promising so far!
More on this later…

Contributors

A lot of users wanted to know who are the brains behind SDR# and instead of letting them speculating I decided to publish the list.
The main application without plugins is the work of two people:

Youssef Touil

  • Initial project setup
  • DSP Core (What processes the radio data and renders audio etc.)
  • The Waterfall and Spectrum Analyzer components
  • GUI logic (What happens when you click/hover a component)
  • Plugin system
  • SoftRock support
  • FUNcube Dongle Pro support
  • RTL-SDR support
  • Quality Assurance

Ian Gilmour (MM6DOS)

  • Many valuable DSP Optimizations
  • Plugin system
  • FUNcube Dongle Pro+ support
  • RFSPACE’s SDR-IQ support
  • Audio/Baseband recorder plugin
  • Quality Assurance

The optional plugins have been contributed by these people:

Tony BenBrahim (K5DEV)

  • Frequency manager plugin

“Acasual”

  • RTL TCP plugin

“BzztPloink” (lazydodo.com)

  • Initial wav recorder code

Automatic IQ Correction Algorithm

SDR# has an original algorithm that compensates gain and phase imbalances between the IQ channels. Without this compensation strong signals are mirrored with respect to the center of the spectrum. All quadrature sampling receivers have their imaging problems. Solutions that were developed in this regard scale from manual adjustment of phase and gain parameters, to much complex mathematical models that find out these parameters by analyzing IQ signals and do some magic. The algorithm I developed is somewhere between these two extremes. Here’s a brief description of how it works:

The algorithm tries to figure out parameters that maximize an objective function (image
rejection utility function, actually). The function simply sums the distances between every FFT bin and its corresponding image. We build that function such that it takes two parameters, phase and gain errors (our target). The return value is a scalar. The nearer the parameters to optimality the higher the return value. The maximum point of this function corresponds to a perfectly balanced signal. Have a look on this plot:
Image rejection

For an ideal transmitted IQ signal:
x_i = cos(2\pi f_m t)
x_i = sin(2\pi f_m t)
The output of QSD/ADC stages subject to imbalances is defined by these equations:
x_i = cos(2\pi f_m t) - sin(2\pi f_m t)(1+\alpha)sin(\phi)
x_q = sin(2\pi f_m t) (1+\alpha) cos(\phi)
We first initialize the alpha and phi parameters with 0. The algorithm then moves by random steps and evaluates the utility function until it reaches (or approaches) the maximum. Only moves that improve the problem are retained. We iterate over many buffers improving the estimation every time. This is a multi-dimensional concave optimization problem. This approach is computationally effective, and often simple to implement. Sometimes, it’s the only way to solve problems when no known/valid analytic model exists.

Here’s a signal from FUNcube Dongle without IQ correction:
Without IQ correction

The same signal with IQ correction activated. Nice image rejection, isn’t it? ;-)
With IQ correction

The source code can be found here.

Notes:

  • This algorithm supposes that the phase and gain errors are constant over the spectrum, which is the case on most sound cards, but not all.
  • I have a few ideas to extend this algorithm to cover phase and gain errors that are dependent on frequency.

Update:
This algorithm and associated code are disclosed for reference only. For commercial usage, contact me at info *at* sdrsharp.com. In either case I’ll be pleased to help you.