Skip to content

Instantly share code, notes, and snippets.

@EvenAR
Last active March 10, 2024 21:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save EvenAR/e515337f7da85d8d0ff6cdc4eb3aa939 to your computer and use it in GitHub Desktop.
Save EvenAR/e515337f7da85d8d0ff6cdc4eb3aa939 to your computer and use it in GitHub Desktop.

ADS-B and LiveATC feeder

Setup for feeding data from my Raspberry Pi to:

Hardware:

  • Raspberry Pi 4 Debian Bullseye, arm64
  • Mode-S Beast MkII (USB ADS-B receiver)
  • CM108 USB sound card with bias voltage removed from mic input (see how to)
  • Scanner radio

The Raspberry Pi will be configured to start each feeding service automatically after it boots.

ADS-B feeding setup

This tool redistributes the data stream coming from the Mode-S Beast so multiple software can read from it.

  1. Install git
    $ sudo apt-get install -y git
  2. Download sources
    $ git clone https://github.com/flightaware/beast-splitter.git
  3. Install dependencies
    $ sudo apt-get install -y libboost-all-dev debhelper
  4. Build and install
    $ cd beast-splitter 
    $ dpkg-buildpackage -b
    $ sudo dpkg -i ../beast-splitter_8.2_arm64.deb
  5. Configure
    $ sudo nano /etc/default/beast-splitter
    Set ENABLED="yes" and OUTPUT_OPTIONS="--listen 30005:R"
    # Configuration for beast-splitter.
    # This is a shell-script fragment.
    # Lines beginning with "#" are ignored.
    
    # Set to "yes" to allow starting beast-splitter with this configuration.
    ENABLED="yes"
    
    # Input options for beast-splitter.
    # This tells beast-splitter where to read data from.
    # You should provide one of --net or --serial here
    INPUT_OPTIONS="--serial /dev/beast"
    #INPUT_OPTIONS="--net remotehost:remoteport"
    
    # Output options for beast-splitter.
    # This tells beast-splitter where to send output to,
    # either by establishing an outgoing connection (--connect)
    # or by accepting inbound connections (--listen)
    OUTPUT_OPTIONS="--listen 30005:R"
  6. Restart service
    $ sudo systemctl restart beast-splitter

Install FlightAware feeder

sudo bash -c "$(wget -O - https://raw.githubusercontent.com/abcd567a/piaware-ubuntu-debian-amd64/master/install-piaware.sh)"

Configure:

sudo piaware-config feeder-id xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx 
sudo piaware-config allow-manual-updates yes 
sudo piaware-config allow-auto-updates yes 
sudo systemctl restart piaware

It should automatically detect the data stream from Beast Splitter. The FlightAware feed should now be up and running.

Install Flightradar24 feeder

$ sudo bash -c "$(wget -O - http://repo.feed.flightradar24.com/install_fr24_rpi.sh)"

Important setup steps

Step 1.3 - Would you like to participate in MLAT calculations? (yes/no)$:no
...
Would you like to use autoconfig (*yes*/no)$:no
...
Step 4.1 - Receiver selection:

 1 - DVBT Stick (USB)
 -----------------------------------------------------
 2 - SBS1/SBS1er (USB/Network)
 3 - SBS3 (USB/Network)
 4 - ModeS Beast (USB/Network)
 5 - AVR Compatible (DVBT over network, etc)
 6 - microADSB (USB/Network)

Enter your receiver type (1-7)$:4
...
Step 4.2 - Please select connection type:

 1 - Network connection
 2 - USB directly to this computer

Enter your connection type (1-2)$:1
...
Step 4.3A - Please enter your receiver's IP address/hostname
$:localhost 

Step 4.3B - Please enter your receiver's data port number
$:30005

The FlightRadar24 feed should now be up and running.

Install airplanes.live feeder

$ curl -L -o /tmp/feed.sh https://raw.githubusercontent.com/airplanes-live/feed/main/install.sh
$ sudo bash /tmp/feed.sh 

See https://airplanes.live/how-to-feed/

Install opensky feeder

$ wget https://opensky-network.org/files/firmware/opensky-feeder_latest_arm64.deb
# Notice: use arm64 instead of armhf when on 64 bit OS
$ sudo dpkg -i opensky-feeder_latest_armhf.deb

See https://opensky-network.org/community/projects/30-dump1090-feeder

Install ADSBHub feeder

Use "SBS" data protocol, port 30003 (requires 30003 output from FR24 feeder).

https://www.adsbhub.org/howtofeed.php

LiveATC feed setup

Install Darkice. This software is used for streaming audio to Icecast servers.

$ sudo apt-get install libmp3lame0 libtwolame0
$ sudo apt-get install -y darkice

Create the file /etc/darkice.cfg (this is the file darkice reads by default)

[general]
duration        = 0
bufferSecs      = 5
reconnect       = yes

[input]
device          = plughw:1,0     # sound device
sampleRate      = 44100          # 22050 or 44100
bitsPerSample   = 16             # only use 16
channel         = 1              # use mono

[icecast2-0]
bitrateMode     = cbr
format          = mp3
bitrate         = 16             
server          = audio-in.liveatc.net
port            = 8010
sampleRate      = 22050
lowpass         = 3500
mountPoint      = ASSIGNED-BY-LIVEATC
password        = ASSIGNED-BY-LIVEATC
name            = FEED-DESCRIPTION
description     = FEED-DESCRIPTION
url             = http://www.liveatc.net
genre           = ATC
public          = no

Create /lib/systemd/system/darkice.service:

[Unit]
Description=DarkIce live audio streamer

[Service]
Restart=always
RestartSec=3
ExecStart=darkice
ExecStop=/usr/bin/pkill darkice

CPUSchedulingPolicy=fifo
CPUSchedulingPriority=4

[Install]
WantedBy=multi-user.target

Then activate the new service

$ sudo systemctl daemon-reload
$ sudo systemctl enable darkice
$ sudo systemctl start darkice

Darkice should now be streaming to LiveATC. Use alsamixer to adjust the volume:

$ alsamixer -c 1

To ensure the audio device ID is the same every time the PI boots

List the available audio devices using cat /proc/asound/modules. This should give an output similar to this:

 0 snd_bcm2835
 1 snd_usb_audio
 2 vc4
 3 vc4

Create the file /etc/modprobe.d/alsa-base.conf and specify which index each audio device should get. Since the Darkice config specifies device = plughw:1,0 the USB sound card should have index 1. Setting vc4 index=-2 ensures that the micro-HDMI outputs are never used as default audio device. More info here.

options snd_bcm2835 index=0
options snd_usb_audio index=1
options vc4 index=-2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment