- Published on
Setting up an ADS-B tracker using Docker
- Authors
- Name
- Jonathan Devere-Ellery
- Project introduction
- Installation Method
- Install and Configure the Raspbian Operating System
- Install and configure Docker
- Managing services using Docker-Compose
- Upgrading container versions using Docker-Compose
- Access the Tar1090 / Graphs1090 URLs
Project introduction
ADS-B is a technology used by aircraft to automatically determine their position and send that data to air traffic controllers and other aircraft. The technology relies on GPS and other data sources to determine the aircraft's position, and then broadcasts that information to other aircraft and controllers.
Since these messages are broadcast anyone with an antenna tuned at 1090 MHz can also receive and decode the messages, and view the locations of nearby aircraft. If you have ever used sites such as FlightRadar24, FlightAware or ADS-B Exchange, these all work on the same principal but they aggregate messages from volunteers across the globe to map it in a central place.
If you are interested in the structure of how ADS-B messages are formatted, you can find more at https://mode-s.org/decode/content/ads-b/1-basics.html
Installation Method
Install and Configure the Raspbian Operating System
Since I'm installing everything on a Raspberry Pi (obviously), I'm going to install the Raspberry Pi OS (aka Raspbian) onto a SD card. The easiest way to do that is to install the imager tool by running choco install rpi-imager
.
Enable SSH services in the OS by creating an empty ssh
file in the root of the SD card. We also need to modify the config.txt to adjust fan speeds on the POE hat attached to the raspberry pi:
New-Item -Path D:\ssh -ItemType File
Invoke-Item -Path D:\config.txt
# PoE Hat Fan Speeds
dtparam=poe_fan_temp0=70000,poe_fan_temp0_hyst=5000
dtparam=poe_fan_temp1=75000,poe_fan_temp1_hyst=5000
dtparam=poe_fan_temp2=80000,poe_fan_temp2_hyst=5000
dtparam=poe_fan_temp3=82000,poe_fan_temp3_hyst=5000
SSH to the IP of the raspberry pi. Default username will likely be pi
and password raspberry
and should be changed to something secure immediately using raspi-config.
sudo raspi-config
sudo apt-get update && sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get install unattended-upgrades
We should turn off power saving for wlan0 network interface to avoid getting knocked offline
journalctl | grep brcmfmac:
/sbin/iw wlan0 get power_save
sudo nano /etc/rc.local
# Add /sbin/iw wlan0 set power_save off before "exit 0"
Install and configure Docker
It is not possible to install Docker on Raspbian from a repository, and instead it needs the convenience script
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo apt-get install -y libffi-dev libssl-dev python3 python3-pip
sudo apt-get remove python-configparser
sudo pip3 install docker-compose
docker-compose --version
sudo usermod -aG docker pi
su -s pi
docker run --rm hello-world
sudo nano /etc/docker/daemon.json
{
"log-driver": "json-file",
"log-opts": {
"max-size": "10m",
"max-file": "3"
}
}
sudo systemctl restart docker
sudo mkdir -p /opt/adsb
sudo chown pi adsb
cd /opt/adsb
nano docker-compose.yml
version: '2.0'
networks:
adsbnet:
volumes:
graphs1090_rrd:
services:
readsb:
image: mikenye/readsb:latest
tty: true
container_name: readsb
restart: always
devices:
- /dev/bus/usb/001/004:/dev/bus/usb/001/004
ports:
- 8079:8080
- 30005:30005
networks:
- adsbnet
environment:
- PULLMLAT=piaware:30105,adsbx:30105,rbfeeder:30105
- TZ=Europe/Amsterdam
command:
- --dcfilter
- --device-type=rtlsdr
- --json-location-accuracy=2
- --lat=<lat>
- --lon=<long>
- --modeac
- --ppm=0
- --net
- --stats-every=3600
- --quiet
- --write-json=/run/readsb
adsbx:
image: mikenye/adsbexchange:latest
tty: true
container_name: adsbx
restart: always
environment:
- BEASTHOST=readsb
- TZ=Europe/Amsterdam
- LAT=<lat>
- LONG=<long>
- ALT=<altitude>
- SITENAME=<sitename>
- UUID=<uuid>
networks:
- adsbnet
tar1090:
image: mikenye/tar1090:latest
tty: true
container_name: tar1090
restart: always
volumes:
- /var/globe_history:/var/globe_history
environment:
- TZ=Europe/Amsterdam
- BEASTHOST=readsb
- MLATHOST=readsb
- LAT=<lat>
- LONG=<long>
- ENABLE_TIMELAPSE1090=true
- TIMELAPSE1090_HISTORY=72
- TAR1090_BINGMAPSAPIKEY=<apikey>
networks:
- adsbnet
ports:
- 8078:80
graphs1090:
image: mikenye/graphs1090:latest
tty: true
container_name: graphs1090
restart: always
volumes:
- graphs1090_rrd:/var/lib/collectd/rrd
ports:
- 8075:80
environment:
- BEASTHOST=readsb
- MLATHOST=readsb
- TZ=Europe/Amsterdam
- LAT=<lat>
- LONG=<long>
networks:
- adsbnet
fr24:
image: mikenye/fr24feed:latest
tty: true
container_name: fr24
restart: always
ports:
- 8754:8754
environment:
- BEASTHOST=readsb
- FR24KEY=<code>
- TZ=Europe/Amsterdam
- MLAT=yes
networks:
- adsbnet
piaware:
image: mikenye/piaware:latest
tty: true
container_name: piaware
restart: always
ports:
- 8081:8080
environment:
- TZ=Europe/Amsterdam
- LAT=<lat>
- LONG=<long>
- FEEDER_ID=<code>
- BEASTHOST=readsb
networks:
- adsbnet
rbfeeder:
image: mikenye/radarbox:latest
tty: true
container_name: rbfeeder
restart: always
environment:
- TZ=Europe/Amsterdam
- BEASTHOST=readsb
- LAT=<lat>
- LONG=<long>
- ALT=<altitude>
- SHARING_KEY=<code>
networks:
- adsbnet
pfclient:
image: mikenye/planefinder:latest
tty: true
container_name: pfclient
restart: always
ports:
- 30053:30053
environment:
- TZ=Europe/Amsterdam
- BEASTHOST=readsb
- LAT=<lat>
- LONG=<long>
- SHARECODE=<code>
networks:
- adsbnet
opensky:
image: mikenye/opensky-network:latest
tty: true
container_name: opensky
restart: always
environment:
- TZ=Europe/Amsterdam
- BEASTHOST=readsb
- LAT=<lat>
- LONG=<long>
- ALT=<altitude>
- OPENSKY_USERNAME=<user>
- OPENSKY_SERIAL=<pass>
networks:
- adsbnet
Managing services using Docker-Compose
Now that we have our docker-compose.yml
file setup we can manage everything using the docker-compose command. From within the /opt/adsb folder we can start all the services by running docker-compose up -d
and alternately we can stop the services by running docker-compose down
Upgrading container versions using Docker-Compose
New versions of containers will get released, and we should update regularly to get new features but also to ensure bugs are fixed, so in order to keep everything updated we can run the below docker-compose commands to get the latest versions:
cd /opt/adsb
docker-compose down
docker-compose pull
docker-compose up -d
Access the Tar1090 / Graphs1090 URLs
Now that we have running containers we should be able to access the URLs for the various web interfaces:
- Tar1090 - Web interface for viewing flights - https://
<ip>
:8078 - Readsb / Dump1090 - Alternate Web interface for viewing flights - https://
<ip>
:8076 - Graphs1090 - Graphs showing receiver performance over time - https://
<ip>
:8075
Now we should be able to enjoy watching flights going by. Enjoy.