Actions

Difference between revisions of "Raspberry Pi RTL-SDR Broadcastify"

From The RadioReference Wiki

m (added required category)
Line 161: Line 161:
  
 
TODO: formal startup scripts.
 
TODO: formal startup scripts.
 +
 +
 +
[[Category:Live Audio Broadcasting]]

Revision as of 06:52, 31 July 2015

These instructions show you how to purchase and setup a completely self contained Raspberry Pi with an RTL-SDR stick(s) to broadcast a live audio feed to Broadcastify.com

These instructions have been verified and tested as working on a Raspberry Pi 2 Model B Project Board - 1GB RAM - 900 MHz Quad-Core CPU. Two separate feeds running rtl_fm broadcasting both AM aviation and FM business frequencies simultaneously have been verified as working just fine.

Purchase Equipment

File:Rtl rsp bcfy.jpg
Raspberry Pi Broadcastify RTL-SDR Feed Appliance

Raspberry Pi 2 Model B Project Board - 1GB RAM - 900 MHz Quad-Core CPU

RTL-SDR - RTL2832U & R820T2 USB Stick

Male MCX Connector to...

Power Supply for Raspberry Pi

Memory Card for Raspberry Pi

Case for Raspberry Pi

Install Raspbian OS

All testing and configuration was done using Raspbian

Install pre-reqs and update raspberry pi to latest version

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install git cmake libusb-1.0-0.dev build-essential
sudo apt-get install lame libmp3lame-dev libvorbis-dev libshout-dev
sudo rpi-update && sudo reboot

Install the latest rtl-sdr code

This latest git release is needed for padding zeros when squelch is enabled (-E pad option)

git clone https://github.com/keenerd/rtl-sdr/
cd rtl-sdr/
mkdir build
cd build
cmake ../
make
sudo make install
sudo ldconfig
sudo mv $HOME/rtl-sdr/rtl-sdr.rules /etc/udev/rules.d/rtl-sdr.rules

Blacklist the kernel's bundled RTL drivers

We do this so we don't conflict with the RTL drivers we're about to install

sudo su -
echo "blacklist r820t" >> /etc/modprobe.d/dvb-blacklist.conf
echo "blacklist rtl2832" >> /etc/modprobe.d/dvb-blacklist.conf
echo "blacklist rtl2830" >> /etc/modprobe.d/dvb-blacklist.conf
echo "blacklist dvb_usb_rtl28xxu" >> /etc/modprobe.d/dvb-blacklist.conf
exit

Install and configure ezstream

sudo apt-get install ezstream

Create the following configuration file at /etc/ezstream_bcfy.xml and replace with your mount, password, and stream name. If you plan on having multiple streams make sure and create a separate named configuration file (i.e.'/etc/ezstream_bcfy2.xml) for each stream and reference accordingly in your command script below.

<ezstream>
    <url>http://audio#.broadcastify.com:80/your_mount</url>
    <sourcepassword>your_source_password</sourcepassword>
    <format>MP3</format>
    <filename>stdin</filename>
    <svrinfoname>Stream Name</svrinfoname>
    <svrinfourl>http://www.broadcastify.com</svrinfourl>
    <svrinfogenre>Scanner</svrinfogenre>
    <svrinfodescription></svrinfodescription>
    <svrinfobitrate>16</svrinfobitrate>
    <svrinfochannels>1</svrinfochannels>
    <svrinfosamplerate>22050</svrinfosamplerate>
    <svrinfopublic>0</svrinfopublic>
</ezstream>

Command for AM Aviation Scanning and Streaming

/usr/local/bin/rtl_fm -M am -f 124.55M -f 133.4M -f 121.6M -l 65 -p 69 -g 40 -t 0 -E pad -s 8k |
lame -r -s 8 -m m -b 16 --cbr --lowpass 4 --scale 16 - - |
ezstream -c /etc/ezstream_bcfy.xml > /var/log/bcfy.log 2>&1 &

rtl_fm - command line tuner for rt stick

rtl_fm
-d 0           	device 0 (first rtl stick, second rtl stick would be -d 1)
-M am           tune to AM Mode
-f 124.55M      tune to 124.55 MHz (use multiple -f entries to scan through frequencies)
-l 65           set scanning squelch to 65 (adjust as needed)
-p 69           ppm offset
-g 40.2         gain (0-49.6) - adjust as needed
-t 0            scanning delay (I set to 0, default is 10)
-E pad          when squelch is enabled pad output with zeros (required when broadcasting)
-s 8k           sample at 8k

which is then piped to the mp3 lame encoder...

lame - MP3 encoder
-r           accept raw data input
-s 8          sample in at 8k
-m m          encode mono
-b 16          encode at 16kbs bitrate
--cbr         use Broadcastify’s mp3 cbr standard
--lowpass 4  use a low pass filter of 4
--scale 16   turn up the volume for AM Mode

which is then piped to ezstream

ezstream -c /etc/ezstream_bcfy.xml

Command for FM Scanning and Streaming

/usr/local/bin/rtl_fm -d 0 -M fm -f 461.4M -p 69 -l 65 -g 50 -t 2 -E pad -s 12k |
/usr/bin/lame -r -s 12 --resample 22.05 -m m -b 16 --cbr --lowpass 4 - - |
/usr/bin/ezstream -c /etc/ezstream_bcfy.xml > /var/log/bcfy2.log 2>&1 &

rtl_fm - command line tuner for rt stick

rtl_fm
-d 0           	device 0 (first rtl stick, second rtl stick would be -d 1)
-M fm           tune to FM Mode
-f 461.4M      tune to 461.4 MHz (use multiple -f entries to scan through frequencies)
-l 65           set scanning squelch to 65 (adjust as needed)
-p 69           ppm offset
-g 40.2         gain (0-49.6) - adjust as needed
-t 2            scanning delay (I set to 2, default is 10)
-E pad          when squelch is enabled pad output with zeros (required when broadcasting)
-s 12k           sample NFM at 12k

which is then piped to the mp3 lame encoder...

lame - MP3 encoder
-r           accept raw data input
-s 12          input at 12k
--resample 22.05   resample at 22.05Khz
-m m          encode mono
-b 16          encode at 16kbs bitrate
--cbr         use Broadcastify’s mp3 cbr standard
--lowpass 4  use a low pass filter of 4

which is then piped to ezstream

ezstream -c /etc/ezstream_bcfy.xml

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.