Raspberry Pi RTL-SDR Broadcastify

From The RadioReference Wiki

Raspberry Pi Broadcastify RTL-SDR Feed Appliance

These instructions show you how to purchase and setup a completely self contained Raspberry Pi with an RTL-SDR stick to broadcast a live audio feed to This tutorial assumes you have a basic understanding of Linux and Raspberry Pi computers.

Updated 2020-09-10

Purchase Equipment


Raspberry Pi

Install Raspbian OS

Once you have your Raspberry Pi booted and online you may continue.

Install pre-reqs and update raspberry pi to latest version

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential libmp3lame-dev libshout3-dev libconfig++-dev
sudo apt-get install libraspberrypi-dev
sudo apt-get install libfftw3-dev
sudo apt-get install librtlsdr-dev
sudo apt-get install rtl-sdr
sudo reboot

Install RTLSDR-Airband

cd ~/
mkdir RTLSDR-Airband
cd RTLSDR-Airband
wget -O v3.1.0.tar.gz
tar xvfz v3.1.0.tar.gz
cd RTLSDR-Airband-3.1.0
make PLATFORM=armv8-generic NFM=1

Let it compile until it finishes then install it ...

sudo make install

The program should now be installed to /usr/local/bin/rtl_airband. The default configuration file will be installed to /usr/local/etc/rtl_airband.conf which we will edit next.

RTLSDR-Airband Config

To edit the config file for RTLSDR-Airband enter this command:

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

and paste the following into the editor

# This is a minimalistic configuration file for RTLSDR-Airband. 
# More complex configurations are possible.
# Refer to
# for description of keywords and config syntax.
# Just a single RTL dongle with one FM channel
# sent to a single Broadcastify stream. 
# Note that the center freq is 100 KHz offset from the receive freq
# Also, you must enter your server number, stream name, mountpoint and 
# password from your Broadcastify stream "Technicals"
  type = "rtlsdr";
  index = 0;
  gain = 25;  # This may need adjustment depending on your hardware
  centerfreq = 153.87;
  correction = 0;   # this can be determined using "cumulative" output from running 'rtl_test -p' for several minutes
      freq = 153.77;
        modulation = "nfm";
        highpass = 320;
          type = "icecast";
          server = "";
          port = 80;
          mountpoint = "MOUNTPOINT";  # Note: Do not include a leading slash "/"
          name = "Fire Dispatch";
          genre = "Fire";
          username = "source";
          password = "PASSWORD";


It’s time to test. RTLSDR-Airband must run as root in order to have access to the GPU hardware.

sudo /usr/local/bin/rtl_airband -f 

You should see a readout of numbers. The numbers should be larger when a signal is detected. Check your Broadcastify stream to see if the feed is streaming live. Once you confirmed everything is working, kill the program with CTRL+C.

Create a service

Now you will want RTLSDR-Airband to run on startup of the Pi as well as restart if there are any errors or crashes over time (bound to happen eventually). Navigate to your RTLSDR-Airband folder. It should be somewhere like this:

cd /home/pi/RTLSDR-Airband/RTLSDR-Airband-3.1.0
sudo nano init.d/rtl_airband.service

Now in this rtl_airband.service file, change Restart=No to


and add this line directly below it


Save (ctrl+x and y) and then run these commands to copy the config over and create the service:

sudo cp init.d/rtl_airband.service /etc/systemd/system
sudo chown root.root /etc/systemd/system/rtl_airband.service
sudo systemctl daemon-reload
sudo systemctl enable rtl_airband

Now to run it, you simply need to type

sudo systemctl start rtl_airband 

or just reboot the Pi!

More info, expansion and troubleshooting

Much of this information I gleaned from this very helpful tutorial: There are so many more possibilities with this setup and you can scan, receive multiple channels within the rtl-sdr's bandpass and a multitude of other things. This page is intended to get you streaming quickly and is not intended to address all of those scenarios.

If you have issues running any of the commands above using sudo try activating the su function in Raspbian. More info here. Use at your own risk!


Stream directly from a USB sound card

If you already have a scanner ready to go and just want to use the Raspberry Pi to broadcast your radio to broadcastify, simply purchase an inexpensive USB sound card dongle, plug it in to the Raspberry Pi, and follow these steps:

  • Purchase USB Soundcard Dongle: ($1.70)
  • Install and configure ezstream with your feed's details
  • Start alsamixer
pi@raspberrypi:~# alsamixer
  • press F6, choose the "USB Headphone Set" entry
  • press your tab key to select the "Capture" device volume control
  • use your "up arrow" key to adjust the level to it's lowest level possible above 0 - (6)
  • press escape to exist alsamixer
  • run the following command to save the volume settings
sudo alsactl store
  • Run this command to start the sound card broadcast
arecord -f dat -c 1 -D hw:1,0 | \
/usr/bin/lame -r -s 48 --resample 22.05 -m m -b 16 --cbr --lowpass 4 - - | \
/usr/bin/ezstream -c /etc/ezstream_bcfy1.xml > /var/log/bcfy1.log 2>&1 &

Note: very little volume will be needed from your scanner - adjust the levels as appropriate for a good sounding feed.

Start stream on boot

Easiest way is to add your full command(s) to /etc/rc.local just before the exit 0 entry

TODO: formal startup scripts.

Verify System is running and connected

I've found that occasionally lame will crash/stop and take the feed offline (at least with my setup).

I've made a script to reboot the Pi if it happens. The script will check if the user pi is logged in - if so it won't reboot because maybe you are working on it.

Copy the script below, and create a file in /etc called

sudo nano /etc/


RESULT=`who | grep pi`

if [ "${RESULT:-null}" = null ]; then
echo "Nobody logged in.  We'll check for  other stuff"
logger "checkstuff: Nobody logged in.  Continueing checks."
logger "checkstuff: Pi is logged in.  Bypass all other checks."
exit 0

RESULT=`netstat -an | grep :80`

if [ "${RESULT:-null}" = null ]; then
logger "checkstuff: No connection to RadioReference.  Rebooting."
sudo reboot
logger "checkstuff: Connection established to RadioReference."

RESULT=`pgrep rtl_fm`

if [ "${RESULT:-null}" = null ]; then
logger "checkstuff: rtl_fm not running.  Rebooting."
sudo reboot
logger "checkstuff: rtl_fm running."

RESULT=`pgrep lame`

if [ "${RESULT:-null}" = null ]; then
logger "checkstuff: Lame not running.  Rebooting."
sudo reboot
echo "lame running"
logger "checkstuff: Lame running."

RESULT=`pgrep ezstream`

if [ "${RESULT:-null}" = null ]; then
logger "checkstuff: EZStream not running.  Rebooting."
sudo reboot
logger "checkstuff: EZStream running."

logger "checkstuff: Feed should be online."

Save the file and exit nano.

Now the file needs to be made executable:

sudo chmod 755 /etc/

You now need to set up a schedule to run the script. I've set mine to run automatically every 10 minutes. This can be done by updating the cron jobs:

sudo crontab -e

Paste the following lines at the bottom.

*/10 * * * * /etc/

Save & exit the file. The script will now run every 10 minutes (at x:00, x:10, x:20, x:30, x:40 and x:50). It will log to the /var/log/messages logfile every time it runs.

Also refer to another thread postings ...