Tracking Aircraft Using An RTL-SDR And Dump1090

After installing the RTL-SDR on my Clockwork uConsole (running a Raspberry Pi CM4) I was looking for something to try out the device to see what it could do. The GNU Radio Companion is still a bit baffling at the moment so I was searching for something with a lower barrier to entry.

One thing that caught my eye was a project on GitHub called dump1090. This is a "Mode S" decoder that uses the RTL-SDR to decode transponder information from Aircraft. Whilst the package is quite old now, it is still being minimally maintained. The dependencies are quite small and so it tends to compiles quite nicely without too many additional packages or issues, event on the limited hardware of the CM4.

In this article we will go through compiling the dump1090 command from source, and then using the command to track aircraft movements.

Installing Dependencies

Assuming you have followed my guide on installing RTL-SDR on a Raspberry Pi you will have all of the dependencies you need to proceed here. You can make sure that everything is installed with the following command.

sudo apt-get install git cmake libusb-1.0-0-dev build-essential

Note that you only need to git if you are cloning the repository into a local file, you can easily just download the repo in a zip format and proceed from there. Also, you may need to install a package called "pkg-config", as well, it depends if you see any errors during the compile time regarding the pkg-config package.

If you are using git then you can download the package, move into the directory you just created and compile the tool using "make".

$ git clone https://github.com/antirez/dump1090.git
$ cd dump1090
$ make

All being well, you should now have an executable file called dump1090. You can test that everything is working with this file by running it with the --help flag.

./dump1090 --help
--device-index <index>   Select RTL device (default: 0).
--gain <db>              Set gain (default: max gain. Use -100 for auto-gain).
--enable-agc             Enable the Automatic Gain Control (default: off).
--freq <hz>              Set frequency (default: 1090 Mhz).
--ifile <filename>       Read data from file (use '-' for stdin).
--loop                   With --ifile, read the same file in a loop.
--interactive            Interactive mode refreshing data on screen.
--interactive-rows <num> Max number of rows in interactive mode (default: 15).
--interactive-ttl <sec>  Remove from list if idle for <sec> (default: 60).
--raw                    Show only messages hex values.
--net                    Enable networking.
--net-only               Enable just networking, no RTL device or file used.
--net-ro-port <port>     TCP listening port for raw output (default: 30002).
--net-ri-port <port>     TCP listening port for raw input (default: 30001).
--net-http-port <port>   HTTP server port (default: 8080).
--net-sbs-port <port>    TCP listening port for BaseStation format output (default: 30003).
--no-fix                 Disable single-bits error correction using CRC.
--no-crc-check           Disable messages with broken CRC (discouraged).
--aggressive             More CPU for more messages (two bits fixes, ...).
--stats                  With --ifile print stats at exit. No other output.
--onlyaddr               Show only ICAO addresses (testing purposes).
--metric                 Use metric units (meters, km/h, ...).
--snip <level>           Strip IQ file removing samples < level.
--debug <flags>          Debug mode (verbose), see README for details.
--help                   Show this help.
Debug mode flags: d = Log frames decoded with errors
                  D = Log frames decoded with zero errors
                  c = Log frames with bad CRC
                  C = Log frames with good CRC
                  p = Log frames with bad preamble
                  n = Log network debugging info
                  j = Log frames to frames.js, loadable by debug.html.

There's a lot of options here, but the simplest thing we can do it using the "--interactive" flag to start up the SDR and print the results to the terminal

./dump1090 --interactive

With this running you should see output that looks a little like this.

Hex    Flight   Altitude  Speed   Lat       Lon       Track  Messages Seen   .
--------------------------------------------------------------------------------
407e31          14000     238     52.979    -2.359    312   10        32 sec
407fcc BAW9SW   38225     452     53.188    -2.433    153   79        22 sec
4ca643 RYR4UP   36000     496     53.272    -2.898    14    157       48 sec
4bc882          8000      324     53.394    -2.441    351   177       4 sec
39cf08 AFR630   36000     438     53.204    -2.006    306   259       54 sec
400a7c SHT3R    18050     354     53.047    -2.098    150   867       2 sec

At the time of copying this text I could see six planes, with a couple of them being unregistered flights. This does show that planes are being picked up by the SDR correctly.

Those flight numbers can be looked up for for more information. For example, flight BAW9SW is a British Airways flight between San Diego and London. The flight was heading past my location north to south on its way to London, which is who I was able to pick it up here. The long lat coordinates 53.188, -2.433 are around 25 miles away from where I am now. Very impressive considering I'm using a small USB device and a desktop aerial to pick up the transmission.

Most of the time I only get one or two planes, and it was really be coincidence that I saw six planes appear on the display. I'm sure I could track more planes here using a bigger aerial, or perhaps just moving closer to the plane routes. I live quite far from any airport and most air routes don't head directly over me.

This is very impressive, but we can get it a step further with the "--net" flag.

The Net Flag

One neat little feature of dump1090 is that it has a web server built in, which means that you can see the information on a map. This can be enabled by using the "--net" flag. You can run this with the --interactive flag as well to get dual readouts.

./dump1090 --interactive --net

This will run the same list as before, but you can now open a web browser and visit the address http://localhost:8080 to see a web page showing the location of the named flights on a map. Here is a screenshot of my desktop with the interactive mode running and the web page in the background.

A screenshot of dump1090 running and the map running behind.

To view more information about a flight you just need to click on the plane icon on the map.

Since this map is powered by leaflet.js and using OpenLayers the map is free to use. In case you are wondering, no, this map isn't centered over my current position.

If port 8080 isn't available (which might be the case on some systems) then you can change this to be a different port using the "--net-http-port" flag.

./dump1090 --interactive --net --net-http-port 9001

You can now see the map running on the address http://localhost:9001.

The map view isn't the best view, I often find that it opens the map far away from where the actual planes are, plus, clicking on the planes can be a bit of a pain and normally takes a few attempts. What's interesting about the map feature is that it just polls an internal API at the address /data.json, which returns a JSON payload of the plane information. This means that you can use pretty much any web based service you want to pull the information and either save it to disk or generate your own fancy maps.

Conclusion

I noted at the beginning of this article that the antirez/dump1090 package is quite old. For the record, I did try to download and compile a number of forks of this repo, but they either failed to compile correctly, had too many dependencies on packages I couldn't install, or had little to no interface to view the results. The old antirez/dump1090 package does the job of tracking aircraft transponder codes quite nicely, and is quite beginner friendly.

The package I used here points at a fork from MalcomRobb, but I was unable to get that to compile correctly. There appears to be a few issues with the code that need a bit of hand editing of C files to get working. Fine if you want the challenge, but not beginner friendly.

From what I have read, the dump1090 version from FlightAware is probably the most cutting edge version of this tool. Although it does come with a fancy mapping tool that integrates with flight lookup services, it doesn't come with a web server built in and so you need to configure your own host to allow that.

The dump1090 tool was quite easy to compile and get running on the Raspberry Pi running a version of Ubuntu in my case. In fact, it's no more difficult to get running than getting the RTL-SDR drivers installed on the system. The RTL-SDR dongle is quite cheap (currently £40 on TechnoFix UK) and is well worth getting as it opens up a few different projects, least of which is aircraft tracking with dump1090.

Add new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
5 + 0 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.