Laurens Boekhorst – 7 March 2016
796 words in about 4 minutes

There are various places where you can obtain a prebuilt flight tracker and upload your data to one of the established flight tracking services, but where is the fun in that? You can build one with your own hardware, almost from scratch! All you need is a digital television receiver and Linux.

Introduction

Automatic Dependent Surveillance Broadcast, or ADS-B for short, is a data link system that is slated to replace radar as the primary surveillance method for controlling aircraft worldwide. It periodically broadcasts information such as identification, satellite position and velocity through an onboard transmitter that is more accurate than radar-based systems. The most common transmitters operate at a frequency of 1090 MHz. For aviation enthusiasts, this is great news, because it means these transmissions can be captured using a cheap, off the shelf, digital television receiver!

Prerequisites

To get this going, we need some hardware. Most importantly, we need a digital television receiver, more commonly known as a DVB-T receiver. It doesn’t really matter which brand, as long as it contains an RTL2832U demodulator and a USB interface. Other hardware is not supported by the capture software. I have connected the receiver to a Raspberry Pi 2 Model B running Raspbian Jessie Lite, but you should be able to connect the receiver to any machine running Linux and have it supported out of the box.

The next step is to get some plumbing out of the way. We will not be demodulating the actual radio signals from the receiver ourselves. This task is best left up to dump1090, a robust demodulator with the ability to send captured messages in hexadecimal format across the network. It requires the librtlsdr and libusb development headers to be installed from your system’s repository, so be sure to install these first. You can then install dump1090 with:

1
2
3
4
git clone https://github.com/antirez/dump1090.git
cd dump1090/
make
sudo mv dump1090 /usr/local/bin/

After it has been installed, run it with:

1
dump1090 --net

If there is traffic in your area, and the antenna is appropriately placed, it should not be long before you start seeing transmissions logged in your terminal. If you do, you are good to go!

Installation

Our flight tracker is composed of three separate components. At the very bottom of the technology stack is the physical receiver and the decoder. At the very top is the web application that visualizes the air traffic in your area. Tying these two together is the multilink gateway service, which is responsible for facilitating communication between these two components by means of a web socket. We will first install the multilink gateway service, move on to the receiver, and finally get the web application up and running.

The multilink gateway service is a Phoenix application and for the purpose of this article I assume that you already have it installed. If you do not, refer to http://www.phoenixframework.org/docs/installation for instructions on installing Phoenix. Let’s now clone the repository and install its dependencies:

1
2
3
git clone https://github.com/lboekhorst/gateway.git
cd mgs
mix deps.get

Now that the dependencies are installed, you can run the multilink gateway service with:

1
mix phoenix.server

This will run the multilink gateway service in a development environment and expose a web socket for our receiver to connect to.

Decoder

The decoder is a Ruby 2.0+ application and as such requires Ruby to be installed on your system. In this case, I am also assuming that you already have. The decoder has been published as a gem and can be installed with:

1
gem install adsb-cli

After it has been installed, you can run it with:

1
adsb --gateway ws://localhost/socket/websocket

If you have your prerequisites set up properly, it should not be long before you see messages being passed on to the multilink gateway service.

Front-end

The front end is simply a collection of static HTML, JavaScript, and CSS that can be hosted from anywhere, but in order to build the application you are required to have Node and Bower installed. Again, I am assuming that you already have. Let’s clone the repository install its dependencies:

1
2
3
4
git clone https://github.com/lboekhorst/atis.git
cd atis
npm install
bower install

After the dependencies have been installed, you can run the front end with:

1
GATEWAY=ws://localhost/socket/websocket gulp serve

Open up your browser and navigate to your local host. You should see a map opening up, and if you have the multilink gateway service and decoder properly in place, it should not be long before you see aircraft showing up on the map!

Wrap-up

Over the course of this article we have configured our hardware and installed all of the software we need to start tracking flights. Next time, we’ll take a look at the architecture of the system and go a little further in-depth in terms of technology.

Laurens Boekhorst

Consultant • JavaScript, Ruby • github.com/lboekhorstlinkedin.com/in/lboekhorst • Private pilot