Build a Pi powered Plane Watcher
This project uses a Raspberry Pi with super low cost software-defined radio (SDR) hardware to receive tracking information from the Mode-S transponders of aircraft up to hundreds of km away, with the addition of a neat 3.5” TFT display to provide a handy summary of airspace activity.
The tiny RTL2832U-based SDR receiver (124-5461) was designed and originally marketed for DVB-T reception. However, thanks to the efforts of a Linux kernel hacker some five or so years ago it’s possible to get raw samples from the device, rather than just a demodulated DVB signal. Which means that wireless systems can then be implemented in software, giving immense flexibility.
The RTL2832U chip is generally paired with a tuner IC and in the case of the USB receiver from Adafruit, it’s an R820T, which enables reception from 24MHz to 1,850MHz. It should be noted that with 8-bit ADC resolution and an effective number of bits (ENOB) of approximately 7-bit, RTL-SDR hardware is not going to compete favourably in terms of dynamic range with more expensive SDR platforms, but for many uses it is sufficient and does represent incredible value for money.
The software that will be used to receive and decode Mode-S signals provides a Google Maps-based web interface and a local display is not strictly necessary. However, the addition of an Adafruit PiTFT 3.5” display (124-5487) provides a neat “glanceable” summary of airspace activity. In addition, the combination of Raspberry Pi, SDR receiver and TFT display can alternatively be configured as a rather cool, self-contained scanner with spectrum visualisation.
The TFT display simply plugs onto the Pi’s P1 header, while the SDR receiver is just inserted into one of the USB ports.
There are two options when it comes to the Raspbian install: download an image from Adafruit with kernel support for the TFT display already configured, or write out a stock Raspbian image and then configure it accordingly. I opted for the latter, as I generally prefer to go with an official O/S installation image and then perform any required customisation. However, the former involves fewer steps and is going to be less error prone. Adafruit provide instructions for both methods.
After writing out the Micro SD card with “dd” I changed the hostname from the default of “raspberrypi” to “planepi”, to make it easier to locate on the network, by editing the files:
Note the missing slash at the start, since you don’t want to edit the files under /etc on the computer you wrote the SD card out with — so you will need to add in whatever path your computer has mounted the root filesystem on the SD card under.
If you prefer to configure a system via an attached keyboard, monitor and mouse, it won’t be necessary to enable SSH. However, if like me, you prefer to configure via an SSH connection:
$ sudo touch boot/ssh
Replacing “boot” with whatever the full path is to boot filesystem on the SD card.
If the Pi will be connected to a wired network you can remove the Micro SD card, insert into the Pi and boot. However, if you will be using a wireless network connection, you should also edit:
Again, this is not the configuration file in /etc/wpa_supplicant on the computer you wrote the SD card out on, but rather the file in the etc/wpa_supplicant directory of the SD card root filesystem.
For further details on manually configuring wireless, see the Raspberry Pi documentation.
Since I went with a stock Raspbian image and needed to configure this with kernel support for the TFT display, I followed the Easy Install DIY installer script instructions provided by Adafruit. However, the “sudo apt-get install” line resulted in the error shown above, due to the fact that the stock image had newer versions of software — and so it was necessary to force a downgrade with:
$ sudo apt-get install -y --force-yes raspberrypi-bootloader adafruit-pitft-helper raspberrypi-kernel
Following which the helper script was run to install the 3.5 inch Resistive" type of PiTFT.
$ sudo adafruit-pitft-helper -t 35r
It is perhaps generally advisable to just go with the Adafruit supplied, preconfigured Raspbian image. However, the above info should be useful to anyone who, for whatever reason — e.g. when adding these capabilities to an existing system running other apps — starts with stock Raspbian.
Finally, with the Pi oriented as shown in the image at the top of this post, whereby the USB power lead is pointing downwards, the configuration will need to be updated to rotate the display 180o. This is done by editing the /boot/config.txt file and changing rotate=270 to rotate=90.
There is various software available for receiving and decoding Mode-S transmissions and coming up for 5 years ago I wrote about the GNU Radio-based gr-air-modes. However, this time we’re going to use software called dump1090, named after the frequency used by Mode-S, 1090MHz.
Benefits of dump1090 include that, in contrast to GNU Radio, it has minimal external dependencies. It’s also notably robust and good at decoding weak signals. When operated in its interactive mode it will print out a summary of activity to the console and the fork shared on GitHub has been very slightly modified so that this fits on the 3.5” TFT display.
To build we need to:
$ sudo apt-get install libusb-1.0-0-dev librtlsdr-dev rtl-sdr
$ git clone https://github.com/DesignSparkrs/dump1090
$ cd dump1090
Following which edit the file /etc/rc.local and before “exit 0” add the line:
cd ~pi/dump1090; ./dump1090 --net --net-http-port 80 --interactive &
At this point we need to reboot, so that the kernel is configured for the TFT display and without default TV tuner support loaded for the RTL-SDR hardware (this would get in the way). If all goes well, dump1090 will then be started via the line that we just added to /etc/rc.local, following which the TFT display should start to fill up as signals are received.
Then if a browser is pointed at the Raspberry Pi we will get a simple web application based on Google maps, with the aircraft positions marked and altitude etc. data.
Note that the antenna provided with the SDR receiver is not optimal for 1090MHz, but in most areas it should be possible to pick up at the very least a few aircraft using this. Just make sure that it’s placed by or just outside a window. If you don’t have any luck at all, there are plans available online for simple DIY antennas that are tuned to 1090MHz and with much higher gain.
Additional software and services
dump1090 also makes the raw Mode-S messages available over the network and these can be used with software such as PlanePlotter to give a more sophisticated display. In addition to which data can sent from the receiver to online services that provide access to crowdsourced flight data, such as The OpenSky Network and FlightAware.
CommentsAdd a comment
July 7, 2017 09:17
@dcrand I had the same problem you have to go into preferences and change it from Desktop to CLI if you have the TFT as I do you then need to tab till you get to the top most button and shift tab twice and hit enter as I can't see ok it will ask to reboot and it will then appear.
June 11, 2017 08:01
@dcrand I used a Pi 3 also. It's not clear whether you used the Adafruit image or a stock Raspbian and install script, but would recommend the former.
June 8, 2017 12:35
I have a Raspberry pi 3 and can't get the PiTFT to display dump1090 data. Dump1090 is working in the browser. I've tried both instructions several times but just can't get any data on the PiTFT. Has anyelse got this to work on Pi3? I have a Pi2 sending data to Flightaware and Flightradar24 so very familiar with dump1090.
May 30, 2017 08:30
Well spotted! I had looked at the RS product page and didn't notice.
Probably as I went straight to the datasheet link which is correct.
I also used 'spotted an error' as you probably di so it should soon be updated.