Building a Low-Cost Flight Tracker
What to do with an old Raspberry Pi and a DVB-T stick that are just lying around, not being used at all? Right! You build an ADS-B receiver with it.
This will be a rather lengthy post explaining how to setup a Raspberry Pi from scratch with everything that is necessary to receive ADS-B data and feed it to FlightAware. We are going to cover the following topics:
- What is ADS-B?
- Let’s go shopping
- Setting up the Raspberry Pi
- Installing the Flight Tracking Software
- Starting it all up
- A little bit of tweaking
What is ADS-B #
Most planes are sending out radio signals to let others know of their position, altitude, velocity and so on. We can receive these signals, decode them and display the planes on a map along with their data.
Check out this Wikipedia entry for a very detailed explanation.
Let’s go shopping #
We need a few inexpensive things to make it work. If you have a running Raspberry Pi already you basically need a DVB-T stick and you are ready to go.
- Raspberry Pi
- DVB-T Stick with Antenna
- SD-Card
- Power Supply
- Optional: Band Filter
- Optional: ADS-B Antenna
Setting up a Raspberry Pi #
First we download the image of the operating system. For this purpose I have decided to use the lite version of Raspbian Jessie.
Follow these instructions to install the image. For me it looked like so:
diskutil list
diskutil umountDisk /dev/disk2
sudo dd bs=1m if=~/Downloads/2016-03-18-raspbian-jessie-lite.img of=/dev/rdisk2
sudo diskutil eject /dev/rdisk2
Then I have started the Raspberry Pi with keyboard and screen attached. I have also plugged in the DVB-T stick.
Also change the default password of user pi
with passwd
.
After that, the software that comes with Raspbian Jessie has been updated to the latest versions.
sudo apt-get update
sudo apt-get upgrade
Since I have a German keyboard, I have changed the layout with sudo raspi-config
.
Check if the DVB-T stick gets recognized with lsusb
. Look for “wireless” or “802.11”.
Then I setup my wireless adapter. The command ifconfig
showed the adapter as wlan0
. Good, it has been recogized and only needs to be configured.
Edit the config file: sudo vi /etc/network/interfaces
and add the following lines under iface wlan0
:
wpa-ssid "thessid"
wpa-psk "thepasswd"
Restart networking afterwards with sudo service networking restart
.
Installing the Flight Tracking Software #
We have our Raspberry Pi up and running, now its time to setup the flight tracking software called PiAware. This software will send the received radio signals to FlightAware for everyone to see. Before installing the software, register first and note down your user name and password.
wget http://flightaware.com/adsb/piaware/files/dump1090_1.2-3_armhf.deb
sudo dpkg -i dump1090_1.2-3_armhf.deb
wget http://flightaware.com/adsb/piaware/files/piaware_2.1-5_armhf.deb
sudo dpkg -i piaware_2.1-5_armhf.deb
sudo apt-get install -fy
sudo piaware-config -autoUpdate 1 -manualUpdate 1
sudo piaware-config -user <yourusername> -password
sudo /etc/init.d/piaware restart
After I did all this I checked if everything was okay
piaware-status
Apparently, nothing was okay.
dump1090 is not running.
faup1090 is not running.
piaware is running.
no program appears to be listening for connections on port 30005.
faup1090 is NOT connected to port 30005.
piaware is connected to FlightAware.
got 'couldn't open socket: connection refused'
maybe dump1090 is NOT producing data on port 30005.
This post here shows the reason why this happens and how to solve it.
The device is already in use by the DVB-T driver. Quick-fix is to unload the driver.
sudo rmmod dvb_usb_rtl28xxu rtl2832
This is not permanent. After restarting the Raspberry Pi, this will be lost. It can be made permanent with
blacklist dvb_usb_rtl28xxu
blacklist rtl2832
blacklist rtl2830
Starting it all up #
Let’s get the ball rolling and start all software components.
dump1090 --quiet --net &
sudo /etc/init.d/piaware restart
Finally, everything shows up okay.
dump1090 is running.
faup1090 is running.
piaware is running.
dump1090 is listening for connections on port 30005.
faup1090 is connected to port 30005.
piaware is connected to FlightAware.
dump1090 is producing data on port 30005.
You can check the log file as well to see what it is currently doing:
tailf /tmp/piaware.out
Also check your network ports to see what is going on
sudo netstat -tulpen
So, there is a web server running at port 8080. Point your browser to http://<yourip>:8080
and enjoy!
You can also check my FlightAware statistics.
A little bit of tweaking #
The setup can certainly be approved by
- Automatically starting dump1090 and PiAware after a restart of the Raspberry Pi
- Use a band-filter.
- Use a better ADS-B antenna and put that on the roof.
After a while, the Raspberry Pi and the DVB-T stick got quite warm. Now I monitor the temperature of the Raspberry Pi and posting it to ThingSpeak. For that I have setup a cronjob as follows
*/10 * * * * echo "field1=`vcgencmd measure_temp | grep -o '[0-9]*\.[0-9]*'`" | curl -d "api_key=<your-api-key>" -d @- https://api.thingspeak.com/update.json
I will also receive an SMS when the temperature reaches a certain threshold.
Done for today!