Skip to content

Instantly share code, notes, and snippets.

@rgrokett
Last active July 9, 2023 14:59
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rgrokett/efa7b99abf7af68823ab59082d9320b7 to your computer and use it in GitHub Desktop.
Save rgrokett/efa7b99abf7af68823ab59082d9320b7 to your computer and use it in GitHub Desktop.
RTLSDR-Airband instructions for Raspberry Pi 3

RTLSDR-Airband instructions for Raspberry Pi 3

Build a Aircraft scanner from a Pi 3 and an RTL-SDR radio dongle and external audio PC speaker.

Full details are available at https://github.com/szpajder/RTLSDR-Airband/wiki

Hardware

  • Raspberry Pi 3 with at least 2 USB slots
  • RTL-SDR Dongle V3 (typical one, not ADS-B!)
  • USB powered speaker with stereo audio plug
  • Antenna with connecting cable for RTL-SDR dongle

Plug the RTLSDR dongle into one of the USB ports and the USB powered speaker into another. Plug the audio plug into the audio mini jack on the Pi. Then connect the antenna to the dongle. That's it for hardware.

Optional - Run Dual SDR dongles

If you use TWO RTL-SDR dongles, such as the NooElec NESDR then you can run FlightAware AND Airband Scanner on one Pi. NOTE: This does block the other two USB ports! So you have to plug the USB audio power somewhere else.

To change FlightAware to use the second RTLSDR dongle, you need to edit:

sudo nano /etc/default/dump1090-fa
# Change the device-index from 0 to 1
RECEIVER_OPTIONS="--device-index 1 --gain -10 --ppm 0 --net-bo-port 30005"

sudo systemctl restart piaware

You could alternately edit /usr/local/etc/rtl_airband.conf (below) and change it's index to 1 for the second dongle.

Software

Initial dependencies

# Install Raspbian Stretch Lite  (no GUI)
# Access via SSH

sudo apt update
sudo apt upgrade

sudo raspi-config

Change password
Change Network>hostname
Change Localization>Timezone
Change Advanced>Audio to jack

sudo apt-get install build-essential libmp3lame-dev libshout3-dev libconfig++-dev libraspberrypi-dev
sudo apt-get install librtlsdr-dev
sudo apt-get install libpulse-dev

Reboot

Build RTLSDR-Airband

cd 
wget -O RTLSDR-Airband.tar.gz https://github.com/szpajder/RTLSDR-Airband/archive/v3.0.1.tar.gz
tar xvfz RTLSDR-Airband.tar.gz
cd RTLSDR-Airband

make PLATFORM=rpiv2 PULSE=1
sudo make install

sudo nano /usr/local/etc/rtl_airband.conf

Add Channels (edit for your location!)

devices:
({
  type = "rtlsdr";
  index = 0;
  gain = 25;
  centerfreq = 127.0;
  correction = 0;
  channels:
  (
    {
      freq = 126.125;
      outputs: (
      {
        type = "pulse";
      }
      );
    },
    {
      freq = 127.475;
      outputs: (
      {
        type = "pulse";
      }
      );
    },
    {
      freq = 126.350;
      outputs: (
      {
        type = "pulse";
      }
      );
    },
    {
      freq = 127.000;
      outputs: (
      {
        type = "pulse";
      }
      );
    },
    {
      freq = 132.825;
      outputs: (
      {
        type = "pulse";
      }
      );
    },
    {
      freq = 133.700;
      outputs: (
      {
        type = "pulse";
      }
      );
    },
    {
      freq = 130.975;
      outputs: (
      {
        type = "pulse";
      }
      );
    },
    {
      freq = 133.875;
      outputs: (
      {
        type = "pulse";
      }
      );
    },
    {
      freq = 134.975;
      outputs: (
      {
        type = "pulse";
      }
      );
    },
    {
      freq = 133.325;
      outputs: (
      {
        type = "pulse";
      }
      );
    },
    {
      freq = 127.775;
      outputs: (
      {
        type = "pulse";
      }
      );
    }
  );
 }
);

Install Pulse Audio (localhost only)

sudo apt install pulseaudio pulseaudio-module-zeroconf avahi-daemon

sudo vi /etc/pulse/system.conf
# Find and edit this line:
# ORIG
#load-module module-native-protocol-unix
# NEW
load-module module-native-protocol-unix auth-anonymous=1
# Set Volume Use arrow keys and ESC to exit
alsamixer 
# Test Volume
aplay /usr/share/sounds/alsa/Front_Right.wav

# Manually run Pulse Audio server using:
sudo /usr/bin/pulseaudio --system --realtime

Run RTLSDR-Airband (in another terminal)

sudo /usr/local/bin/rtl_airband -f

You should now start hearing radio calls from nearby aircraft! If not, google the error message(s) and/or look at the full details at the GitHub wiki, above.

AutoRun on bootup

sudo nano /etc/systemd/system/pulseaudio.service

Add all the following

[Unit]
Description=PulseAudio system-wide server

[Service]
Type=forking
PIDFile=/var/run/pulse/pid
ExecStart=/usr/bin/pulseaudio --daemonize --system --realtime --log-target=journal
ExecStop=/usr/bin/pulseaudio -k
Restart=on-failure
LimitRTPRIO=1000
LimitNICE=-20

[Install]
WantedBy=multi-user.target

Now apply the service

sudo systemctl daemon-reload
sudo systemctl enable pulseaudio.service
sudo systemctl start pulseaudio.service
sudo systemctl status pulseaudio.service

You should see the pulseaudio service running in the background now. You can check the status by either of the following:

pacmd list-sinks
tail -f /var/log/daemon.log

Install RTLSDR-Airband to start on boot

crontab -e
# Add the following to the end of the file
@reboot sudo /usr/local/bin/rtl_airband

Reboot your Pi and after a few minutes, you should start hearing aircraft voice audio.

Add this to an aircraft tracker like FlightAware

https://flightaware.com/adsb/piaware/build

And you have a complete Air Traffic system!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment