Chances are that there are planes flying over your house right now. Using a Raspberry Pi, a device known as an ADS-B receiver, and a standard projector, we can create our very own “radar” that shows the real time location of these aircraft and, if we have a projector, we can project it on the ceiling. Otherwise, we can track it on a regular screen.
About ADS-B Technology
Lots of aircraft are outfitted with a device known as an ADS-B. Standing for “Automatic Dependant Surveillance-Broadcast”, it's a technology that allows aircraft to transmit positional information about themselves to other aircraft, ground-based stations, and even satellite-based stations. For smaller planes where it isn’t feasible to install more complicated collision-avoidance technologies, an ADS-B transmitter and receiver can do a lot to increase flight safety.
Aircraft outfitted with ADS-B transmitters (which is becoming law in more and more countries), transmit a variety of positional data like altitude, GPS coordinates, and ground speed data. Fortunately for us, all the data is transmitted on a standard frequency and it’s unencrypted. This means with a small USB dongle and a Raspberry Pi, we can listen in to the positional information of aircraft nearby
What You’ll Need For This Project
- Raspberry Pi 4 or Raspberry Pi 3 with power adapter
- 8 GB (or larger) microSD card withRaspberry Pi OS. See our list of best microSD cards for Raspberry Pi.
- ADS-B Receiver Kit (Antenna and USB dongle) like this one (opens in new tab).
- Monitor or Projector with HDMI and power cables. If you want to project on the ceiling, you’ll need a projector.
How to Track Local Airplanes with Raspberry Pi
Before you get started, make sure that you have your Raspberry Pi OS set up. If you haven’t done this before see our article on how to set up a Raspberry Pi for the first time or how to do a headless Raspberry Pi install (without the keyboard and screen).
1. Update Raspberry Pi OS by entering the commands below at the command prompt. This almost goes without saying, but is a good practice.
sudo apt-get update -y sudo apt-get upgrade -y
2. Install the base components we’ll need to communicate with the ADS-B receiver and display aircraft positions using Python.
sudo apt-get install build-essential debhelper librtlsdr-dev pkg-config dh-systemd libncurses5-dev libbladerf-dev libhackrf-dev liblimesuite-dev libsdl2-ttf-2.0-0 sudo pip3 install virtualenv
3. Clone the dump1090 repository into your home directory. Dump1090 is a decoder that will let us decode ADS-B messages into readable JSON.
cd ~/ git clone https://github.com/flightaware/dump1090.git
4. Build dump1090. This may take a bit of time depending on your type of raspberry pi.
cd dump1090 make
5. Connect your ADS-B receiver to the Raspberry Pi’s USB port.
6. Run dump1090 from within its directory.
You should see a table appear in your console with various rows filled with data for overhead airplanes, including their altitude and flight number.
Now that we’ve got our ADS-B decoder installed, we can download the projection code. I wrote a simple program using python and the pygame library that displays the real-time location of aircraft, as well as their flight number and altitude (all from dump1090) on your display. You’re more than welcome to modify it or build your own.
7. Clone the Raspberry Pi Flight Tracker git.
cd ~/ git clone https://github.com/rydercalmdown/raspberry_pi_flight_tracker.git
8. Set up a virtual environment with python3 for the flight tracker.
cd raspberry_pi_flight_tracker virtualenv -p python3 env
9. Activate the virtual environment, and install python requirements.
source env/bin/activate pip install -r src/requirements.txt
10. Rename the environment.sample.sh to environment.sh and open the new file for editing.
mv environment.sample.sh environment.sh # edit the file with nano nano environment.sh
11. Edit the file to set the values for your current latitude and longitude, along with maximum latitude and longitude. The maximums will determine how much of the area around your location to display. An easy way to get your latitude and longitude values is to use Google Maps. First, find your location and right click it to display a menu - click the latitude and longitude values to copy them to your clipboard.
Next, zoom out from your current location. Pick a spot north of your current location and copy the value to your clipboard. Then copy the first value (latitude) into your environment.sh file as LAT_MAX (shown below as 43.680222). Do the same with a spot south of your current location, and fill in the first value in your environment.sh file as LAT_MIN. These values represent how far tracking extends north and south of your location.
Next, pick a spot west of your current location, and copy the coordinates to the clipboard. Use the second value (viewed above as -79.49174) to fill in the LON_MAX value. Do the same with a spot east of your location, and LON_MIN. These values represent how far tracking extends east-west from your current location.
When completed, your environment.sh file should look something like this (with your coordinates).
export LAT_MAX=43.680222 export LAT_MIN=43.63501 export LON_MAX=-79.49174 export LON_MIN=-79.37080 export CURRENT_LAT=43.64611 export CURRENT_LON=-79.37929
12. Start the dump1090 server and the projection code using the same command:
If all goes well, after a moment you’ll be greeted with a blank screen with a dot in the center indicating your current position, and aircraft around you will show up as moving dots across the screen as their signal appears.
If you’re having trouble getting a signal, try moving your antenna to where it has a clear view of the sky, like an upstairs window.
13. If you’re using a projector, point it at the ceiling and line up the top of the screen with your magnetic north.
And there you have it. Your own personal aircraft “radar” system.
I live very close to a fairly large airport and was able to see several planes landing and taking off in addition to the ones just going overhead.
It was even more fun to enter the flight number into a flight tracker program and see the origin and destination info.
Even my wife thought it was interesting.
if I type in bash entrypoint.sh, a window starts to open for a second. Then I get a message like "FileNotFoundError: No such file or directory : '/home/pi/raspberry_pi_flight_tracker/src/../data'
The same thing happened to me the first time I tried it so I just manually created the missing 'data' directory and now everything works.
Since this is apparently for simple data files I didn't worry about permissions and just took the defaults. Once the directory is created, the programs will be able to create all the data files they need to run.
Can you point me in the correct location(s)?
Im also getting a similar message when I try to run the program. Here is the dump from it. Any help is appreciated. Im a total newb to anything non widows based
pi@raspberrypi:~/raspberry_pi_flight_tracker $ bash entrypoint.sh
pygame 2.0.1 (SDL 2.0.9, Python 3.7.3)
Hello from the pygame community. https://www.pygame.org/contribute.htmlTraceback (most recent call last):
File "src/app.py", line 10, in <module>
File "src/app.py", line 6, in main
File "/home/pi/raspberry_pi_flight_tracker/src/renderer.py", line 43, in run_screen
for aircraft_json in decoder.get_aircraft():
File "/home/pi/raspberry_pi_flight_tracker/src/decoder.py", line 23, in get_aircraft
File "/home/pi/raspberry_pi_flight_tracker/src/decoder.py", line 16, in clean_up_directory
for file_name in os.listdir(get_data_directory_path()):
FileNotFoundError: No such file or directory: '/home/pi/raspberry_pi_flight_tracker/src/../data'