Tracking aircraft using ADSB and Virtual Radar Server (VRS) on a Raspberry Pi

A screenshot of my Virtual Radar Server setup

In this post, I will explain how I set up an ADS-B receiver station using a Raspberry Pi. I will also explain how to set up Virtual Radar Server (VRS), which is a visual display of the received and decoded aircraft data. I have set up my own Virtual Radar Server here. To set this up yourself, you will need the following:

  • ADS-B receiver hardware (antenna, receiver, cables, connectors)
  • Raspberry Pi, preferably version 3, including a power supply and SD card
  • Internet access and a network cable (the latter is needed during setup)

Assuming your internet connection is up and running, I will cover the first two points in this post.

Background

ADS-B (Automatic Dependent Surveillance-Broadcast) is a surveillance technology in which an aircraft automatically broadcasts various kinds of information. Air traffic controllers and pilots use this system to identify aircraft as well as their speed, position (using GPS receivers on the aircraft) and altitude, to name just a few. This information is broadcast by (almost) all aircraft – even hot air balloons – at a frequency of 1090 MHz. Anyone with the proper equipment can decode (and visualize) the data in real time, or store it for later processing.

Communications between the various entities in an ADSB network

Companies such as FlightAware have developed ADS-B decoding software that runs on (usually) Linux computers such as a Raspberry Pi. Anyone can join the network by installing an antenna on (or in) their home and configuring the software to upload the collected data. FlightAware then processes this data and makes it available to their customers.

Hardware

My receiver station has a maximum range of approximately 350 km. Western Europe is a busy place when it comes to air traffic. During peak hours in summer, the system tracks and displays 300 aircraft simultaneously. This includes commercial airliners but also military aircraft, helicopters and private jets. Before I purchased parts, I spent lots of time reading through the FlightAware community forums. It’s an active community with lots of useful resources. After lots of research, I decided to buy the following:

  • Antenna: FlightAware 1090 MHz antenna. It’s about 60 cm long and easy to mount on a mast;
  • Receiver: FlightAware Pro Stick. It has a built-in amplifier and has good compatibility;
  • Computer:Raspberry Pi 3, including a 16GB SD card. The Pro Stick plugs into on of the Pi’s USB ports;
  • Cables & connectors: Hirschmann KOKA 799 coax cable (~3 m) with suitable connectors (N, F, SMA);

The antenna has been mounted on a mast on the roof and stands just above the roof’s highest point for better performance. The coax cable is routed inside to the Raspberry Pi. This processes the data and sends it to the FlightAware network through a connected router. I explain the software set-up process below.

Software setup

Step 1 – Flash Raspbian to your SD card
Flash the latest version of Raspbian (preferably not Lite) to your SD card. I usually do this using Etcher, which can be downloaded here. The latest Raspbian images can be downloaded here.

Step 2 – Enable SSH
After the flashing process finishes, add an empty file named ‘ssh’ (no extension) to the root folder of the ‘Boot’ partition of the fresh SD card. This will allow us to access the Raspberry Pi through SSH in the next steps.

Step 3 – Find the Pi’s IP address
Power up the Raspberry Pi and connect it to the router using your network cable. Access your router’s control panel – you can find its IP address by starting the command line (Windows+R and type ‘cmd’) and typing ‘ipconfig’. Look for the IP address that is displayed after ‘Default gateway’. Now that you have accessed the router’s control panel, find the Raspberry Pi’s IP address in the list of connected devices. Note it down.

Step 4 – Log in through SSH
Log in through SSH using PuTTY, available here. In PuTTY’s address box, type the IP address you just noted down. If successful, you will be prompted for a username and password. The default user is ‘pi’ with password ‘raspberry’.

Step 5 – Configure the Pi
Configure the Pi by typing the following command in PuTTY:

sudo raspi-config

Inside this menu, you will have to perform the following tasks:

  • Change the host name to something less generic (optional)
  • Change the user password (recommended!)
  • Enable VNC (under ‘Interfacing options’, allows easy Wi-Fi configuration)
  • Expand the file system (under ‘Advanced options’)

Reboot after this step. The raspi-config application will ask you to do so upon exiting it.

Step 6 – Optional: set up Wi-Fi
Only if you want to use Wi-Fi. Connect to your Pi through VNC Viewer. It can be downloaded here. Use the same user ‘pi’ and the password that you set (or didn’t) in step 5. Connect to Wi-Fi in the top right corner of the screen. Access your router’s control panel again and note down the IP address as it will differ from the wired connection’s IP. Disconnect the network cable from your Pi and log in through PuTTY using the new IP address.

Step 7 – Optional: assign a static IP address
Setting a static IP is useful to prevent your router from assigning different IP addresses to your Pi, which could break your server setup later on. This process varies per router. I did it by assigning a static IP to the MAC address of my Pi through the router’s control panel. You can also do it in the Pi, but this was the most straightforward method for me.

After finishing this step, reboot the Pi and verify that it acquires the static IP that you just set. Use this IP address from now on.

Step 8 – Install PiAware
We will now install PiAware, which is FlightAware’s client software that handles all the communication between your station and FlightAware’s servers. In return for your data, FlightAware give you a free Enterprise account and a statistics webpage to track your receiver’s performance.

Update and upgrade your installation:

sudo apt update && sudo apt upgrade

Download and configure the PiAware repository package:

wget https://flightaware.com/adsb/piaware/files/packages/pool/piaware/p/piaware-support/piaware-repository_5.0_all.deb
sudo dpkg -i piaware-repository_5.0_all.deb

Next, install PiAware by running the following two commands:

sudo apt update
sudo apt install piaware

Now, if you’d like to enable automatic updates, enter the following two commands to write the respective settings to the PiAware configuration file:

sudo piaware-config allow-auto-updates yes
sudo piaware-config allow-manual-updates yes

Step 9 – Install ADS-B decoding software
PiAware is FlightAware’s client, but it is not the software that decodes the radio signals and converts them into useful messages that contain aircraft information. This is handled by an application called dump1090. We install it as follows:

sudo apt install dump1090-fa

This should all run without errors and if so, you’re all set. I like to reboot the machine at this point such that we can verify that all services start by themselves on startup:

sudo reboot

At this point, your receiver station should be receiving and decoding messages and sending them to FlightAware servers. You can check this by navigating to http://IP:8080 to view local SkyAware data.

Step 10 – Create a FlightAware account and claim your receiver
If you haven’t done so yet, create a FlightAware account here. Go ahead and claim your receiver location here if this is your first receiver set-up. If you are re-configuring an old setup and want to continue with your previous feeder ID, run the following command in your PuTTY console:

sudo piaware-config feeder-id <feeder_id>

Replace <feeder_id> with the feeder ID that is listed on your old receiver’s page at FlightAware.com. Your new data will now be added to your old receiver’s statistics.

Step 11 – Install Mono and VRS
We will now install Mono and VRS. VRS is a Windows application and Mono enables you to run it on a Linux installation. Enter the following commands in PuTTY:

sudo apt install mono-complete
cd ~
mkdir VRS
cd VRS
wget http://www.virtualradarserver.co.uk/Files/VirtualRadar.tar.gz
tar -xvzf VirtualRadar.tar.gz
wget http://www.virtualradarserver.co.uk/Files/VirtualRadar.WebAdminPlugin.tar.gz
tar -xvzf VirtualRadar.WebAdminPlugin.tar.gz

Mono requires an additional configuration file to properly run on Linux. Create it by typing:

sudo nano VirtualRadar.exe.config

Copy and paste the contents of the XML snippet under ‘Mono 4 issues’ on this page to the file you just created. Press CTRL-O to save the file and CTRL-X to exit the text editor.

Step 12 – Change the VRS port
In my case, the default VRS port was already in use. We therefore change it to a different port by creating a new file on the Pi’s file system:

sudo nano ~/.local/share/VirtualRadar/InstallerConfiguration.xml

Again go to this page, but now copy-paste the contents under ‘Changing the web server port’ to the file we just created. Change the port number in this file to 8081 (or any value you like). Save and close by pressing CTRL-O and CTRL-X.

Verify that your VRS installation works by executing it:

cd ~/VRS
mono VirtualRadar.exe -nogui

If all goes well, no errors should occur and you should be able to access the Virtual Radar Server through the external IP address that is printed to the screen (or simply through your local network). Aircraft in your receiver’s range should be visible with default settings.

Step 13 – Access the Virtual Radar Server Web Admin panel
Shut down the VRS instance from step 12 by pressing ‘Q’ and type the following command:

mono VirtualRadar.exe -nogui -createAdmin:username -password:password

Replace ‘username’ and ‘password’ with a username and password combination of your choice. Now, log in to the VRS web admin panel. You should be able to reach it by navigating to the following address:

http://IP:8081/VirtualRadar/WebAdmin/Settings.html

In which you should replace ‘IP’ with the IP address of your Pi. Log in using the username and password you just created. If all goes well, you should now see the options screen of the Web Admin panel.

Step 15 – Configure VRS to start automatically at boot
For convenience, it is useful to set up VRS to start when the Pi boots up. This way, you can reboot the Pi without having to manually start the VRS server each time. This is done by executing the following commands through PuTTY:

cd ~
sudo nano vrs.sh

Copy and paste the following contents into the editor:

#!/bin/sh
mono /home/pi/VRS/VirtualRadar.exe -nogui

Save and exit by pressing CTRL-O and CTRL-X. Now execute the following (note, it might be necessary to use sudo for the first command):

chmod +x /home/pi/vrs.sh
crontab -e

Press ‘2’ (nano) if asked to choose a text editor. Append the following line to the file:

@reboot /home/pi/vrs.sh

Again, save and close by pressing CTRL-O and CTRL-X. Test your settings by rebooting the Pi and verifying that you can access the VRS server through the address found in step 12 (http://IP:8081/VirtualRadar)

sudo reboot

Step 14 – Configure VRS receivers through the Web Admin Panel
In the ‘Options’ panel, click ‘Receiver locations’ and add a new location. Give it a name and enter your latitude and longitude. You can find your latitude and longitude using simple tools available through Google.

Click ‘Receivers’ and add a receiver. Call it ‘MLAT’ or something similar. For the location, choose the location you just set. Under ‘Network’, change the port to 30106 – FlightAware sends back MLAT data through this port. Leave all other settings at their default values and close the window. You should now have two receivers, similar to mine below:

Screenshot of the VRS receivers tab
Receiver setup in VRS

Now go to ‘Merged Feeds’ and add a new one. Give it a suitable name and add both of the previously configured receivers (as shown above) to it. I called it ‘All aircraft’ for convenience. Close the window.

Go back to the ‘Receivers’ settings and set the ‘Web site receiver’ and ‘Closest aircraft receiver’ to the merged feed you just created. This way, by default all aircraft will be displayed when people visit your radar server.

Step 15 – Configure the VRS radar view settings
Now that the we have set up the receivers, we can continue by modifying the user interface to create a default user interface that we like. You might have noticed that my VRS site looks different than one with default settings.

To do this, start the server and open it in your browser. Configure the settings to your liking by pressing ‘Menu’ and then ‘Options’ in the top left corner of the map view. Now navigate to:

http://IP:8081/VirtualRadar/settings.html

And press ‘Export Settings’. Copy the contents of the text box that appears. Now navigate back to your Web Admin Panel which we accessed earlier (http://<IP>:8081/VirtualRadar/WebAdmin/Settings.html) and click ‘Initial Settings’. In the ‘Exported settings’ box, paste the contents of your clipboard. These will now be the default view settings for new visitors.

Step 16 – Optional: Add operator logos and aircraft silhouettes
Operator and aircraft logos can be added and will be displayed in the list right of the map display. They are available through several sources, but I downloaded mine through the Radarspotting forum. You will have to create an account to download the files. After acquiring the ZIP files, place them in designated folders on your Pi (for example, /home/pi/logos and /home/pi/silhouettes) and expand the zip files in these folders.

Go back to your Web Admin Panel options again and click on ‘Data Sources’. Add the paths you created to the ‘Flags folder’ and ‘Silhouettes folder’. This should look something like this:

Screenshot of the VRS data sources tab
VRS Data Sources configuration

After saving these settings, the flags and silhouettes should show up in your list of aircraft, provided that you activated these columns in the settings menu.

Step 17 – Forward your VRS port
Now that everything is up and running and configured, we can forward the port we chose. In my case, this is port 8081. The process varies for each router and many tutorials are available online. A Google search query should help you with this. You will need to forward the port for the Pi’s IP address, so keep it handy.

After forwarding the port, you should be able to access your VRS web display through your WAN (Wide-Area Network) IP address. Other parts of the address will stay the same.

Step 18 – Link a domain name
Instead of having to type out the IP address when accessing your VRS website, you can also purchase a domain name and create an A record in the domain’s DNS settings, such that you can access your VRS website in the following way (example):

http://adsb.mywebsite.com:8081/VirtualRadar

This looks much better. Again, creating a DNS record is different for each domain/hosting service and your service provider will be able to provide support if you want to do this but are not sure how to go about it. Final tip: if you forward your VRS server to port 80, you can leave out the port in the URL as well! This only works if you don’t have other applications that require port 80 to work (e.g. a webserver).

This ends the guide. I hope it was helpful. Please send me a message if you find any errors in the guide. Thanks for reading!

Leave a comment

Your email address will not be published. Required fields are marked *