📜 ⬆️ ⬇️

Step by step: Transmit data to flightradar24



1. Introduction


My current activity has nothing to do with aviation, but it so happened that I got sick of it. At what exact moment it happened - it is difficult to say, probably the first flight contributed greatly to this. After some time, I began to watch films on aviation topics, be interested in the structure and differences in airplanes and look for how to connect my activities with a little bit of my hobby. So I got acquainted with ADS-B technology and its unexpected use among enthusiasts - radarspotting. In the open spaces of Habr, articles on this topic do not often appear ( one , two ). Therefore, here I want to talk a little on the topic of radar spotting and describe in detail the process of creating a self-broadcasting data to the popular resource flightradar24 .
So, everyone who is interested (sick) in the subject of aviation and aircraft observation, and also wants to take part in this directly, welcome under the cat.

2. What is radarspotting


Radarspotting is one of the types of spotting (from the word spot - watch), a type of hobby in which aircraft are monitored using special receivers and software, which allows you to process data received from aircraft and presents them in a convenient form for the observer. The radarspotting is based on the ADS-B technology, with the help of which an aircraft equipped with an ADS-B transponder can receive parameters such as the ICAO address of the aircraft, its location coordinates, course, altitude, horizontal and vertical speed.
')
Usually, the whole software complex consists of two parts:

The choice of a particular software depends, first of all, on the type of receiver and the task. For example, if you have a microADSB receiver and you want to see which flights are within the range of your antenna, you can use the ADSBScope + PlanePlotter combination .

But in this case, you will be able to observe only the local area, the boundaries of which are established by the antenna connected to the receiver. It seems to me that it is much more interesting to observe a large-scale picture, data to which flows from tens of thousands of devices (including yours) located around the globe.

So we smoothly approached the heading - to organize our own data transmission to one of these services, without resorting to large financial expenses.

3. Material base


To build your own data center, you need:

3.1 ADS-B receiver

At the initial stage, a USB DVB-T receiver based on the RTL2832 chipset is perfect for this purpose. Such a device can be ordered on the same Ebay for a symbolic $ 7-9 .
image

More information about the operation of this device can be read here . If you want to use something more seriously, here is a fairly large number of different ADS-B receivers.

3.2 Receiving antenna at 1090 MHz

Here everything is much more complicated. Since The signal from the ADS-B transponder is very weak, it is desirable to have a dipole antenna installed vertically upwards with a length of 69 mm elements. Very much will depend on the type of construction and the accuracy of the manufacture of this device.
On sale there are both homemade and industrial versions of antennas, but the price of both options for the initial level leaves much to be desired.

When self-manufacturing antenna, you can pay attention to options such as Franklin's antenna , or vertical collinear . I refused the antenna of Franklin due to the fact that it was almost impossible to withstand precise geometrical dimensions when making it at home (in haste).
It is necessary to ensure that the half-wave vibrators are strictly vertically and lay in the same plane, otherwise the whole meaning is lost. In addition, there is a lot of controversy about where in the antenna you need to attach the cable.

In this regard, it was decided to stop at the “Vertical Collinear” design, namely, on this version:
image
View in high quality ( without registration and sms ), in 3D - you need Creo View Express .

As the base of the antenna, I used part of the high-frequency connector SR-75-166F :
image

The other part of the connector is connected to the cable for connecting the antenna to the DVB-T receiver. For this purpose, you must use the appropriate cable. From the forums I found out that the cable with a resistance of 75 Ω from satellite TV is well suited.

The elements of the antenna itself were made of copper wire Ø2 mm . The dimensions of the elements and the assembly scheme are in the drawing .
The main difficulty is the creation of 2 turns of a given length L = 69 mm . Here I adapted a tube of a suitable diameter and this is what happened:
image

When installing this structure in open space (the most optimal variant), the entire assembly, in order to avoid oxidation of copper elements and setting additional strength, is usually placed in a special casing made of PVC tubing of the appropriate diameter.

I simplified the task a bit and placed the whole structure under the roof:
image

3.3 Software and hardware

Officially, flightradar has software for Windows , Linux , OSX and Raspberry Pi . A special thrill from this list causes support for Linux, since in this case, you can try to deploy the entire kitchen on a regular home router with a USB port and custom firmware (OpenWrt). But more about that another time.

This task was decided to run on an existing Linux server running CentOS 6.7 x86_64 . All further installation steps will relate exclusively to this version of the OS !

The software package for flightradar24 consists of 2 modules:
  1. dump1090 - for receiving and decoding data;
  2. fr24feed is a daemon that will broadcast the received data to the flightradar24 servers.

Unlike the same Ubuntu, for CentOS they do not have ready installation * .rpm- packages, so all the software will have to be assembled manually, and some modules will need to be compiled from source. At the time of this writing, the latest software version from flightradar was 1.0.18-5 .

NTP configuration

When translating data, the exact time value on the host machine at the time of receiving ADS-B packets plays a very important role. CentOS uses the ntpd daemon to synchronize time.
Configure NTP service:
Open the file /etc/sysconfig/ntpdate and set SYNC_HWCLOCK=yes
Open the /etc/ntp.conf file and set the addresses of NTP servers. In my case, it looks like this:
server 0.by.pool.ntp.org
server 1.ru.pool.ntp.org
server 2.europe.pool.ntp.org

Configure the service start and synchronize the time:
# service ntpd start
# chkconfig --level 345 ntpd on
# ntpdate 0.by.pool.ntp.org


Install fr24feed

Receive and unpack the archive:
# wget http://feed.flightradar24.com/linux/fr24feed_1.0.18-5_amd64.tgz
# tar -zxvf fr24feed_1.0.18-5_amd64.tgz


Inside the archive are:
fr24feed - binary file;
version.txt - a text file indicating the software version;
LICENSE.fr24feed - license agreement.

We decompose files in directories:
# cp fr24feed /usr/bin/
# chown root.root /usr/bin/fr24feed
# chmod 755 /usr/bin/fr24feed
# mkdir -p /usr/share/doc/fr24feed
# cp LICENSE.fr24feed /usr/share/doc/fr24feed
# chown -R root:root /usr/share/doc/fr24feed
# chmod 755 /usr/share/doc/fr24feed
# chmod 644 -R /usr/share/doc/fr24feed/*.*


Attempt to run:
# cd /usr/bin/
# ./fr24feed


In response, we, in most cases, will receive the following warning:
./fr24feed: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by ./fr24feed)
./fr24feed: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.19' not found (required by ./fr24feed)
./fr24feed: /usr/lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by ./fr24feed)
./fr24feed: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ./fr24feed)

which means that there are no necessary libraries in the system. Everything is simple and difficult at the same time: you need to update the libc and libstdc ++ libraries to the required versions. If you use standard CentOS repositories, then all the same necessary versions of libraries will not be there. Switching to CentOS 7 will not completely solve this problem.

The libstdc++.so.6 is included in the GCC 4.9 package, which will have to be built manually.
Go:
# wget https://ftp.gnu.org/gnu/gcc/gcc-4.9.3/gcc-4.9.3.tar.gz
# tar -zxvf gcc-4.9.3.tar.gz
# cd gcc-4.9.3/


Before you start building GCC, you need to deliver the modules that will be needed in the process:
# yum install gcc gcc-c++
# yum install zip


Download additional components:
# ./contrib/download_prerequisites
Configuration ( --disable-multilib - build a 64-bit compiler; --enable-language=c,c++ is a set of supported languages):
# ./configure --disable-multilib --enable-language=c,c++
Assembly and installation:
# make && make install

The package building process will take quite a long time. On a virtual machine with one core and 1 Gb of RAM, it took 5-6 hours of time and 6 Gb of disk space.

When the package is installed, the libraries will be copied to /usr/local/lib64 . In order for them to be available to the application, it is necessary to set the path in the environment variable LD_LIBRARY_PATH .
To make the value of this variable available after a system reboot, we will make changes to the .bashrc , which is located in the user's home directory:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib64

Libc.so.6 update
To update libc.so.6 download packages:
# wget http://ftp.vim.org/ftp/pub/ftp/os/Linux/distr/redsleeve/steam/glibc-2.15-60.el6.x86_64.rpm
# wget http://ftp.vim.org/ftp/pub/ftp/os/Linux/distr/redsleeve/steam/glibc-common-2.15-60.el6.x86_64.rpm
# wget http://ftp.vim.org/ftp/pub/ftp/os/Linux/distr/redsleeve/steam/glibc-devel-2.15-60.el6.x86_64.rpm
# wget http://ftp.vim.org/ftp/pub/ftp/os/Linux/distr/redsleeve/steam/glibc-headers-2.15-60.el6.x86_64.rpm


Install:
# rpm -Uvh glibc-2.15-60.el6.x86_64.rpm glibc-common-2.15-60.el6.x86_64.rpm glibc-devel-2.15-60.el6.x86_64.rpm glibc-headers-2.15-60.el6.x86_64.rpm

For reliability, it is better to once again check the launch of fr24feed.

Install dump1090

We put the necessary components for USB:
# yum install libusb1
# yum install usbutils


We connect our “whistle” and check how the system “sees” it:
# lsusb
This response indicates the correct definition of the device:
Bus 001 Device 002: ID 0bda:2838 Realtek Semiconductor Corp. RTL2838 DVB-T

Dump1090 requires a set of librtlsdr libraries. In fact, rtl_sdr is a driver that provides “non-target” use of the tuner and allows you to receive ADS-B signals. Fortunately, in the EPEL repositories there is a ready-made * .rpm package:
# wget http://dl.fedoraproject.org/pub/epel/7/x86_64/r/rtl-sdr-0.5.3-3.el7.x86_64.rpm
# yum install ./rtl-sdr-0.5.3-3.el7.x86_64.rpm


You can install dump1090 yourself by assembling from source (a project on GitHub), or download again at your own risk and risk * .rpm- package (oh, how much I love everything ready) from the OpenSuse repositories:
# wget http://download.opensuse.org/repositories/hamradio/openSUSE_Tumbleweed/x86_64/dump1090-1.10.3010.14-3.17.x86_64.rpm
# yum install ./dump1090-1.10.3010.14-3.17.x86_64.rpm


First start

And so, we are almost close to the goal, there are only a couple of actions left:
1. Register on flightradar24 .

2. Run fr24feed:
# cd /usr/bin
# ./fr24feed --signup

Step-by-step tuning will begin - follow the instructions:
Enter the e-mail, which was specified during registration
Step 1.1 - Enter your email address (username@domain.tld)
$:my_email@google.com


If you previously produced data broadcasting on a flightradar, then you can skip this item , you probably should have a unique key - enter it, or leave the field blank
Step 1.2 - If you used to feed FR24 with ADS-B data before enter your sharing key.
$:


If you wish, we can take part in the calculation of the coordinates of the aircraft using the MLAT technology - at your discretion
Step 1.3 - Would you like to participate in MLAT calculations? (yes/no)$:no

If you are near the airport, enter the airport code, or leave the field blank
Step 2 - Enter nearest airport code (IATA or ICAO)
Enter airport code or leave empty$:


Enter the coordinates (latitude and longitude) of the location of the antenna with an accuracy of 4 decimal places. Well, here is the ever-present Google Maps.
Step 3.A - Enter antenna's latitude (DD.DDDD)
$:_
Step 3.B - Enter antenna's longitude (DDD.DDDD)
$:_


Indicate (in feet) the height of the antenna position above sea level (see here )
Step 3.C - Enter antenna's altitude above the sea level (in feet)
$:_


The program will generate and prompt you to continue.
Validating email/location information...OK
Enter your choice (yes/no)$:yes


Choose the type of receiver
Step 4.1 - Receiver selection:
1 - DVBT Stick (USB)
Enter your receiver type (1-7)$:1


The program checks the location of dump1090. If necessary, you can specify additional parameters.
Checking for dump1090...FOUND
Step 4.3 - Enter your additional dump1090 arguments or leave empty
$:


Allow data exchange on 30002 and 30003 ports
Step 5.1 - Would you like to enable RAW data feed on port 30002 (yes/no)$:yes
Step 5.2 - Would you like to enable Basestation data feed on port 30003 (yes/no)$:yes


Set the size and location of the * .log file
Step 6A - Please select desired logfile mode:
2 - 72 hour, 24h rotation
Select logfile mode (0-2)$:2
Step 6B - Please enter desired logfile path (/var/log):
$:/var/log/fr24feed

Submitting form data...OK
Saving settings to /etc/fr24feed.ini...OK


This completes the fr24feed pre-configuration. The settings will be saved in the /etc/fr24feed.ini file. In addition (read between the lines), you will receive a unique radar identifier and exchange key.

3. Creating the fr24feed daemon
By default, fr24feed is not able to work as a service and this complicates the process a little. To solve such problems, there is a start-stop-daemon utility that allows you to start any process as a daemon and then transfer signals to it.
# wget http://download.opensuse.org/repositories/home:/sschapiro:/openstack:/IS24/RedHat_RHEL-6/x86_64/start-stop-daemon-1.9.18-2.4.x86_64.rpm
# yum install ./start-stop-daemon-1.9.18-2.4.x86_64.rpm


Place the file in the /etc/init.d directory

We also register our daemon for automatic start:
# chkconfig --add fr24feed
# chkconfig --list fr24feed

We start the service:
# service fr24feed start

4. Add rules to iptables
fr24feed has a small web admin panel located on port 8754 , which allows you to get quick access to the list of monitored boards and program settings:
# iptables -A INPUT -p tcp -m tcp --dport 8754 -j ACCEPT
# iptables-save | tee /etc/sysconfig/iptables
# service iptables restart


Look like that's it! At this stage, the installation and configuration of the software can be considered complete.

4. Debriefing


After a certain working period, our data were obtained at flightradar24 and statistics were collected. All statistics are displayed on the website in the form of diagrams. Some charts display statistics for the day, using the UTC time format, others for the last 7 days.

4.1 Analysis of activity diagrams

Polar plot
One of the indicators characterizing the antenna is the radiation pattern. Flightradar24 in a pie chart by sector displays the number of received ADS-B packets and the maximum distance from which they were sent. Such statistics is generated within 24 hours:
image

This figure shows that the maximum distance from which the packets were received was 143 nautical miles, or ≈264.8 km. This indicator, given the fact that the antenna is under the roof, is quite good. In addition, using this diagram, you can identify obstacles that impair signal reception (trees, hills, tall buildings, etc.).

Histogram
If you look at the dependence of the number of received packets on the distance, then not everything is as rosy as it seemed at first glance:
image

As you can see, the peak of the packages falls at a distance of 45 nautical miles, or a little more than 80 km. Using this histogram, one can judge the effectiveness of the whole structure. The range of packet reception is affected by factors such as the design and placement of the antenna itself, the cable length from the antenna to the receiver, the type of receiver, the presence of external factors in the signal path (trees, landscape features, tall buildings, sources of interference, etc.).

Hits and positions reported
This type of chart shows the total number of all packages received from aircraft (Hits) and the number of packages that contained the coordinates of the aircraft (Positions).
image

The coordinates transmitted by the aircraft are encoded in CPR ( Compact Position Reporting ) format and for full decoding we need to have 2 packets (even and odd). Due to interference, part of the packets may be lost, in addition, the aircraft does not always send packets containing current coordinates - therefore the graphics have a discrepancy.

Aircraft seen
You can see how many aircraft the system has recorded every day for the last 7 days.
image

4.2 What happened

As a result, a fully functional system was obtained, which is able to receive and decode data from aircraft flying within its radius. The obtained data is transmitted to a popular resource and is available as a dynamic flight map for everyone.

To increase the coverage radius, you can (need) take the antenna out, placing it in a protective case. You can also reduce the length of the cable to the receiver and / or set the low-noise amplifier to 1090 MHz .

Here is considered, perhaps, the most time-consuming installation of software. When installing from a * .deb package on an OS of the Ubuntu (Debian) family, or downloading software for Windows, the number of steps will be significantly reduced.

This seems to be all. In the process of publication, errors and inaccuracies could creep in to the material - I will be very happy if you point them out in the comments, or the LAN.

PS I almost forgot: in gratitude for the data broadcast, flightradar24 will provide you with an extended premium account, which contains a lot of different options and “goodies”.

Source: https://habr.com/ru/post/280454/


All Articles