Reading time: 2 minutes
Monitoring the sky - dump1090 to InfluxDB
You may know that i’m very interested in aviation, despite the fact that i had a quite severe case of “being totally afraid of flying” in the past. Or perhaps exactly because i’m afraid of flying.
I’m am so interested in it that i have an ADS-B receiver ( Automatic Dependent Surveillance–Broadcast) at home and i’m feeding data to Flightaware. You may have already surmised out of a number of articles that i’m using Grafana and InfluxDB to collect and present data around my home. So it was a rather obvious task to do this for my ADS-B receiver as well.
In order to receive ADS-B data I’m using piaware from Flightaware. At the end it uses an DVB-T stick as an software defined radio to listen on 1090 MHz and it’s decoding the transmissions of aircrafts who send out a number of information like coordinates, courses, altitude and so on. This is for collision avoidance and in future for traffic control. The core of the piaware suite is dump1090. As it’s dumping data from 1080 MHz the source of the name of the tool is quite obvious. Despite being called piaware it doesn’t run on a Raspberry Pi here but on a server.
Aside of transmitting the data to Flightaware, it provides some local interfaces to access the information it collects. The webinterface on 8080 doesn’t only provide you with a nice map, but with a number of JSON feeds as well. For a while i used one of it to alert me when LH454 was passing by in line of sight to get some “Fernweh”. LH454 is the flight from FRA to SFO.
I tapped into those feeds to collect data from the receiver for my monitoring as well, however i din’t used Telegraf for this as i needed to do some preprocessing like calculate the distance and the bearing.
For this i wrote a small python script. You can download it from Github. In order to get it to work you have to change some variables at the start of the script.
In addition you have to install two python libraries.
Obviously you should do this in a virtual environment. I omitted this for purposes of shortness of this article.
You now just have it to put it into cron to run it every minute. From there you can just use the measurements in InfluxDB for Grafana dashboards.