October 28th, 2018

Building a FLARM / ADS-B receiving station

completed

So here it begins!

For different reasons, I needed to build a FLARM / ADS-B receiving station. Well sure...but what is ADS-B and FLARM?

Let's do a little reminder : ADS-B is an airplane surveillance systeme. To make it work, you need at the same time an emitting device and a receiving station. The emitting device is simply constantly broadcasting the position of the aircraft in which it is embedded, but also its speed, direction, identification, altitude, and a lot of other data. It can be used not only to constantly watch the position and altitude of a defined aircraft on ground, but also as anti-collision system, because each aircraft that have it (it is mandatory on big commercial airplanes) can constantly receive the other aircrafts position and calculate in real-time a probability of collision, which can then trigger an alarm if the plane is going toward another one.
However, this system is big and expensive and therefore another system was invented by a swiss compagny to increase airworthiness on smaller flying objects (helicopters, light aircrafts, gliders, drones...) which is called FLARM and is basically the same principle, but less expensive, very light, which fewer transmit capabilities.

The range of ADS-B message can go until hundreds of kilometers, but FLARM messages can be received only on fewer distances (dozens of km in good cases). The goal of building such a 'radar' station, which is actually simply receiving broadcasted ADS-B and FLARM messages, is therefore to increase airworthiness by increasing the number of stations on ground, which helps increasing the cover and therefore having the data of every aircraft available for everybody on internet, might they be pilots or not.

Let's now get our hands dirty! The recipy is quite simple : you need an antenna tuned on good frequency, a SDR (software defined radio) and a computer to process the signals and upload the data to the internet. The principle is exactly the same for the FLARM and ADS-B, the only difference is the antenna length and the frequency on which the SDR will be tuned. For the SDR, we will use the very popular RTL-SDR usb dongle, for the computer the classic Raspberry Pi (here a 3 B+ model), and for the antenna as I didn't had too much time I decided to buy a half-wave antenna from JetVision shop. I also had to buy some other components, because I had a few constraints for this station, amongst which:

  • make everything fit inside a nice enclosure
  • having some kind of heat dissipation (passive or active) on the enclosure, because eveything inside can heat a bit with continuous operation
  • having the ethernet connexion accessible through the box
  • being able to withstand dust
  • all the power should come from the same source
  • being able to easily install anywhere the box
  • being able to visually see the status of the station, but also the FLARM and ADS-B detection status (still tbd), on the box
  • being somehow able to integrate as well a weather station somwehere, because it is always usefull.
For the complete BOM I invite you to check this file (CSV) : Radar Station BOM.

Now the fun part: building it! Or assembling should be a more adequate word.
After a couple of hours, let's see the result :

img_station_1

So what's inside this nice enclosure?

First we can see on the bottom left the power supply, which can provide 5V and 12V. It powers the Raspberry Pi (5V), which is inside the red case, and the black usb hub (12V powered) just below the red case, which is used to compensate for the poor usb power capabilities of the Raspberry Pi. On the left of the USB hub are plugged two RTL-SDR (you can see two long silver aluminium cases, with heatsink ziptied on it), where you can plug the antennas for the FLARM and the ADS-B. The big white cylinder is a 868 Mhz receiver for an Accurite weather station. Finally, as I needed one ethernet connexion for the Raspberry Pi, and another one for the weather station receiver, I had to add the white ethernet switch that you can see on the top of the red Raspberry Pi case. Also, you can see some wire going on the left 'wall' of the box, to power a 12V fan. On the opposite side of the box you can guess an air filter, so that the air going inside the box is not containing dust particles.

Let's now install the LEDs on the cover to close the box! After a bit of time drilling, making holes, soldering and heat-shrinking, here is the result:

img_station_2

How is this connected to the rest of the radar station? I basically drilled some holes and put some pins on the cover of the raspberry pi. On the bottom of it, the resistor for LEDs connected to the pins of the raspi. On the top, the pins. On the box cover, I soldered to the LEDs some wires with headers. That way, it is really easy to unconnect and connect again the cover when you open the station for any reason. Here is an overview of the whole, with the antennas connected (the long one is for ADS-B, the shorter for FLARM):

img_station_2 img_station_2


To update the status of the LEDs, I used the classic python library RPi.GPIO : my basic python script is checking if the processes corresponding to the FLARM and ADS-B are running. If so, it updates accordingly the corresponding status LEDs on the cover using RPi.GPIO library. The python script is running continuously, updating the status of the LEDs and the database every 2s (i can set it according to my needs). Inside the script there is also some lines of code to update a mySQL database with the current timestamp. This enables me to check the status of the station from anywhere : in particular, I made an iOS app that can check the status of my FLARM/ADS-B stations (I made 3 of these).

You can find this script here: RS-Check script

This python script is started at raspberry pi startup by a shell script located in the /etc/init.d files:
You can find this script here: shell script

To install theses scripts you can run these linux commands:

Sudo mkdir /home/pi/rs-check
Sudo wget http://iotandeverythingelse.me/electronics/file_building_a_flarm_adsb_receiving_station/rs-check -O /home/pi/rs-check/rs-check.py
Sudo wget http://iotandeverythingelse.me/electronics/file_building_a_flarm_adsb_receiving_station/rs-status-check -O /etc/init.d/rs-status-check
Sudo chmod +x /etc/init.d/rs-status-check
Sudo update-rc.d rs-status-check defaults