Get live flight data stream using a Pro-Stick Plus?

Hello all,

Does anyone if it is possible to get a live stream of raw flight data (latitude, longitude, speed, call sign, icao24 code, etc.) just like what FlightAware’s Firehose capability provides, with the help of pro-stick or pro-stick plus? Pro Stick® and Pro Stick® Plus - FlightAware's USB ADS-B and MLAT receiver - FlightAware? I understand that there is a 250NM limitation but that is OK.

If yes, can the pro stick be connected to my PC as opposed to a PI since I need to pass the live flight data stream through a custom web application that runs on my PC for some processing?

Thanks in advance,
Satish

If you use a PiAware sdcard image, there is an enable-firehose setting you can turn on that will enable a firehose-like interface on port 1501. Use username “pirehose” / password “pirehose”. Note that this is fairly limited compared to the real Firehose as it has only local data to work with.

Alternatively you can consume raw data from dump1090-fa directly on port 30005, or json output via aircraft.json (this is the data backing the local SkyAware display)

All of this requires a unix-ish system to run on. There are some (aging) Windows ports of dump1090 around. You might be able to convince WSL2 to run dump1090, but it requires a functional libusb and I don’t know if WSL is at the point where that works yet.

Thank you for your quick reply. So, is this the kit that we must buy to do what you mentioned? Please advise. 1090MHz PiAware ADS-B Kit – FlightAware

Yep, that kit will get you started.

nb: the range you will get depends a lot on the antenna and (in particular) antenna placement and line of sight to the aircraft. The small antenna supplied with the kit is enough to receive nearby traffic if you place it somewhere with a view of the sky (window, etc) but for 360-degree long range reception you’ll probably need to upgrade to a larger antenna and perhaps a roof mounted install. But the kit will certainly get you started and you can add things later.

Thanks @obj. I finally received the kit and set everything up. I am able to see the map of flights in the vicinity of the receiver. Now, as per your suggestion, I did the following to get a live stream of the flight data from my PiAware server.

  1. In the /boot/piaware-config.txt, I included the line “enable-firehose yes”.
  2. I made an attempt to create a socket connection with the code snippet below. However, I encountered the error “ConnectionResetError: [Errno 104] Connection reset by peer”. Do you see anything obviously wrong in what I have done?

servername = “IP ADDRESS OF THE PiAware”
sock = socket.socket(socket.AF_INET)
context = ssl.create_default_context()
context.minimum_version = ssl.TLSVersion.TLSv1_2
ssl_sock = context.wrap_socket(sock, server_hostname = servername)
ssl_sock.connect((servername, 1501))

TIA,
Satish

Looks OK, at a glance. Did you reboot after making the config change?

@obj Yes, I did do a reboot after the config change.

You’ll need to disable certificate verification on the client side, since pirehose is using a self-signed cert (alternatively, you could copy the cert from /etc/piaware/pirehose.cert.pem to the client side and verify against that)

I verified that this works OK with a PiAware 7.2 sdcard image and enable-firehose yes (client side is running Ubuntu 20.04.5 LTS, Python 3.8.10):

#!/usr/bin/env python3

import socket
import ssl

servername = "192.168.1.105"
sock = socket.socket(socket.AF_INET)
context = ssl.create_default_context()
context.minimum_version = ssl.TLSVersion.TLSv1_2
context.check_hostname = False
context.verify_mode = ssl.CERT_NONE
ssl_sock = context.wrap_socket(sock, server_hostname = servername)
ssl_sock.connect((servername, 1501))

print('SSL version', ssl_sock.version())
print('Cipher', ssl_sock.cipher())
print('Peer cert', ssl_sock.getpeercert())
$ python3 pirehose-thing.py
SSL version TLSv1.3
Cipher ('TLS_AES_256_GCM_SHA384', 'TLSv1.3', 256)
Peer cert {}

Another thing you can try to check the connection is using openssl s_client to connect:

$ openssl s_client -connect 192.168.1.105:1501
CONNECTED(00000003)
Can't use SSL_get_servername
depth=0 CN = pirehose
verify error:num=18:self signed certificate
verify return:1
depth=0 CN = pirehose
verify return:1
---
Certificate chain
 0 s:CN = pirehose
   i:CN = pirehose
---
[...]
---
New, TLSv1.3, Cipher is TLS_AES_256_GCM_SHA384
Server public key is 4096 bit
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
Early data was not sent
Verify return code: 18 (self signed certificate)
---

@obj

Thank you. I tried your piece of code on the exact same Ubuntu 20.04 system and Python 3.8.10 and I have the same error. I also logged into my Pi and saw that the files pirehose.cert.pem and pirehose.key.pem in the /etc/piaware folder are basically empty! Of course, since your code snippeet has the certification disabled, I did not need these files. Anyways, have you got any other recommendations? Thanks in advance.

$ python3 piaware.py
Traceback (most recent call last):
File “piaware.py”, line 13, in
ssl_sock.connect((servername, 1501))
File “/usr/lib/python3.8/ssl.py”, line 1342, in connect
self._real_connect(addr, False)
File “/usr/lib/python3.8/ssl.py”, line 1333, in _real_connect
self.do_handshake()
File “/usr/lib/python3.8/ssl.py”, line 1309, in do_handshake
self._sslobj.do_handshake()
ConnectionResetError: [Errno 104] Connection reset by peer

That’s not normal - maybe something broke during the generation of the keys.

You could try deleting those two files and rebooting the Pi, that should force them to be regenerated.

@obj

Great, thank you very much. Appreciate it. It finally worked now! I am able to generate a live stream from my piaware :-).

As you may recall, what we bought is this kit 1090MHz PiAware ADS-B Kit – FlightAware. Is there a different antenna that we can buy and use that instead of the one in the kit to get more coverage? Thanks in advance.

Regards,
Satish

An external antenna would be the first thing you’d want to do if you care about reception range.

Try FlightAware 1090 MHz Antenna | ADS-B Flight Tracking and Coaxial Cable 20 Meter – FlightAware (there are shorter cables available on the store as well).

@obj @bovineone

Good Morning,

I have been tracking the live flight stream by enabling the “enable-firehose” setting on our PiAware at port 1501. Apart from this, I am also looking at the data in the aircraft.json file that I can access by going to http://XX.XXX.XXX.XXX:1502/skyaware/data/aircraft.json. See flight data samples obtained by both means.

Sample flight data from the firehose-like stream at port 1501 on the PiAware
data is {‘facility_hash’: ‘01234567’, ‘alt’: ‘18300’, ‘lon’: ‘-76.83677’, ‘gs’: ‘189’, ‘type’: ‘position’, ‘hexid’: ‘A04B68’, ‘air_ground’: ‘A’, ‘gps_alt’: ‘18900’, ‘ident’: ‘#A04B68’, ‘clock’: ‘1667490086’, ‘id’: ‘A04B68-1667490087-piaware-39’, ‘heading’: ‘180’, ‘lat’: ‘39.21085’, ‘baro_alt’: ‘18300’, ‘updateType’: ‘A’, ‘facility_name’: ‘Local ADS-B’, ‘pitr’: ‘1667490087’}

Sample flight data from the aircraft.json file. This data corresponds to a different flight than the one above.
{“hex”:“ad21bc”,“flight”:"SWA971 ",“alt_baro”:11850,“alt_geom”:12325,“gs”:358.9,“ias”:295,“tas”:352,“mach”:0.548,“track”:260.5,“track_rate”:0.03,“roll”:-0.2,“mag_heading”:271.6,“baro_rate”:2816,“geom_rate”:2240,“squawk”:“7064”,“emergency”:“none”,“category”:“A3”,“nav_qnh”:1029.6,“nav_altitude_mcp”:16992,“nav_heading”:40.1,“lat”:38.967575,“lon”:-77.390320,“nic”:7,“rc”:371,“seen_pos”:0.6,“version”:2,“nic_baro”:1,“nac_p”:8,“nac_v”:1,“sil”:3,“sil_type”:“perhour”,“gva”:1,“sda”:2,“mlat”:,“tisb”:,“messages”:988,“seen”:0.0,“rssi”:-7.1}

My questions are:

  1. Why is there a difference in the data keys between the two? Is it possible for us to get the same data that we see in the .json but through the firehose-like stream at 1501 port?

  2. For now, my main issue is that, I am unable to access the call sign that appears with the key “flight” in the .json BUT that does not appear anywhere in the firehose-stream. Any idea how I can access at least this one from the firehose-like stream at port 1501?

Thanks for your help in advance.

Regards,
Satish

The keys and schema differ between the two because they were defined that way. There are a number of common elements between the two that simply have different key names, however there are some elements that only exist in one.

The firehose-like json was added relatively recently to PiAware to make it easier for users that are already familiar with our standard FlightAware Firehose API, since the protocol is nearly identical.

The “flight” key in aircraft.json corresponds with the “ident” key in the firehose-like json.

@bovineone

Thanks for the quick reply. I thought the “ident” is the same as “flight” but, if you look at my data sample for the firehose-like stream, “ident” is #A04B68. I just can’t pull up any flight with that call sign. I am not sure which flight that corresponds to. Any idea? Also, what is the prefix # about?

Regards,
Satish

The two data samples you provided do not correspond to the same aircraft so they don’t match for that reason.

Because the data from piaware is a little more “raw” and has undergone less filtering/pre-processing than our full Firehose service, the data has some limitations due to the nature of raw ADS-B data. In particular, not all aircraft have or transmit an ident. Whenever piaware receives an ADS-B message that is missing the ident, then the firehose-like json has the ident populated with the hexid of the aircraft prepended with “#”

Thank you @bovineone!

@obj @bovineone

Does PiAware support the initiation command argument latlong lowLat lowLon hiLat hiLon to filter out flight data so it is within a bounding box? I know this is supported by Firehose but was wondering if PiAware also supports this.

Thanks,
Satish

I think it might, but keep in mind that the filtering would still be limited to the aircraft that are visible to the antenna of your piaware.

Yes, it does. (20 characters)