Airplane tracking with RTL-SDR

Before diving into some of the more challenging and arcane "upper atmosphere" options to use RTL-SDR, we will do a recipe that's a little easier and more down to Earth, namely tracking planes.

This recipe is derived from a variety of sources, including David Scheltema's tutorial on Make Magazine (http://makezine.com/projects/tracking-planes-with-rtl-sdr/), which is a Debian variation on an RPi version. It also comes via the posts of David Taylor of Edinburgh, Scotland (satsignal.eu/raspberry-pi/dump1090.html) and Drew Fustini of Chicago, Illinois (element14.com/community/community/designcenter/single-board-computers/blog/2014/04/07/sdr-and-sbc-cheap-thrills-with-radio-waves) for Angstrom on the BBB. Additionally, Adafruit has a lesson for the RPi, which either borrows from or is inspired by the references mentioned before. All of these miss some steps, however, to make it fly on the current BeagleBone Black Debian distros, be it Wheezy or Jessie.

Getting ready

Here are the materials needed:

  • The RTL-SDR dongle.
  • An antenna—You could spend hundreds of dollars on this part of your kit. However, there are numerous low-cost and plenty powerful antennas that will get you a good signal for all of our recipes. Here, we use a Diamond antenna (http://www.aesham.com/glass/magnet/diamond-antenna-mr-75s/), and it only costs USD $38.00.
  • An antenna adapter—If you use an antenna other than the small one that often comes with the dongle, such as the one mentioned before, you will need to buy a separate adapter. Don't worry! They're cheap, too, and ours was only about USD $6.00 (http://amzn.to/1WoB7Lq).
  • Powered USB.
  • Ethernet or Wi-Fi connectivity.

How to do it…

Perform the following steps:

  1. Attach the antenna to the RTL-SDR dongle via the USML adapter.
  2. Power your BBB via a 5V power supply, plug the SDR dongle directly into the USB port, and connect via Ethernet.
  3. Always ensure that your packages are up to date; let's upgrade them here using the following command:
    $ sudo apt-get update && sudo apt-get upgrade
    
  4. Check that the dongle is recognized with this command:
    $ lsusb
    

    The output should look similar to this, with the Realtek SDR dongle appearing:

    Bus 001 Device 002: ID 0bda:2838 Realtek Semiconductor Corp. RTL2838 DVB-T
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    
  5. Log in as root with this command:
    # sudo -i
    
  6. As we will create a stripped-down firmware toolset for RTL-SDR here, we need to compile software from source files. We first need to install cmake, a tool that we came across in an earlier chapter. As a reminder, cmake is an alternative method to build packages and can be installed as follows:
    # apt-get install cmake
    
  7. Then, install the USB library for RTL-SDR, as follows:
    # apt-get install libusb-1.0-0-dev
    
  8. Next, we will grab the RTL-SDR library and configure and compile it with make. The last command here will take a few minutes to complete:
    # git clone git://git.osmocom.org/rtl-sdr.git
    # cd rtl-sdr
    # cmake ./ -DINSTALL_UDEV_RULES=ON
    # make
    
  9. Now, install it with the following command:
    # make install
    
  10. Head back up to the root directory, where we need to bring the aircraft scanner-specific package on board. This requires another series of downloading, setting up, and installing ingredients, which goes as follows:
    # cd
    # git clone https://github.com/antirez/dump1090.git
    # cd dump1090
    # make
    
  11. Configure the path for the shared libraries:
    # echo "/usr/local/lib/" >> /etc/ld.so.conf
    
  12. Let's run a test, ensuring that we are in the dump1090 directory:
    # cd /home/debian/dump1090
    # ./dump1090
    

    If your RTL dongle/scanner is operating as it should, the command will begin quickly dumping any nearby aircraft to standard output. If you use the small antenna that came with your dongle, its range will be very limited. Press Ctrl + C to interrupt the command.

  13. The last step is to put this galloping data in an easier-to-read format. In the terminal window, paste the following command:
    $ ./dump1090 --interactive --net --net-http-port 8081
    

    This last command and its options tell dump1090 to begin outputting data in a more viewable form. One version of this output is immediately visible in your terminal window, with the data refreshed continuously and sorted into tidy columns by flight number, altitude, speed of aircraft, latitude, and so on.

    Even more interesting is the --net-http-port 8081 option, which sends the data via HTTP to a specified port—in this case, the 8081 port. With this option enabled, we can open a browser and access a web page with some JavaScript, and the Google Map API is available as part of the installed package.

  14. So, open a browser and paste the following address into the window using one of the following:

    http://beaglebone.local:8081/

    http://192.168.7.2:8081/

    http://your_bbb_ip:8081/

    You will immediately see a Google Map along with a sidebar window showing a rollup of the data. Move the map around until it is positioned at your current location, and you should see plane icons appearing. Clicking on an icon pulls this particular flight's data into the frame.

    Watch the icons closely to see what kind of general range your receiver and antenna are getting before the aircraft disappears from the screen.

  15. To quit the program, type Ctrl + C in the BBB's terminal window.

There's more…

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.221.154.151