A different approach to tracking aircraft using Docker with your Raspberry Pi and a USB TV stick. Instead of installing everything by hand in a single environment we will be using separate docker containers for each feeder instance.
Inspired by great work from the following people:
- Alex Ellis' blog post: Get eyes in the sky with your Raspberry Pi
- Alex Ellis' original github project
- LoungeFlyZ enhanced github project which added the FlightRadar24 feed
- Mike, mikenye - Docker images for readsb, tar1090
- wiedehopf's tar1090
We will start from a bare-bone Raspberry Pi installation but you can skip the initial parts if you already have an existing setup that you want to adapt.
The following steps are performed on a MacBook - the steps might be slightly difference if you use a PC (Windows or Linux). I assume you are able to translate this accordingly.
-
Download the latest Raspbian Lite image https://www.raspberrypi.org/downloads/raspbian
-
Burn the image on a micro SD card, you will need a SD card of at least 16 GB.
-
Connect the micro SD card to your Mac/PC
The SD card will be visible as a volume called
boot
- this is the FAT32 partition on the SD card. There is also a hidden Linux ext4 partition on the SD card. -
Enable SSH
Add an empty
ssh
file on the boot partition to enable SSH:$ touch /Volumes/boot/ssh
-
Enable WiFi connection (Optional)
I prefer to use the Ethernet connection but if you would like to use WiFi to connect your Raspberry Pi to your local network then you need to add a new file
wpa_supplicant.conf
on the boot partition (I use vim in the example below, you can use your favourite text editor):$ touch /Volumes/boot/wpa_supplicant.conf $ vim /Volumes/boot/wpa_supplicant.conf
Add the following content to the
wpa_supplicant.conf
file:country=be update_config=1 ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev network={ ssid="your SSID" scan_ssid=1 psk="your password" key_mgmt=WPA-PSK }
-
Connect and start Raspberry Pi.
Connect the network cable (if applicable) and the power cable. DO NOT connect the DVB-T receiver at this time!
-
connect to the raspberry Pi using SSH:
$ ssh [email protected]
Or replace
raspberrypi.local
by the IP address of the Raspberry Pi if you are able to find out the IP address. -
Change default password
$ passwd
-
Update Raspbian
$ sudo apt-get update -y $ sudo apt-get upgrade -y
This configuration is optional unless you want to easily connect to your Raspberry Pi by always using the same IP address. Depending on your local setup - add the confguration part from the Ethernet or the WiFi setup below to the file /etc/dhcpcd.conf
.
$ vi /etc/dhcpcd.conf
interface eth0
static ip_address=192.168.0.212/24
static routers=192.168.0.1
static domain_name_servers=8.8.8.8
interface wlan0
static ip_address=192.168.0.212/24
static routers=192.168.0.1
static domain_name_servers=8.8.8.8
Raspbian can be time sync'ed automatically (In this example we will use UTC time as this is the international aeronautical standard).
$ sudo timedatectl set-timezone UTC
$ sudo timedatectl set-ntp true
Check the status of the time sync:
$ timedatectl status
Local time: Sun 2021-01-31 21:30:17 UTC
Universal time: Sun 2021-01-31 21:30:17 UTC
RTC time: n/a
Time zone: UTC (UTC, +0000)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
$ timedatectl show
Timezone=UTC
LocalRTC=no
CanNTP=yes
NTP=yes
NTPSynchronized=yes
TimeUSec=Sun 2021-01-31 21:34:08 UTC
The time server used can optionally be adjusted:
$ sudo vim /etc/systemd/timesyncd.conf
[Time]
NTP=<custom ntp server address>
blacklist your DVB-T receiver to avoid the loading of the default driver:
$ sudo sh -c "echo 'blacklist dvb_usb_rtl28xxu' > /etc/modprobe.d/blacklist-dvbt.conf"
If this is not done correctly, DUMP1090 will give the following error when starting: Error opening the RTLSDR device: Device or resource busy
At this point reboot your Raspberry Pi (disconnect the power and connect again) and connect your DVB-T receiver.
$ sudo reboot
Connect again to your Raspberry Pi using SSH:
$ ssh [email protected]
-
install Docker on your raspberry pi:
$ curl -sSL https://get.docker.com | sh
-
Optionally (security risk!) if you would like to run docker commands without using sudo:
$ sudo usermod -a -G docker pi
-
Install docker-compose and git:
$ sudo apt-get -y install git python python-pip libffi-dev python-backports.ssl-match-hostname $ sudo pip install docker-compose
-
Reboot
To finalize reboot your Raspberry Pi and connect again using SSH
$ sudo reboot
-
Clone this GIT repository on your raspberry pi:
$ git clone https://github.com/filipjonckers/pi-adsb-docker $ cd pi-adsb-docker
-
Edit docker-compose.yml if required (Optional)
$ cp docker-compose.yml.template docker-compose.yml $ nano docker-compose.yml
Create a copy of the example file and set your latitude and longitude in dump1090fa.conf
:
$ cp dump1090fa/dump1090fa.conf.example dump1090fa/dump1090fa.conf
$ vi dump1090fa/dump1090fa.conf
Example dump1090fa.conf
:
DUMP_LAT=51.0
DUMP_LON=4.0
Create a copy of the example file and set your latitude and longitude in tar1090.conf
:
$ cp tar1090/tar1090.conf.example tar1090/tar1090.conf
$ vi tar1090/tar1090.conf
Example tar1090.conf
:
LAT=51.0
LONG=4.0
TZ=UTC
BEASTHOST=dump1090fa
# MLATHOST=dump1090fa
Note: MLAT currently not active in dump1090fa.
Create a copy of the example file and set your FR24 key in fr24feed.ini
:
$ cp fr24/fr24feed.ini.example fr24/fr24feed.ini
$ vi fr24/fr24feed.ini
Example fr24feed.ini
:
receiver="avr-tcp"
host="dump1090fa:30002"
fr24key="XXXXXXXXXXXXXXXXX"
bs="no"
raw="no"
logmode="2"
windowmode="0"
logpath="/var/log"
mlat="yes"
mlat-without-gps="yes"
gt="60"
Create a copy of the example file and set your FlightAware key in piaware.conf
:
$ cp flightaware/piaware.conf.example flightaware/piaware.conf
$ vi flightaware/piaware.conf
Example piaware.conf
:
receiver-type other
receiver-host dump1090fa
receiver-port 30005
feeder-id XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
mlat-results yes
mlat-results-anon yes
allow-modeac yes
mlat-results-format beast,connect,dump1090fa:30104
Nothing to be done.
-
docker-compose up
$ docker-compose up -d
-
browse to your raspberry pi's ip address on port 8080
http://raspberrypi.local:8080 (replace with your ip address)
You should now see dump1090's web interface.
Log into your FlightAware account and find your new feeder on the "My ADS-B" page. Every time a new feeder is detected FlightAware assigns a unique identifier (guid) to it. To ensure your piaware container is not seen as a new feeder each time it is restarted you need to get the "unique identifier" from your My ADS-B stats page and set it in the piaware.conf
file.
Before you can feed FlightRadar24.com you need to create an account on their website. Then you need to run the container with a signup command to register and generate your key.
If you dont want to feed FlightRadar24.com comment out the flightradar service in the docker-compose.yml
$ docker run --rm -it loungefly/raspbian-flightradar24 /usr/bin/fr24feed --signup
- Enter your accounts email address
- Leave blank
- yes
- Enter your latitude
- Enter your longitude
- Enter your altitude in feet
- Enter 'yes' to confirm
You should be given a key that you can copy and enter into fr24feed.ini
file.
Make sure that your external IP address is used as an ADS-B station in your profile. Use the statistics page to monitor the performance of your feed.
Use the feeder status check page to monitor the link status of your feed.
Use the docker container name to show the logs for each feeder:
$ docker logs fr24
$ docker logs adsbexchange
$ docker logs piaware
$ docker logs adsbhub
$ docker logs dump1090fa