pointless shenanigans & quasi-poetic musings

Tracking Airplanes with a Raspberry Pi On The Cheap

Editor’s note: This article originally appeared as a blog post in July of 2020 – it has since been converted to a more permanent article.

This is one of those projects I’ve wanted to get off the ground1 for a while and never got around to doing. I’ve got lots of time on my hands nowadays, so let’s get right down to it:

Using just about any Linux computer (a Raspberry Pi works great) and a $30 USB TV receiver, you can track the airplanes that are flying near your house.

An Extremely Brief Explanation of RTL-SDR

DVB-T is a standard that defines the method of digitally broadcasting TV signals used in Europe, much of Africa, and several other countries not named America.2 Due to an extremely happy accident, one particular chipset used in some small USB-based DVB-T tuners can also be used to pick up signals from across a wide number of frequencies, and output the data in a raw stream that a computer can make sense of easily. As of writing, using an RTL-SDR USB stick is the cheapest way to start tinkering around with Software-Defined Radio, or indeed any kind of advanced radio tinkering. Since these dongles are so cheap, if you don’t already have a Pi lying around, this whole project can be completed for under $100.

An Equally Brief Explanation of ADS-B

In addition to using radar to track airplanes, many national aviation authorities are now using Automatic dependent surveillance-broadcast to improve navigational/control services. An ADS-B equipped plane broadcasts its own position and speed (derived from onboard instruments and an onboard GPS tracker), in addition to its callsign and registration number. This data is received by air traffic controllers, but can also be received by other airplanes (to show local traffic on a cockpit display), or by enthusiasts who don’t mind setting an antenna and receiver up.

ADS-B transmissions are broadcast at 1090 MHz around the world by most planes as of 2020. In the United States, general aviation aircraft can alternately broadcast at 978 MHz. RTL-SDR receivers can also pick these transmissions up, although not simultaneously on the same receiver – if you want to pick up GA planes on 978 MHz, it’ll require another tuner and some slightly different configuration. This post only covers 1090 MHz operation.

Many countries around the world require aircraft to be ADS-B equipped, so no matter where you live, you should be able to pick broadcasts up from nearby planes.

Hardware Requirements

There’s only two things to buy here:

  • A Raspberry Pi (or any Linux-capable computer you can leave running 24/7)
  • An RTL-SDR compatible DVB-T tuner and antenna

Which Pi?

Running the software needed for ADS-B isn’t resource-intensive, so a Raspberry Pi 3B (or even the 1GB 4B) is more than sufficient. I’m using a 3B and it typically peaks at using 25% of CPU, while RAM usage rarely breaks over 130MB.

If you’ve never used a Raspberry Pi before, there is some assembly required. At minimum, “buying a Pi” really means buying the following:

  • Raspberry Pi board itself ($35)
  • Power supply ($5 or so)
  • MicroSD card
  • A case (optional, $5 to $20 depending on how fancy)3

What Tuner?

The RTL-SDR site sells compatible DVB-T USB sticks, including a bundle with a small antenna to get started with. There are others available, like this one that I bought. This isn’t an endorsement of either one, and you should see similar results no matter what RTL-SDR tuner you end up with. You can also start going down the radio rabbit hole of improved tuners, building an antenna, filtering the signal in some way if necessary, etc. – although extremely fun, it’s not at all required to get started. You may also be interested in the other ways you can use an RTL-SDR – if you’re thinking about leaving the ADS-B receiver running full time, consider buying another tuner for that purpose so you can leave the ADS-B one running undisturbed.4

How To Start

Okay, that’s enough background, it’s time for the fun part.

Preparing the Pi

The Raspberry Pi should be running Raspbian, a special version of Debian Linux made specifically for a Pi. I’d recommend using the lite/headless version, since the Pi will be running 24/7 without a monitor attached. All of the configuration can be done over SSH. To that end, after writing Raspbian, follow these official guides to enable SSH from the start and let it connect directly to a wireless5 network:

After the Pi is set up and ready to go, SSH in and connect the RTL-SDR tuner.

Installing Software

There are quite a few guides out there for setting an ADS-B recevier up, and I made heavy use of this particular one to get started. There’ve been a few changes since that one was written, though.

The most important program involved in this process is dump1090, which receives the output from an RTL-SDR device on 1090 MHz and decodes the ADS-B transmissions. All the other software simply reads the data output from dump1090. As of publication, the most up-to-date version is maintained by FlightAware.

1: Install librtlsdr0

The RTL-SDR drivers are available from Debian repositories by default:

sudo apt-get isntall librtlsdr0

After this, download these udev rules so non-root users can access the tuner:

sudo wget -O /etc/udev/rules.d/99-rtl-sdr.rules https://raw.githubusercontent.com/osmocom/rtl-sdr/master/rtl-sdr.rules
2: Install dump1090

Grab the latest release of dump1090-fa from FlightAware’s GitHub repo and extract it. Follow the build instructions, reproduced here:

# Install required packages for build
sudo apt-get install build-essential debhelper librtlsdr-dev pkg-config dh-systemd libncurses5-dev libbladerf-dev lighttpd
# Package the program for installation
dpkg-buildpackage -b
# Install the newly-made package and reboot
dpkg -i ../dpkg -i dump1090-fa_3.8.1_armhf.deb
sudo reboot

Confirm that dump1090 is working:

  • Check the systemd service: systemctl status dump1090-fa
  • View the raw SBS-format output: nc localhost 30003

The package installer should have also configured lighttpd to display a web interface – if it doesn’t, move the configuration files from dump1090-xxx/debian/lighttpd to /etc/lighttpd/conf-available and enable them. We’ll check in on that web interface later.

3: Install Feeders

Once dump1090 is up and running, we can install the software needed to feed the data into other online services. I’m feeding the following sites (links to install instructions):

Both flightradar24 and FlightAware offer a free premium membership for as long as you continue to feed ADS-B data, which is a nice little perk. You should also be able to see a local view of your receiver’s data by opening a web browser and going to http://<ip_address>:8080 from another computer on the same network. The FlightAware fork of dump1090 features a web interface branded by them, but functions otherwise identically to older dump1090 installations.

Wrapping Things Up

What’s the point of all this? If you live somewhere without heavy ADS-B coverage, it can help improve tracking data. Even if your area is well-covered, it’s a fun way to dip your toes into software-defined radio. You may need to experiment with antenna placement for best results – generally speaking, an antenna placed in a window is going to fare better than one placed far inside the house.

  1. Pun intended. ↩︎

  2. North America uses ATSC, because the United States is bad at just using international standards and we prefer to invent our own. As such, you won’t be able to use the DVB-T stick to actually receive TV signals if you’re in North America. ↩︎

  3. I like to use a case, it makes the whole thing look nicer and there’s less risk of damaging the Pi in some way. ↩︎

  4. Naturally, this is exactly what I did. ↩︎

  5. Using WiFi instead of a wired connection may cause radio interference. If you have the ability to connect the Pi using an Ethernet cable, it is usually the recommended option. Having said that, I’ve been running mine over WiFi for a couple of months now without any issues. ↩︎