Tracking planes for $20 or less

My new favourite toy is a cheap $20 USB TV tuner. It’s made to receive DVB-T signals, which aren’t even used in North America. So what use could I possibly have for it?

Back in February, Linux kernel developer Antti Palosaari discovered that certain USB TV tuners can be configured to send the raw, unprocessed radio signal straight to the computer for decoding in software. (They use this mode when tuning FM or DAB radio signals. Think of it as the Winmodem approach to radio.) Palosaari realized that by running the right software, almost any radio signal could be received by these tuners. Not long thereafter, the RTL-SDR project was born, allowing these tuners to be used in Linux.

I should note that receiving (and transmitting) radio signals in software is nothing new. Software-defined radio has been around for years, but the hardware required (such as the Ettus Research USRP has generally been expensive. The availability of a $20 software-defined radio receiver has truly opened up the world of radio to anyone who takes the time to learn.

Since getting my hands on a compatible TV tuner, I’ve been able to listen to police radio, pager networks, garage door openers, air traffic control, and lots more. I recently tweeted that I had succeeded in tracking the aircraft in my area by using my TV tuner as an ADS-B receiver and feeding the output into Google Earth. This caught the interest of a pilot friend of mine, so I thought I’d put together a tutorial for anyone interested in capturing these signals. Although the tutorial is specific to ADS-B, keep in mind that the software tools (and in particular GNU Radio) can be reconfigured to tune in virtually any radio signal.

So let’s get started!

  1. Purchase a USB TV tuner based on the Realtek RTL2832U chip. For best results, choose one that uses the Elonics E4000 tuner, which will let you tune in the widest range of frequencies, from 64 to 1700 MHz. The OsmoSDR site has a list of supported hardware to get you started. I chose the Newsky TV28T tuner, which I purchased from Aliexpress. (I paid 40 USD for two tuners, shipping included.)
  2. If you’re not running it already, download and install Ubuntu Desktop 12.04 LTS. I would recommend using the 64-bit version.
  3. Install all the available Ubuntu software updates using Update Manager and restart.
  4. Download, build and install GNU Radio using the build-gnuradio script. This can be done in a terminal window by running the following commands:

    cd ~
    mkdir build-gnuradio
    cd build-gnuradio/
    wget http://www.sbrac.org/files/build-gnuradio
    chmod a+x ./build-gnuradio
    ./build-gnuradio

    Note that GNU Radio is quite a large piece of software and has a lot of dependencies, so the install process can take a long time.

  5. Download, build and install gr-air-modes. This is the piece of software that knows how to decode the ADS-B signals that many planes transmit. In a terminal window, run the following commands:

    cd ~
    git clone https://github.com/bistromath/gr-air-modes.git
    cd gr-air-modes
    cmake .
    make
    sudo make install
    sudo ldconfig

  6. Plug in your TV tuner, and check whether you can receive ADS-B traffic by running the following in a terminal window:

    uhd_modes.py --rtlsdr

    If it works, you should see output like the following:

    (-42 0.0000000000) Type 11 (all call reply) from c0636c in reply to interrogator 0 with capability level 6
    (-41 0.0000000000) Type 17 BDS0,5 (position report) from c078b2 at (45.199942, -75.541590) at 30050ft
    (-39 0.0000000000) Type 11 (all call reply) from c078b2 in reply to interrogator 0 with capability level 6
    (-39 0.0000000000) Type 17 BDS0,9-1 (track report) from c078b2 with velocity 443kt heading 259 VS 1664
    (-40 0.0000000000) Type 17 BDS0,5 (position report) from c078b2 at (45.199616, -75.544069) at 30075ft
    (-42 0.0000000000) Type 17 BDS0,5 (position report) from c078b2 at (45.199265, -75.546504) at 30100ft

    We’re already seeing some GPS coordinates and altitudes! Press CTRL-C to stop it for now.

    If you don’t see any traffic, try going outside for better reception.

  7. To see the output in a more convenient form, we’ll use Google Earth. Download the 64-bit .deb version from the download page, and open the file to run the installer.
  8. For nicer-looking fonts in Google Earth, install the xfonts-75dpi and xfonts-100dpi packages by running the following in a terminal window:

    sudo apt-get install xfonts-75dpi xfonts-100dpi

    Then log out and log back in so the new fonts will get loaded.

  9. Launch Google Earth.
  10. If Google Earth fails to launch, it may be because it can’t find libGL. (This happened on one of my two laptops.) To fix it, run the following command in a terminal window:

    sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1.2 /usr/lib/libGL.so.1

  11. Run uhd_modes.py again, this time telling it to write its output to a KML file, the format used by Google Earth. In a terminal window, run the following:

    uhd_modes.py --rtlsdr --kml=planes.kml

  12. In Google Earth, select “Network Link” from the “Add” menu. Enter “Planes” in the “Name” field, then click the Browse button next to the “Link” field and choose the “planes.kml” file in the file chooser. Click on the “Refresh” tab and set a time-based refresh to occur periodically with a frequency of 5 seconds. Click “OK”, then zoom in to your location. With any luck, you should see some planes start to appear and move around!
  13. To see more details about a plane, click the “X” that appears on the map. Or go to the “Places” section in the left sidebar and expand “Planes” and “Aircraft locations”.

    Here’s a screenshot of Air Canada flight 839 coming in for a landing at YOW, with several more planes at cruising altitude in the background:

Screenshot of gr-air-modes in Google Earth

I hope you find this tutorial useful, and that you’ll do more exploring with software-defined radio once you’ve succeeded in watching planes!

This entry was posted in Uncategorized. Bookmark the permalink.

25 Responses to Tracking planes for $20 or less

  1. Pingback: Tracking planes for $20 or less | Clayton's Domain | Software Defined Radio Daily | Scoop.it

  2. Tony says:

    Great article. Thanks for writing it. I’m sure I’m not the only one to read and appreciate your directions.

    Cheers

    Tony

    • Spongebob says:

      I also found these instructions to be a great help. Unfortunately I had to get a new computer and re-install everything and the current version of GNU Radio doesn’t work with gr-air. Does anyone know of a work around or windows alternative until gnu radio fixes its issues?

      Thanks,
      Bob

  3. omtinez says:

    This is truly amazing, thanks for sharing!

  4. Risto says:

    Hi,

    Sorry for this newbee question! ;-)
    I have very little linux experience.
    everything works well untill i get to this command:
    “git clone https://github.com/bistromath/gr-air-modes.git
    it prompts me for a username and password on “https://github.com”

    Is there any “anonymous” account i can use? or should i register on github.com?

    /Risto

    • argilo says:

      There should be no need to register with github, since gr-air-modes is a public repository. Can you show me the exact message you get back when you run the command?

  5. Miguelanxo Otero Salgueiro says:

    For those of who tried and failed (like me):

    1.- I used the same newsky receiver from the same store. Arrived on time and worked perfectly. Great bang for the buck!

    2.- The receiver program (uhd_modes.py) is now called modes_rx. Don’t worry for apparently they work in the same fashion (using the same commandline options, too). Install instructions are the same, but you will get a notice when you try to launch the old one.

    3.- I dind’t manage to run Google Earth from the Google-offered .deb package (as recommended). I kept on getting crashes due to missing libCl and libClGL libraries (if you don’t dig too far the error just reads “google earth crashed with signal 11″). Deinstalled the google .deb package and used the google-earth-package metapackage from the ubuntu repository. That worked like a charm (and you get the added benefit of windows-fonts auto installation).

    This is frikin’ amazing :D

  6. Bryan says:

    Very good tutorial. Having a hard time with Google Earth not displaying any of the textures, but everything else worked fine. I installed in on a 2012 Macbook Pro (9,1) and it has been working very well. I watched an airplane fly over my head as I tracked it.

    If I wanted to look more into software defined radio, where would I start? Where would I go to learn how to decode ADS-B signals?

  7. Chris says:

    Thanks for this amazing tutorial. You mentioned that you can use the tuner to receive all kinds of signals. I live in the Washington DC metro area and, as you can imagine, there are a lot of interesting things to listen to around here. How would you use the TV tuner you have to pick up police radio frequencies? Is there a tutorial and/or software for that available online? Any help appreciated. Thanks!

  8. Spencer says:

    Is there a way to filter the responses so that you only see a particular aircraft that is transmitting an AD-B signal? Before you answer this, I assume you must be in range of the particular aircraft for this to work.

    I am looking for a solution that will allow my company to track our fleet anywhere in the country with ADS-B. Anybody have any ideas?

    • argilo says:

      I’m not sure whether gr-air-modes supports filtering, but if not it should be easy to add it in as a feature, or filter its with another program.

      ADS-B signals require line of sight, so they only have a range of a few hundred kilometers. You would need a lot of receivers if you wanted complete coverage of a large geographic area.

      Do airports distribute the ADS-B information they receive? There are lots of flight tracking web sites and apps out there and they must be getting their data from somewhere.

  9. Kevin says:

    Can I ask what type of antenna were you used?

  10. Asterion says:

    I know you’re recommending 64 bit Intel/AMD but what about quad core ARM? (1.7Ghz ARM Cortex-A9 Quad Cores that is)

    http://www.hardkernel.com/renewal_2011/products/prdt_info.php

    If it worked it could be bundled into quite a small appliance. It needn’t include the google earth elements and just provide a service (I can think of a few applications that would fall short of just watching planes for interest sake.

    Cheers,
    A

    • argilo says:

      In my experience, GNU Radio performance on ARM is quite bad. I couldn’t even do something as simple as filtering an audio signal in real time on my Raspberry Pi, so I doubt you’d be able to run gr-air-modes even on a more powerful ARM chip. My guess is that the GNU Radio project’s optimization efforts have focused on x86.

  11. Technoshaman says:

    Thank you for this great tutorial! I got my dongle today, and already got a plane on GoogleEarth (only one, I’m in a pretty isolated house using the crappy antenna) :) I am using the GUI version of the program (modes_gui) which is full of nice features. And I think the program is updated since this article was written. I get this message when I do:

    uhd_modes.py –rtlsdr

    ERROR: uhd_modes.py has been deprecated. The new application name is modes_rx.

    Emrah

    • Brian S says:

      From a post earlier in this thread it was noted that ‘modes_rx’ is the new utility which to type at the command prompt. If you read above the writer states that the same commands for the utility are used.

  12. Joshua says:

    when I got to step 5, it says it is a read only file system.
    does anyone know how to fix it?
    sorry, linux newbie

  13. Clark Westfield says:

    Just wanted to say thanks for a great post – these instructions still hold up exactly, even a year after they were originally posted!

  14. Pingback: What’s Trending For Hackers?

  15. li says:

    my computer is 64bit ,an ubuntu12.04 . Used the build-gnuradio to install . Then I install gr-air-modes,the step cmake run error,like this:
    – Build type not specified: defaulting to release.
    – checking for module ‘gnuradio-core’
    – package ‘gnuradio-core’ not found
    – Could NOT find GRUEL (missing: GRUEL_LIBRARIES GRUEL_INCLUDE_DIRS)
    – checking for module ‘gnuradio-core’
    – package ‘gnuradio-core’ not found
    – Found GNURADIO_CORE: /usr/local/lib
    CMake Error at CMakeLists.txt:76 (message):
    Gruel required to compile gr-air-modes

    – Configuring incomplete, errors occurred!

    Anyone can help? I will appreciate

  16. Clark Westfield says:

    I’m getting the following errors after running “cmake .” (without the quotes) in step 5. Any ideas where I might be going wrong?

    smare@ubuntu:~/gr-air-modes$ cmake .
    -- The CXX compiler identification is GNU
    -- Check for working CXX compiler: /usr/bin/c++
    -- Check for working CXX compiler: /usr/bin/c++ -- works
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Build type not specified: defaulting to release.
    -- Boost version: 1.48.0
    -- Found the following Boost libraries:
    -- date_time
    -- program_options
    -- filesystem
    -- system
    -- thread
    -- checking for module 'gnuradio-core'
    -- package 'gnuradio-core' not found
    -- Could NOT find GRUEL (missing: GRUEL_LIBRARIES GRUEL_INCLUDE_DIRS)
    -- checking for module 'gnuradio-core'
    -- package 'gnuradio-core' not found
    -- Could NOT find GNURADIO_CORE (missing: GNURADIO_CORE_LIBRARIES GNURADIO_CORE_INCLUDE_DIRS)
    CMake Error at CMakeLists.txt:76 (message):
    Gruel required to compile gr-air-modes

    -- Configuring incomplete, errors occurred!

    I ran these exact steps about a year ago and everything worked great! I’m guessing the issue has to be with the build of GNU_Radio in step 4. Any help would be greatly appreciated!

    • Nick Foster says:

      Author here. Reposting after seeing your Reddit post, so other readers get the right info.

      The “master” branch of gr-air-modes remains on Gnuradio 3.6 due to the large number of users still on GR3.6. There’s a “next” branch with lots of new work and GR3.7 compatibility. Just do:

      user@ubuntu:~/gr-air-modes$ git checkout next

      …then build and install as usual. Also note, there’s a GUI app in the next branch (that doesn’t appear in the master branch). Just run “modes_gui” instead of “uhd_modes.py”.

      Eventually I’ll move the next branch into master. Just haven’t done it yet.

      One last thing: Casual Linux users who don’t want to fuss with installing Gnuradio and gr-air-modes and everything else, there’s a prebuilt ISO image here with Ubuntu 12.04, Gnuradio, gr-air-modes, and a bunch of other goodies here:

      http://gnuradio.org/releases/gnuradio/iso/

      Have fun!

  17. Pingback: What's Trending For Hackers? - CISOTech.com

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>