Skip navigation

The playback interface was missing in my previous version of the BBBRadio. So I added it using wxMediaCtrl.


Below is the updated screen for main GUI of BBBRadio.



Click on WavPlayer to open the interface to the media control.




The media control interface consists of simple elements such as

Open File - for opening the file

Filename TextBox - for displaying the filename

Delete - for deleting the file displayed on the Filename textbox

Play - play selected file

Pause - pause the current playback

Stop - Stop playback


When user clicks on "Open File" button he gets similar window as shown above which by default locates the "records/" folder under BBBRadio.


Waoh!!!! Now BBBRadio feels complete!!!!

After progressing with setting up RTL_SDR software and USB audio, the next task was developing Graphical User Interface. It turned out to be a real pain. I couldn't bring up a simple window on the screen. The main culprit was GNOME!!!! It consumed almost two weeks of my effort with no success. Later I had to find an alternative. So, I chose Xfce. Turned out that it has better response time than GNOME.


Steps to enable xfce on Beaglebone Black


opkg install packagegroup-xfce-base


This will download and install all the required packages.


Next disable the GNOME Display Manager using following command


systemctl disable gdm


In order to start the xfce desktop a service should be started. So create a service file "xfce4.service" at /lib/systemd/system/ location


vi /lib/systemd/system/xfce4.service


and update it with the following content,


Description=Xfce4 Display Manager

ExecStart=/usr/bin/startxfce4 -nodaemon



Then start the service using systemctl and reboot BBB,


systemctl enable xfce4


After reboot the Desktop screen will look something similar to this,



Graphical User Interface

The GUI for BBBRadio is based on wxPython, Install wxPython using following command

opkg install wxpython

To generate the GUI elements, I used "boa constructor" on x86 machine running Ubuntu 12.10. As per my design for BBBRadio, a SDR interface panel and an Internet Radio dialog was planned.


Planned features for RTL-SDR

  • Basic functionalities such as play, stop, display the current playing/last played frequency.
  • Auto scan support.
  • Time stamped Record functionality.
  • Tune to specific frequency.
  • Step up / step down frequency with respect to current playing frequency with a precision of 0.1MHz
  • Open up the dialog for internet radio.
  • Equalizer support.


Planned features for Internet Radio

  • Basic play and stop functions.
  • Record functionality.
  • Storing the previously entered URLs.
  • Deletion of any previously entered URLs


Install mplayer required for internet radio


opkg install mplayer

Install/update SOX package for converting raw stream of data from rtl_fm to .wav file.This is used when recording feature is used.

opkg install sox

Starting the BBBRadio


Download the attachment and place it in the home directory. and then run following commands


cd BBBRadio


Below is the image describing the various elements available to the user,




In order to start, RTL_SDR has to be connected to BBB, else a message box shall pop up asking for proper connection of RTL-SDR and BBB.




Scanning of available FM stations feature is implemented using python. The progress is displayed on the screen as shown below,



The scanning range starts from 87.5MHz to 108MHz with a resolution of 0.1MHz. Hence it takes almost 14 mins to complete the scan. After scanning, obtained results are doubled checked for valid station,



The scanning process can be interrupted at any moment. After the second level check, the available channels are listed in combo box as shown below,



This result of valid fm stations are stored locally in data folder under BBBRadio and retrieved when the application is started again and combo box get updated as per the frequencies obtained in last scan session.


BBBRadio can be tuned to user defined frequency using Set frequency available on bottom left of the screen. A click on the text box and florence virtual keyboard comes up for user input.




After entering a valid frequency between 87.5MHz and 108MHz, click on Set button or hit Enter key on florence and this should start playing the radio at entered frequency.


The record feature is implemented to record the output from rtl_fm. Recording is done in the raw format once the user presses the stop button/play button the recording stops and using sox the raw format input is converted to .wav format. This recorded stream is stored in records/ folders in BBBRadio and can be retrieved whenever user wants. BBBRadio can be exited by pressing the exit button. Next time when the BBBRadio application is run, it load by default the last frequency set by user. This is stored in data/ folder under BBBRadio. User can switch to Internet Radio mode by pressing "IR" button. All the activity from the RTL_SDR frame shall be stopped and interface to IR opens up in full screen mode.


Internet Radio GUI

The GUI for Internet Radio is simple. The history of the successful stream is remembered so that user can find it in the drop down and select his choice and the rest is taken care by BBBRadio. If user want to remove a certain URL then he can do it by removing the entry from list. Below is the view of the internet radio and its interfaces.



Alike the feature for Set Frequency textbox in RTL_SDR interface, Florence opens when the user clicks on the combo box to enter the URL for internet stream.




If user enters a wrong URL or if BBB is not connected to the internet, a message box pops up asking user to check the URL/internet connectivity.




For recording the stream, user has to check the Record check box before issuing play command. Both playing and recording uses mplayer. Each valid URL entered by user is remember by BBB by writing to file at data folder and retrieving at the time of dialog opening. User can remove any URL available in drop down of the combo box by first selecting the URL and clicking on the "Remove from the list icon"


That's it, BBBRadio is ready and available for evaluation. Going forward I would like to add more features, such as equalizer. But adding equalizer means more computing and it might to need to access the RTL-SDR not using rtl_fm.


Below is the short demo,

After setting up the rtl-sdr software as defined here, next step to enable the USB sound card as planned. Unfortunately I don't have any USB sound card as of now, so i emulated one as described here. BBB has the audio output on HDMI port by default, so it is necessary to disable that, to ensure the audio playback on USB sound card. This can be done by changing uEnv.txt after "BEAGLEBONE" drive shows up on your host system. Change the uEnv.txt to


optargs=quiet capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN


This ensures that HDMI is disable and USB sound card will be the default sound output/input device on BBB.


Add "/usr/local/lib" to LD_LIBRARY_PATH, so that rtl_* commands does not throw any error for LD_LIBRARY_PATH update.


root@beaglebone:~# export LD_LIBRARY_PATH=/usr/local/lib/


Next connect the USB sound card and RTL2838U to BBB using powered USB hub. and enter command "lsusb".


root@beaglebone:~# export LD_LIBRARY_PATH=/usr/local/lib/
root@beaglebone:~# lsusb
Bus 001 Device 002: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB
Bus 001 Device 008: ID 1fc9:2046 NXP Semiconductors
Bus 001 Device 005: ID 0bda:2838 Realtek Semiconductor Corp. RTL2838 DVB-T


This ensures that both NXP Semiconductors sound card and RTL2838U is now connected to BBB.


You can also use "aplay -L" to list the available sound cards


root@beaglebone:~# aplay -L
    Discard all samples (playback) or generate zero samples (capture)
    NXP Audio Out Demo, USB Audio
    Default Audio Device
    NXP Audio Out Demo, USB Audio
    Default Audio Device


The output of USB sound card can be tested using.


root@beaglebone:~# cat /dev/urandom | aplay -r 48k
Playing raw data 'stdin' : Unsigned 8 bit, Rate 48000 Hz, Mono
^CAborted by signal Interrupt...


All you hear is noise on headphones or external speaker connected to USB sound card


Now we are good to listen to any FM radio station by following command,


root@beaglebone:~# rtl_fm -f 91.9e6 -s 200000 -r 48000 - | aplay -r 48k -f S16_LE
Found 1 device(s):
  0:  Realtek, RTL2838UHIDIR, SN: 00000001

Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Tuner gain set to automatic.
Tuned to 92200000 Hz.
Oversampling input by: 6x.
Oversampling output by: 1x.
Buffer size: 6.83ms
Sampling at 1200000 S/s.
Output at 200000 Hz.
Playing raw data 'stdin' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono


"rtl_fm" is the application name for streaming FM radio and it takes following parameters in above mentioned command,

"-f" : frequency, which in our case is 91.9MHz or 91.9e6Hz

"-s" : Sample rate, which is 200k

"-r" : Output rate of 48k

The output from rtl_fm is piped to "aplay" which takes following pararmeter in above command

"-r" : Sample rate of 48k

"-f" : Sample Format, which in our case is 16 bit little endian


Short video:


Thanks element14 for selecting my design for Beaglebone Black Radio Challenge. I own a Beaglebone(first generation) so i have some prior experience in handling this new beauty(BBB).


My project aims in designing a radio using SDR and internet. The radio's interface(GUI) shall be Qt/GTK based. Provision of searching, storing and recording of channel shall be added. The audio output is using a USB sound card. The initial step is make RTL_SDR talk to Beaglebone Black.


Building rtl-sdr software

First, install cmake and libusb on Beaglebone by running

opkg install cmake
opkg install libusb*dev

Check out the rtl-sdr source and build it as described below,

git clone git://
cd rtl-sdr/
mkdir build
cd build
cmake ../
sudo make install


This completes the installation. Now its time to test it by running


LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib rtl_test -t


Below is output i  got,

Found 1 device(s):
  0:  Realtek, RTL2838UHIDIR, SN: 00000001

Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Supported gain values (29): 0.0 0.9 1.4 2.7 3.7 7.7 8.7 12.5 14.4 15.7 16.6 19.7 20.7 22.9 25.4 28.0 29.7 32.8 33.8 36.4 37.2 38.6 40.2 42.1 43.4 43.9 44.5 48.0 49.6
Sampling at 2048000 S/s.
No E4000 tuner found, aborting.


My next step would be to get usb audio to work. Looks like I have to disable HDMI output for this.