Did you know you can track planes in the sky using free software? David does. And he's doing it!
There's a fantastic community of enthusiastic plane-trackers out there. David is part of that community. He won one of our prelaunch competitions, finding himself the proud owner of a pcDuino and Touchscreen! He's put it to great use.
Congratulations on being the lucky winner of our pcDuino competition. How did you feel when you found out?
I was very excited! I think it is the first competition I have ever won. I’d been tempted to give the pcDuino a try for a long time, but the cost had been a barrier, especially given you can get similar functionality with a Raspberry Pi (RPi) and Arduino. The price has recently come down but free swag is always a treat! I even had a useful project lined up that I thought would allow me to see how it performed.
We’re so happy it went to a good home and we see you’ve put it to good use! For those who haven’t heard, can you explain what you’re doing with the pcDuino?
I am using the pcDuino and a cheap USB DVB-T TV Tuner to track aircraft flying nearby, and then displaying their real time position on Google Maps. In addition to the plane’s position you can also see their flight number, transponder squawk code, altitude, speed and heading. Squawk codes are used by Air Traffic Control (ATC) to uniquely identify aircraft on radar; they are also used in emergency (for example, if a plane is squawking 7500 it means that the plane has been hijacked!).
In order to do this the pcDuino needs to receive and interpret the ADS-B data that most planes transmit from their transponder. A transponder is a piece of kit on a plane to help ATC identify a particular aircraft’s position and altitude on a radar screen. This helps them maintain separation and prevent collisions. There are three civilian transponder modes, called A, C and S.
MODE A: Following an interrogation request, the transponder broadcasts the configured transponder code (or “squawk code”). A separate type of response called “Ident” can be initiated from the aircraft by pressing a button on the transponder control panel.
MODE C: This will send a pressure altitude response when interrogated.
MODE S: This “Select” mode is to avoid over interrogation of the transponder (if there are many radars in busy areas), and to enable automatic collision avoidance. Mode S transponders are compatible with Mode A and Mode C. A Mode S transponder is required to implement ADS-B, but there are other ways as well.
ADS-B stands for “Automatic Dependent Surveillance - Broadcast”, which isn’t really very helpful. In other words, the plane uses GPS to obtain its position it then broadcasts that position at rapid intervals, along with identity, altitude, velocity and other data. Dedicated ADS-B ground stations receive the broadcasts and relay the information to air traffic control for precise tracking of the aircraft. The pcDuino and TV Tuner are, in effect, another ADS-B ground station.
ADS-B data is broadcast every half-second on 1090MHz. The ability of a ground station to receive a signal depends on altitude, distance from the site, and obstructing terrain. The maximum range of each ground station can exceed 250 nautical miles; however, the dinky aerial which comes with the TV Tuner is not going to deliver that sort of range, particularly if it is indoors like mine. In practice all the plane data that I am receiving is within 80km. If you connect your base station to Flight Aware, it will provide you with these statistics, as well as much more.
In Australia, CASA is moving towards most aircraft requiring a Mode S transponder, which is ADS-B capable, but this will take years to come into effect, particularly for Visual Flight Rules (VFR) aircraft. All of the big jets certainly have it. You may see references to S-mode when reading about ADS-B plane tracking and sometimes S-mode is used interchangeably with ADS-B (which is not strictly correct).
Interesting information! How do you pick up ADS-B signals using a DVB TV tuner? Is there a frequency crossover?
The RTL2832U-based Software Defined Radio (SDR) receiver is designed and marketed for DVB-T reception. However, it’s possible to get raw samples from the device, rather than just a demodulated DVB signal. This means that a wide-band receiver can then be implemented in software. I used the USB DVB-T TV Tuner RTL2832U + R820T (you can get them on eBay for around $13).
The RTL2832U chip is generally paired with a tuner IC and in the case of the USB receiver above, it’s an R820T, which enables reception from 24MHz to 1,850MHz. Remember we need 1090 MHz.
The antenna that comes with the USB Tuner is 100mm in length. This works okay, but is not optimised for receiving signals with a frequency of 1090 MHz. If you are having problems with reception, you could purchase the FlightAware 1090MHz antenna, or there are plenty of home brew designs online. The antenna should ideally be located outside, but I stuck mine near a window and it works okay.
Installation of the hardware is simple - just plug the SDR receiver into a USB port. As there is only one USB port on the pcDuino, you will probably need a hub so that you can also plug in the keyboard and mouse required for setup. I had a powered hub but it doesn’t seem to need it. I think the pcDuino supplies enough current for an unpowered USB hub to work. Don’t plug in the SDR receiver until you load the new driver. The driver we need is called RTL-SDR. To download it, fire up the pcDuino, open LXTerminal and type the following (assuming you’re in ~/):
$ sudo git clone git://git.osmocom.org/rtl-sdr.git
To install RTL-SDR:
$ cd rtl-sdr/
$ sudo mkdir build
$ cd build
$ sudo cmake ../
$ sudo make
$ sudo make install
$ cd ~
$ sudo cp ~/rtl-sdr/rtl-sdr.rules /etc/udev/rules.d/
$ sudo ldconfig
The kernel that comes with Ubuntu already contains a DVB driver, which we don’t want to use. To stop the conflicting Linux DVB-T driver from loading, we need to blacklist it. To do this:
$ cd /etc/modprobe.d/
$ sudo nano blacklist.conf
Then add the following line at the end of the file. You can either use the existing blacklist.conf file or create a new file; just make sure it’s in this directory and ends in .conf.
blacklist dvb_usb_rtl28xxu
At this point you can plug in your receiver dongle and reboot. Rebooting will allow the blacklisting to take effect.
Thanks for the step-by-step instructions. We’re confident there’ll be a few doing this! You’re using Dump1090 software. Is that what does the decoding, or is there another step in the middle?
The RTL-SDR driver gives us access to the ADS-B data and passes it to Dump1090, which does the heavy lifting. Dump1090 is a Mode S decoder that is specifically designed for RTL SDR devices. It provides robust decoding of weak messages, and an embedded HTTP server that displays the currently detected aircraft on Google Maps. The 1090 refers to the 1090MHz frequency that the signals are broadcast on.
Dump1090_mr is a FlightAware fork, of Malcolm Robb’s fork, of Salvatore Sanfilippo’s dump1090 program. FlightAware uses it as an important element of PiAware (a Debian package for forwarding ADS-B data to FlightAware - more on this later).
Note that dump1090_mr is no longer available on the FlightAware GitHub repository, so I used a copy sourced from CTassisF. Before installing Dump1090 there are some pre-requisite packages and libraries required. To install these:
$ sudo apt-get install git cmake libboost-all-dev libusb-1.0-0-dev python-scitools portaudio19-dev -y
$ sudo apt-get install tcl8.5-dev tclx8.4-dev itcl3-dev tcl-tls tcllib automake cmake telnet git gcc make
To build and install dump1090 and faup1090, and to configure the system to start them automatically whenever the system boots, change to the ~/ directory and type:
$ git clone https://github.com/CTassisF/dump1090_mr.git
$ cd dump1090_mr/
$ make
$ make -f makefaup1090 all
$ sudo make -f makefaup1090 full-install
To test whether dump1090_mr is operational:
$ dump1090 --interactive
This should show you a list of detected planes along with their flight information.
That’s awesome! How is the flight data then overlaid to Google Maps?
This is very easy as Dump1090 does it for you, and it includes an embedded HTTP server. If you are on the pcDuino, open the Chromium browser and point it at http://127.0.0.1:8080 to see the display.
You can also view this page from other computers on your LAN. To do this you will need the IP address of your pcDuino (type hostname -I on the command line). On the other computer you can then access the page via that IP address. So for example, my pcDuino IP address was 192.168.0.7 to view the dump1090 page I enter: http://192.168.0.7:8080 into the browser address bar.
Fantastic! Tell us a little about FlightAware and how the community works.
FlightAware is the world’s largest flight tracking data company. By registering (for free), you can add your ADS-B base station results to the worldwide collection of other operators, creating a real time picture of aircraft movements globally. If you are picking someone up from the airport you can track their flight in real time, and minimise your parking fees! Connecting to FlightAware will also tabulate and graph statistics from your station.
You mentioned it’s been done on RPi many times, were there any challenges getting it to work on the pcDuino?
Yes. FlightAware has made it very easy to get this system up and running on a RPi, and have a guide available on their website.
The difficulty is that the packages have been compiled for Raspbian (a Debian variant of Linux, which is most commonly used with the RPi), and the pcDuino uses Lubuntu (a light weight variant of Ubuntu). Fortunately, Debian and Ubuntu share a common ancestry so it is possible to move packages between the two.
PiAware is a FlightAware client program that runs on a RPi (or pcDuino!) to securely transmit dump1090 ADS-B and Mode S data to FlightAware.
I had some trouble getting PiAware to work on the pcDuino, but the following ended up being the best way to build the system for Ubuntu (this worked for version 3.5.1 of PiAware). To create the PiAware package, change to the ~/ directory and type:
$ sudo apt-get install build-essential debhelper librtlsdr-dev libusb-1.0-0-dev pkg-config tcl8.5-dev autoconf python3-dev python-virtualenv libz-dev git tclx8.4 tcllib tcl-tls itcl3
This will load some libraries you will need. You can then download and build PiAware.
$ git clone https://github.com/flightaware/piaware_builder.git
$ cd ~/piaware_builder
$ ./sensible-build.sh wheezy
$ cd ~/piaware_builder/package-wheezy
$ dpkg-buildpackage -b
To install the PiAware package:
$ sudo dpkg -i ~/piaware_builder/piaware_3.5.1_armhf.deb
Reboot, and then to check that everything is working as it should, type:
$ sudo piaware-status
This should display something like the screenshot below. Note that you no longer need to add your username and password to the PiAware configuration file.
To link your new pcDuino ADS-B base station to your FlightAware account, log into the FlightAware website, and then go to the claim page to claim a new station.
FlightAware works out which base station is yours, based on your IP address, so the computer you are using to claim the station must be on the same LAN as your base station; and the station needs to be transmitting data to FlightAware. Wait 15 minutes or so after booting the pcDuino to make sure that FlightAware is receiving your data, before trying to claim your station.
It sounds like an amazing community collating data together! Is there anything else you’d like to tell us about this system?
Just to note that if you do contribute your ADS-B data to the worldwide network, then Flight Aware provides access to the following:
- Live data on flightaware.com (subject to standard data processing delay of up to two minutes).
- Access to up-to-the-second live data received by the local device (accessible from the stats page with a local network connection).
- Data from local device highlighted on FlightAware track logs.
- Detailed statistics on site performance.
- A free Enterprise Account (USD89.95/mo value).
Wow, it sounds like a great deal all-round! What are you working on now?
A RPi-based robot, which looks a lot like SAM from Issue 3. Currently you can drive it around using a web browser, while viewing the onboard video, and I am working on an Amazon Alexa interface so that it will respond to voice commands.
That sounds awesome - we can’t wait to hear about these in the future!