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,
Unit] Description=Xfce4 Display Manager After=systemd-user-sessions.service [Service] ExecStart=/usr/bin/startxfce4 -nodaemon StandardOutput=syslog [Install] Alias=display-manager.service
Then start the service using systemctl and reboot BBB,
systemctl enable xfce4 reboot
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 python App.py
RTL_SDR GUI
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.
<html><head><title>Jive SBS</title></head>
<body><font face="arial,helvetica,sans-serif">
<b>Error</b><br><font size="-1">
An general error occurred while processing your request.
</font></font></body></html>
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,
<html><head><title>Jive SBS</title></head>
<body><font face="arial,helvetica,sans-serif">
<b>Error</b><br><font size="-1">
An general error occurred while processing your request.
</font></font></body></html>
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.
<html><head><title>Jive SBS</title></head>
<body><font face="arial,helvetica,sans-serif">
<b>Error</b><br><font size="-1">
An general error occurred while processing your request.
</font></font></body></html>
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.
<html><head><title>Jive SBS</title></head>
<body><font face="arial,helvetica,sans-serif">
<b>Error</b><br><font size="-1">
An general error occurred while processing your request.
</font></font></body></html>
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,
Top Comments