Flight Tracking, the Raspberry Pi, and the Internet of Things

As part of my day-to-day job responsibilities, I look for ways to help my customers understand how new technologies and methodologies can be applied to their business processes. One major component of this is incorporating the vast amount of volatile data that they generate into useful business information. This can be an interesting conversation, because when many people hear the phrase, “Internet of Things” or “IoT”, they immediately dismiss it as not something that would help them, since they aren’t in manufacturing, or don’t deal with “sensors”. Over the last year, I’ve found myself struggling somewhat to come up with an IoT story that a majority of people could relate to and yet would still be relevant to their business operations. What follows is a breakdown of such a story, and how I decided to tackle the problem at hand.

The Problem

I live in a relatively rural area NE of Phoenix, Arizona called the Rio Verde Foothills. It’s an area that used to be a working cattle ranch, that was turned into home sites with acreage many years ago. The area is popular with “horse people”, and there are many world-class horse ranches out here along with people who have decided to move to a more rural area and enjoy a bit of a slower pace, while at the same time staying relatively close to a major city and all the amenities that offers. The area is roughly 30 square miles, and if you were to view it on an aerial map it would look like this:

image

An aerial view of the Rio Verde Foothills

We are about 10 miles away from the Scottsdale Airport, and about 15 miles from the Phoenix Deer Valley Airport, both of which have a healthy pilot-training industry. This means that our community is an ideal target for a practice area and is used relatively extensively for flight training operations.  The US Federal Aviation Administration (FAA) is very specific in many rules, but one rule that is often open to interpretation is the Code of Federal Regulations (CFR) 91.119 which details the minimum safe altitude that aircraft may operate. Generally-speaking, aircraft must remain 1000’ above ground in “congested areas” and 500’ in “other than congested”, unless it’s a “sparsely populated” area, in which case the pilot must maintain 500’ separation between any person, vessel, vehicle or structure. The FAA has never published an official definition of “congested area” or “sparsely populated” area, so each violation of this CFR is taken on a case by case basis. During flight training operations, it’s very common to perform “engine out” maneuvers, where you simulate an engine failure and practice setting up for a safe landing, which involves gliding to the chosen area, and then when the instructor is satisfied that the student has successfully performed the task, applying full power and climbing back to altitude. Typically, this results in a large burst of engine noise relatively close to the ground. This is a concern for people who have horses and don’t want them “spooked”, and is also a concern for people who moved to the area expecting it to be quiet and peaceful. (Personal note: I’m a pilot and I love the engine noise, so I don’t fall into the “concerned” category)

As our community grows, and as flight schools become more active, we see more and more complaints about the engine noise and flight operations. Since I consider myself a Data Scientist, I figured it would be an interesting endeavor to collect real data about flight operations in our area, and provide a data-driven analysis of actual flight operations above our community.

The Mechanics

In order to be certified for flight, the FAA requires certain equipment to be onboard aircraft (There are exceptions to the following, however for the purposes of this article, they are irrelevant). One of the requirements is that the aircraft have a transponder. Simply put, the transponder is a device that allows air traffic control (ATC) to query the airplane and learn things about it. Currently, in order to operate in controlled airspace (In the United States, airspace is broken down into several classes and each class has a specific requirement as to how you operate within it. For example, Class C airspace extends from the surface to 4000’ above an airport and within a 5 nautical mile radius, and from 1200’ to 4000’ within a 10 nautical mile radius – usually depicted on a chart by a cyan arc)

image

A portion of the Phoenix Sectional Chart, showing the airspace designations

aircraft are required to have what is known as a Mode C transponder, which transmits the altitude of the aircraft along with other flight information to ATC. This transmission occurs at 1090 Mhz and is not an encrypted signal. The transmission does not include any location information, but ATC can correlate radar returns with transponder information in order to get an accurate position and altitude of an aircraft.

As part of the FAA’s Next Generation Airspace initiative, a new technology known as Automatic Dependent Surveillance – Broadcast or ADS-B, will be required on all aircraft operating in controlled airspace. ADS-B is already being used by many European countries, and the infrastructure is already in place throughout the United States. ADS-B essentially extends existing transponder functions by including GPS location information, and is already being installed on many aircraft. (Basically all commercial airliners are equipped with it, and most general aviation aircraft with “modern” avionics have it as well). ADS-B uses the same unencrypted 1090Mhz signal, so it is relatively easy to capture with inexpensive radio receiver technology.

The advent of ADS-B technologies have afforded an opportunity for companies that provide flight tracking information, such as FlightAware and flightradar 24.

image

image

Examples of FlightAware (top) and flightradar24 (bottom)

These companies can collect the ADS-B information transmitted by aircraft and provide extremely accurate flight tracking information. If you haven’t used their sites or apps yet, do yourself a favor and check them out. They offer free service, but also have commercial tiers where you pay for ad-free browsing, or have other features that are only available to paid accounts.

One challenge that the above companies and others like them are faced with is the fact that not all areas are covered by Government-sponsored ADS-B receivers, meaning that there can be large gaps in their flight-tracking coverage.

In order to solve the coverage problem, these companies have made it very easy for hobbyists and the general public to participate in the ADS-B system by providing easy-to-use solutions that allow for collection of ADS-B data and transmission to these sites. The added advantage to this is that when there are multiple ADS-B receivers in a given area, they can use a technique known as “multilateration” (MLAT) to pinpoint the location and altitude of aircraft that are using non-ADS-B equipped transponders. Basically anyone with the desire and a little technical ability can construct an ADS-B receiver that can then be used to transmit the information to the sites, enhancing their coverage and MLAT accuracy. In return for doing this, the sites offer you free membership (which in the case of Flightradar24, is worth about US$800 per year and removes all advertising from their app and website)

In any given 24 hour period, in my area there are just over 2000 aircraft within range of my ADS-B receiver, and those aircraft report about 500,000 positions. That is a fair amount of data, and if harnessed for more than just tracking of individual flights, could be used for all sorts of analytics, including the ability to actually quantify the amount of air traffic in our area, along with the altitude, speed, etc… When collected and analyzed using a tool such as Microsoft Power BI, this data can prove to be very useful.

image

An example of analytics possible with the ADS-B data and Power BI

This is where IoT can prove to be a very useful tool to answer questions outside of the typical manufacturing or sensor-driven use case.

For the remainder of this post, I’ll describe how to build an ADS-B receiver for under US$80 using the popular Raspberry Pi computing platform and will discuss how to connect it to FlightAware and flightradar24. In follow-on posts, I’ll describe how to feed the data into Microsoft Azure IoT Suite, and finally will describe how to analyze historical information with Power BI.

Procuring the Hardware

There are many different ways to build an ADS-B receiver, several of which are probably more effective than what I’m going to detail (If you really want to get serious about this, take a look at the Virtual Radar Server project for example), but the way shown here results in very little expense and is relatively easy to do, even if you don’t consider yourself a hard-core geek. The shopping list (along with links to the item on Amazon.com) for this project is as follows:

  • Raspberry Pi 3 Model B – The Raspberry Pi 2 can also be used, but the 3 is faster and has integrated WiFi. I used a starter kit from Vilros that I purchased on Amazon as it had the case and integrated heat sinks.
  • A fast SDHC Card at least 8GB in size – You don’t want to skimp on this, as the faster the card, the better MLAT along with the local web interface will work. I used this one from SanDisk.
  • A USB ADS-B Receiver – FlightAware makes a nice one that includes an integrated filter for under US$20.
  • A 1090 Mhz antenna – There are several of these on the market, but the simple version to start with can be found here. This one, when placed in a window, will receive ADS-B signals from up to 50 miles away. Once you decide to get more serious about collecting the data, you can use a more effective antenna which can reach out to more than 250 miles, but will need to be externally-mounted.

Once you have the hardware, you will need to download and install an operating system to run the Raspberry Pi. You can follow the directions here to download, install and configure Raspbian Jessie (I use the desktop version, but the Lite version will work as well).

If you need more detail on setting up the Raspberry Pi, you can follow the steps (through step 3) from this earlier blog post that I wrote on the topic.

Installing the FlightAware Software

After you have installed and configured the operating system, and plugged in the FlightAware receiver with antenna, you will want to ensure that everything is up to date with the latest patches and repository information. To do so, connect to the Pi (either via SSH from another machine, or open a terminal session on the desktop of the Pi) and issue the sudo apt-get update and sudo apt-get upgrade commands.

image

apt-get update

image

apt-get upgrade

The following has been documented using the following version of Raspbian Jessie:

image

Once this is complete, you will install the PiAware application, which collects data from the ADS-B receiver and transmits it to FlightAware. There are very detailed instructions listed here, but the following steps will work just fine:

  • Install the FlightAware repository so that the package installer can find the piaware source.
wget http://flightaware.com/adsb/piaware/files/packages/pool/piaware/p/piaware-support/piaware-repository_3.5.1_all.deb sudo dpkg -i piaware-repository_3.5.1_all.deb

image

    • Update the repositories
sudo apt-get update

image

    • Install the Dump1090-fa software (This is the software that decodes the 1090Mhz signal into the digital ADS-B information needed to transmit to FlightAware.
sudo apt-get install dump1090-fa

image

    • Install the FlightAware piaware software.
sudo apt-get install piaware

image

    • Configure piaware to support updates
sudo piaware-config allow-auto-updates yes sudo piaware-config allow-manual-updates yes

image

    • Reboot the Pi to allow the configuration to take effect.
sudo reboot now

Viewing the Results

Once the Pi has rebooted, open a browser (either on another machine, or directly on the desktop of the Pi) and browse to <ip address of Pi>:8080 – (For example if the IP address of your Pi is 192.168.1.10 : http://192.168.1.10:8080) This will open the PiAware Skyview web application. If everything is working fine, and if there are aircraft nearby that are transmitting ADS-B signals, you should see them represented on your screen, along with a link asking you to connect to Flightaware and claim your receiver. Click the link and claim your receiver (if you don’t already have a FlightAware account, use the link to register for one). Once you claim your receiver, your account will be upgraded to an Enterprise premium account, which is normally worth over $1000.00 per year.

image

The Skyview application showing aircraft detected.

Once you have claimed your receiver, you can verify functionality by checking the piaware log file, located at /var/log/piaware.log. Use the following command: sudo cat /var/log/piaware.log to view the entire log, or, sudo tail /var/log.piaware.log to view just the end of the file.

image

Conclusion

In this post, we have discussed the use of ADS-B signals to collect information on nearby aircraft, and have demonstrated how to build an ADS-B receiver that will transmit the information to FlightAware.

Future posts in this series will discuss how to extend this solution to other sites, as well as collecting the information via Microsoft Azure IoT Suite to make it available for historical analysis.