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.
Now the fun part: building it! Or assembling should be a more adequate word.
After a couple of hours, let's see the result :
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:
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):
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/building_a_flarm_adsb_receiving_station/file/rs-check -O /home/pi/rs-check/rs-check.py
Sudo wget http://iotandeverythingelse.me/electronics/building_a_flarm_adsb_receiving_station/file/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
I recently had to create a little case to log 4G data (mainly signal strength), GPS data (fix, number of sattelites, ...) and Magnetic data (to ensure magnetic interferences are kept to a minimum), in order to survey different sites for a possible usage of drones.
After a quick reflexion, it was decided that the constraints would be the following:
- The case should be portative enough to fit inside a normal bag or even a leather satchel/bag.
- The case should be powered either by direct power (AC inlet) or an internal battery.
- The case should obviously be waterproof.
- The case should be able to be used for at least 5h on battery.
- There should be a screen to visualize the data quickly in a few minutes (a 'quick survey' mode).
- It should use the same components as on the drone we want to use after, to have a data consistency.
- The data should be stored inside a log, whatever the form, so the data can be reviewed later.
- If the case is to be used for travelling, then the internal battery should be taken out during a flight dor example, due to all the regulations with batteries. So it should be a battery that can be quickly plugged in/out of the case. So, as the battery has some chances on going on the bottom of the case - for balance and placement reasons - the top of the case should be removed easily to put in the battery.
- The compass should be external, plugged on the outside of the case, so the box itself doesn't generate magnetic interferences that are recorded.
- It should be possible to recharge the battery while powered on ground power, so a transformer must be used, which, due to size constraints, will mean that it's gonna emit a bit of heat: some openings should be done on the 'top cover' so that the heat spreads out evenly inside the box.
- There should be some buttons, at least to power on/off and change the power source (battery/ground power).
- Who means logs means files, means an easy way to move it from the box to a computer: I will store the logs on an SD card, which should be easily exccessible.
I already have one instance of the magnetometer I want to use - a AK09916C based board - and of the desired GPS - a ublox NEO M8N.
For the 4G Modem, I also already have 'in stock' what I want to use: a USB based Hologram 4G Modem called Nova, with an external antenna.