Skip navigation

Here are my previous posts for the BBB Radio Challenge:




This project was really fun to work on.  I hadn't used a BeagleBone Black before, and wish I could have used more if it GPIO features.  I did have experience writing Java code for Raspberry Pi so that helped in terms of knowing about embedded Linux.


Another feature I wish I had more time for was a visual element; maybe in the next version.


Java proved to be a powerful tool to use in this project.  Java provided access to the network, system commands, and enabled portable code.



Here is a demo of the project in action, inside of my first attempt at its enclosure.  I want to call it RadioHead, but that might be trademarked.



Again the source code is available:




If you want to take a look at development builds, then here is a link to the build server:




See the last post (Installing FM Support) for system requirements to get this running on your Linux system.

Here are some photos of the enclosure build:










That last one is from before I added the 'smile'.

So as I mentioned, I was planning to make two projects. As the first one took a long time, I just had a couple of days to finish this one and publish it. Unfortunately, it didn't work due to couple of reasons:

  • Initial plan was to write some sort of wrapper to rtl_adsb and display an offline map as popular dump1090 uses Google Maps API and needs Internet connection. I was running out of time so decided to use dump1090 instead. So map displaying needs a WiFi connection.
  • Small screen meant that I cannot display the map on the LCD. No problem for me as I always carry my tablet with me. Entering the IP of Beaglebone Black on the tablet browser means I can view the map on a much bigger screen. This also means I can zoom in and out easily as the resistive touchscreen does not have multi-point touch capability.
  • At the very last minute, the cell phone charger I was planning to use went haywire and does not power anything! So the project was is not portable and sitting on my desktop instead of an enclosure.

Compiling ADS-B Software

The software I'm using is called dump1090. It is really nice and slim and has a couple of variants on the Internet. The one I used is from here. To compile it, you just have to do the following steps:

root@beaglebone:~# git clone git://
root@beaglebone:~# cd dump1090
root@beaglebone:~/dump1090# export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/
root@beaglebone:~/dump1090# make


You have to do the export step as dump1090 will complain about not being able to find a package it needs to compile and give tons of errors. Also while at it, it may be best to change the center of the map. Lines 42-43 of gmap.html reads:



I changed these to (roughly) the coordinates of Tokyo. Now it reads:



And you are done. You can connect your RTL dongle and get messages on your console by typing

root@beaglebone:~/dump1090# ./dump1090 --interactive --net


--net option at the end enables the browser map option. This is my usual configuration.


Configuring WiFi Adapter

The WiFi adapter is really easy to configure. You just need the SSID and password of your access point. I just used the tutorial supplied by the manufacturer. You first need to encrypt your password. You can do this by:

root@beaglebone:~/Desktop# wpa_passphrase SSID password


Now open up the /var/lib/connman/wifi.config file and insert:

Type = wifi
Name = SSID
Passphrase = encrypted_password


You can probably enter multiple configurations to this file although this is not tested by me. You then unplug the Ethernet cable, and reboot your Beaglebone Black for it to connect through WiFi adapter.



The stock antenna does not give you enough range so it's better that you make your own antenna. RTL dongle uses MCX connectors, which are small, so I bought both straight and right angled MCX jacks, a coaxial cable crimper and a few meters of 1.5C-2V coaxial cable. The cable I chose was locally available from Akihabara and it was a suitable size for the MCX connectors and the right impedance, 75 ohms, for the RTL dongle. I connected one straight and one right angled connector to short lengths of coaxial cable. Here you can see them before I put the heat shrink tubing on to blend in the crimped ferrule, 1 yen coin is for reference.


My initial decision was to follow this tutorial and make a colinear antenna. But as it turns out, wavelength for 1090 MHz is roughly 275 mm and this means my antenna has to be about 55 cm long! Not suitable for mobile use. Then I decided to make a real simple dipole antenna via this tutorial. I directly soldered the center conductor and jacket to short lengths of wire, secured it to a chopstick for stability, trimmed the antenna to size and wrapped it with electrical tape.


Now I have a real ghetto antenna for ADS-B.


Shell Scripts for Mobile Use

For mobile usage, I won't be connected through SSH, so I need some way to learn the IP address and then run dump1090. For this I created two separate shell scripts on the Desktop and made them executable. The first one is called

ifconfig ra0
sleep 5


This displays the information about the WiFi adapter, waits for 5 seconds, then exits. The wait is needed as it is run, it quickly displays the information and quits. The second one is called

cd ~/dump1090
./dump1090 --interactive --net


For this one, the change directory command is needed as it cannot find the webpage if it's run from a different directory.



The system currently consists of a USB hub connected to the Beaglebone Black, WiFi adapter and RTL dongle connected to it. It's powered by the supplied 5 V adapter and sitting on my desktop. The range is not great as it sits indoors and ADS-B is line of sight. Once I get it mobile, I'm planning to go near Haneda Airport and see the traffic with it. I will upload the video of the system as soon as I'm able to receive some information of air traffic. Video has been finally converted.

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,

All entries in this blog series:



The end of the challenge is nearing, so here's my final post on this project.

I have had a major setback when resuming coding after the build, but I did manage to get a fully functional FM/Internet Radio combo in time.



Disaster ...


After having finished the build from part 4, I was getting ready to resume coding on my interface and its functionalities.

I booted my BBB Radio, started the browser and my interface was totally blank.

No reason to panic (yet), as I might have left the code broken the last time I worked on it. That's when I discovered my index.cgi file was 0 bytes big.


Disaster ... The code was gone and I had no backup to recover at least some of it. Luckily, my images, stylesheets and config files were still intact.

I desperately searched for a copy of my index file but didn't manage to find any. There was nothing left but to start over and start making backups!


That was a bummer which was most likely entirely my fault, but a lesson learned ... the hard way. I'm still not sure what happened exactly, but I assume I left the file open and didn't properly shut down the BBB, or at least something along those lines.


With only two weeks left before the end of the challenge, I started coding again ...


Demo Time!


Pfew, I made it ... with only a few days to spare. Here's a set of demos of what I managed to get done for this challenge.




It's possible to control the Beaglebone Black Radio in various ways:

  • Touchscreen using the LCD cape
  • Wireless keyboard/mouse combo
  • From a smartphone/tablet/pc


Each of the controls have their (dis)advantages. For example, the LCD cape is useful for navigation and actions using big buttons. It is however less adequate for entering data.

This disadvantage is compensated by the wireless keyboard/mouse combo or by accessing the interface from another device such as a smartphone.


You'll see me using some of those different controls in the videos below.





This video demonstrates the controls to listen to the radio. The controls allow you to switch between FM or Internet radio, start, stop, browse the available channels and set the volume.



You can hear the moment it switches between FM and internet streaming. The audio levels also seem to be different. I'll have to find a way of aligning this.

photo 1.PNG


Managing Channels


I developed a simple radio channel management interface which you can view in the video below. It allows you to add new channels and edit or delete existing channels.

The configured channels are stored in a configuration file on disk to make them persistent across reboots.



Managing channels can also be done (more easily) from a smartphone:

photo 3.PNG




Finally, a short video on setting some parameters for the SDR receiver stick. The list could be extended to support a larger set of configurable parameters.

For now, it allows to configure the modulation type, gain and sample rate which are provided to the "rtl_fm" command. Changes are also stored in a configuration file on disk.



photo 4.PNG


Diagram, Components and Code


Below you will find all the information required to better understand or even build this particular Beaglebone Black Radio.

All suggestions/improvements/additions are more than welcome, I'll also gladly answer any questions you might have regarding this build.




I made a simple diagram of the different components involved and how everything is connected.

It's more of an integration project where different existing components are combined into one solution, all glued together with a web application developed in Perl.

bbb_radio (2).png




The list of electronic components used in my project:


ComponentHeader 2
Beaglebone - BeagleBone Black
LCD Touch CapeCircuitCo:BeagleBone LCD4 -
USB Wifi AdapterUWN200 b/g/n USB wireless adapter | Logic Supply
USB SDR ReceiverSoftware Defined Radio Receiver USB Stick - RTL2832 w/R820T ID: 1497 - $22.50 : Adafruit Industries, Unique & fun DIY el…
Audio AmplifierStereo 2.8W Class D Audio Amplifier - TS2012 ID: 1552 - $9.95 : Adafruit Industries, Unique & fun DIY electronics and ki…
SpeakersSpeaker - 3 Diameter - 4 Ohm 3 Watt ID: 1314 - $1.95 : Adafruit Industries, Unique & fun DIY electronics and kits
Powered USB HubLogiLink® | USB 2.0 Hub, 4-Port LogiLink® | 16.03.2014
USB SoundcardUSB 2 0 External MIC Speaker 3D 5 1 Channel Audio PC Sound Card Adapter Brown | eBay
Wireless Keyboard & Mouse ComboRii 2.4GHz Wireless Mini PC Keyboard Touchpad V2 Black: Computers & Accessories




And finally, a link to the source code of my web application used to control the radio: BeagleboneBlackRadio on GitHub

Information on setting up the Beaglebone Black and getting the components installed and running can be found in the previous posts of this challenge.



Thank you


As you can see in the picture below, we're having fun with our new radio! Thank you for giving us the opportunity to participate in this Roadtest Challenge.

Screen Shot 2014-03-23 at 14.33.50.pngphoto (1).JPG

In this post I'll be talking about how to set another computer to act as a server between Beaglebone Black and Internet. Initially I was planning to use ffmpeg and ffserver but after a week of banging my head against the wall, I couldn't make it work. It would've been nice as I was planning to pipe the stream coming from netcat to ffmpeg so that lets say if I have two Beaglebone Blacks with their own RTL dongles with different ports, I could've streamed both radio stations from the same streaming server. Then I started thinking and decided to use a patch cable to connect my sound card's audio out to its line in and use ffmpeg to capture from line in. This also didn't work. While I was looking around for a solution, I found a blog post about streaming with icecast and darkice.


System Setup

I'm using an Ubuntu Desktop 12.04 as my streaming server. aplay comes default but for an Ubuntu Server system, you have to install that too. Now install icecast and darkice with

sudo apt-get install icecast2 darkice

During installation, it will ask you if you want to configure icecast. I chose not to and decided to use the default port and password but if you're going for development, it would be wise to change at least the default passwords. After installation, you also have to edit /etc/default/icecast2 to change line with ENABLE=false to ENABLE=true. After this, I created a configuration file darkice.cfg in my home directory with the following content:

duration = 0
bufferSecs = 1
reconnect = yes
device = default
sampleRate = 44100
bitsPerSample = 16
channel = 2
bitrateMode = vbr
quality = 1.0
format = mp3
bitrate = 256
server = localhost
port = 8000
password = hackme
mountPoint = radio.mp3
name = radio


You can now either reboot your system or start icecast with:

sudo /etc/init.d/icecast2 start



Now I ssh into Beaglebone Black and tune into NHK Radio (82.5 MHz) with:

root@beaglebone:~# while true; do rtl_fm -f 82.5M -s 44.1k - | netcat -l -p 8080; done


You may decide to put this as a script to be run at boot time or use screen, run it and detach. On the streaming server, I also use screen as I need multiple consoles and again, I need the commands to run even if I cut my ssh connection. I open up two consoles, in one start darkice with:

sudo darkice -c darkice.cfg


In the other, I start playing the received audio with aplay:

netcat 8080 | aplay -r 44.1k -t raw -c 1 -f S16_LE


As I have an audio patch cable connected, I don't have to use jack or set up a pulse monitor. So here is the network diagram explaining this system.




And also here is a video with the usage. The first thing I do is go to the stream page and let my browser play the stream. Then I go to icecast status page and click the playlist link and it opens Media Player by default.


Check out my previous posts for the BBB Radio Challenge:



UPDATE: BeagleBone Black Internet Radio Challenge - onebeartoe - Project Recap and Final Demo



I am seen in this Adafruit Show and Tell video giving an update on the project:



For this project, please ignore the 3Doodler item I show at the very end.



I couldn't get rtl-sdr to work with the the sound card, so I updated the Debian image from here: - latest-images


and selected this image:


From:, the default credentials are user: debian pass: temppwd


Updating the Debian image meant I had to go through the configuration setup in my last post:



For some reason the USB sound card I already had working, stopped working with the image update.


This link has a comment about updating configuration to make it work: Debian User Forums • View topic - ALSA: cannot find card '0'


Edit /etc/modprobe.d/alsa-base.conf, include/modify the line for snd-usb-audio

options snd-usb-audio index=0


# Setup FM support

sudo apt-get install cmake


sudo apt-get install libusb-1.0



sudo apt-get install build-essential


# this following is from Nitin's blog, with the exception of adding -DDETACH_KERNEL_DRIVER=ON to the cmake command.  More on this below.

git clone git:// 

cd rtl-sdr/ 

mkdir build 

cd build



sudo make install


I spent a good 7 hours trying to make the rtl_fm command work from Java.  I could start the rtl_fm command one time just fine, but once I stopped the process I could not get rtl_fm to start again.  So finally I found a solution.  I had to recompile rtl-sdr with the '-DDETACH_KERNEL_DRIVER=ON' option to allow multiple start and stop actions on the FM radio.

Again here is the cmake command:




Next, install the player for the FM radio:


     sudo apt-get install sox



Now we can test the FM antenna and RTL RM command:


sudo LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib rtl_fm -M wbfm -f 104.5M | play -r 32k -t raw -e s -b 16 -c 1 -V1 -


With the Adafriut antenna plugged in, you should hear whatever station 104.5 is in your local area.  Try others if 104.5 is not a local station.



Install the package that provides access to the amixer command, for controlling the volume.


        sudo apt-get install alsa-utils



The source code is available:




If you want to take a look at development builds, then here is a link to the build server:





There isn't a demo video with the latest features yet.  But if you have setup the system requirements, mentioned here and my previous BBB Radio Challenge posts, then you should be able to run the app on your system.


Here is a link to the latest development build:



Download the JAR file and issue this command:


         sudo LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib java -cp mpd-client-1.0-SNAPSHOT.jar


Something similar to the following will output after you issue the command:


'[B@708a605c - L7TX8BX208663 - - - -'


If you see this, then you can now go to the following URL and see the user interface with an 'Internet' and 'FM' buttons at the top:





What's next?


   * add the save/remove station features seen in 'Internet' mode to the 'FM' mode


   * finish volume control support


   * create an enclosure for the radio


   * add some visual element to the radio

All entries in this blog series:



This week's post is all about the actual build. No coding, no software at all, a lot of pictures though. Here we go.


Original idea


My original idea, as proposed in my Roadtest application, was to "sandwich" all of the components between two sheets op plexiglass and provide access to the LCD for control.

photo 2.JPG

Because I'm not the handiest man around, I thought of designing the plexi sheets I would need and have them laser cut through some online laser cutting service.

I started searching for laser cutting services nearby, but once I saw the price to get what I wanted cut, I quickly abandoned that track. Way too expensive!


It was time to learn a new skill. I went to the local hardware store, bought a sheet of plexi, some drill bits, and got started ...


Getting started


Problem #1: How do I cut a piece of the right size, from the bigger sheet ?


I found that locking the plexi between two pieces of wood, making some cuts and snapping off the piece worked best.

This was after I tried using an electric saw, manual saw, and what not ...


photo 3.JPGphoto 4.JPG

photo 5.JPGphoto 4.JPG


Problem #2: Cutting clean circles


From my little experiment with the electric saw earlier, I noticed that cutting too fast (and most likely with the wrong blade/drill bit/...) the plexi was melting.

I needed to cut two big circles for my speakers though, so I tried to drill slowly using a hole saw (meant for wood).


photo 5.JPG


So far, so good, the hole saw did the trick. On the the third and final problem.


Problem #3: Cutting a clean rectangle


Moving from success to success, I was more and more afraid of messing up and having to start all over again.


The last thing I needed to do, was to cut a rectangle out of the middle for the LCD touch cape to fit in.

I used a Dremel with a cutting disc to slowly cut out the shape. The plexi was melting, but I figured I would clean the edges using sandpaper afterwards.

photo 1.JPGphoto 1.JPG


I started fitting the components to see if my work was at least usable:


photo 2.JPGphoto 3.JPG

The different components fitted nicely, but the cut edges were very messy. So I came up with an idea to mask all of that ...




I designed and printed some custom pieces to:

  • hide my messy work
  • protect the speakers
  • hide the LCD cape buttons (as I don't use them)
  • give the overall build a nice look


I designed the pieces in Sketchup, based on the measurements I had made to cut and drill the plexi.


Screen Shot 2014-03-09 at 21.44.31.pngfront.PNG


After a few test prints and some corrections, I printed the final version of each piece:

  • speaker grill
  • LCD cover
  • radio stand

photo 4.JPGphoto 2.JPG

photo 3.JPG


End Result


Here it is, the end result. My Beaglebone Black Radio in all of its glory:

photo 5.JPGphoto 5.JPGphoto (10).JPG

The cables at the back still require some more cleaning up, but overall I'm very satisfied with the result!


With the build done, I can now spend the remaining time of the challenge on finalising the software side of the project.

In this post, I'll be talking about three things in general:

  • Getting a new image, updating it and fixing things that are broken.
  • Installing RTL-SDR which will be used for receiving FM transmissions and others.
  • Testing the installation by streaming raw audio over the network.


System Setup

I spent around a week playing around with the components, got myself a micro HDMI to HDMI adapter and basically tried to see what the system can do. I like starting projects with a brand new OS so that there are no weird software collisions. For Windows people, there is a Getting Started guide which also covers how to update, there is no need to cover it again. If you are using Linux, steps are as following (if you don't know them already):

  • Download the latest Beaglebone Black eMMC flasher Angstrom image from - latest-images.
  • Unzip it by using unxz BBB-eMMC-flasher-2013.09.04.img.xz. You will get a file with .img extension only. If xz-utils are not installed, you have to install them.
  • Insert SD card to your machine and run dmesg to find the device filename of your SD card. Mine is almost always sdb, but it's nice to be sure and on the safe side.
  • Depending on the system, your system may have mounted the partition automatically. SD cards have just a single partition if you're using a brand new card. But it may have more if you used the same SD card in another embedded system. dmesg output usually contains something like sdb1 at the end in this case. Use sudo umount /dev/sdb1 to unmount it. If there are sdb1 and sdb2, you can use sudo umount /dev/sdb{1,2} to unmount both of them.
  • Now you can write the image file to the SD card. Use dd for this. In my case, the command was sudo dd if=BBB-eMMC-flasher-2013.09.04.img of=/dev/sdb. Remember, you are not writing to the partition but to the entire card! Image file actually contains more than one partitions.
  • Eject the card, plug it to your Beaglebone Black. Then hold down the USER/BOOT button and plug in the 5V adapter. LEDs will start flashing, wait until all 4 USER LEDs are lit solid. This will take a while, so do something productive. Or not productive.
  • When all 4 USER LEDs are lit, unplug the adapter, remove SD card and power it back up again. It's ready to use.

After this, you have a brand new system. It even works with the LCD4 cape out of the box. But If you look at the image name, it is a pretty old image and there are packages need upgrading. For this, I plug in the Ethernet cable in and power it up. I can see it got a IP from my router, so I SSH into it by using the username root and no password. Angstrom uses opkg as it's package manager so you just run

opkg update
opkg upgrade


You have to wait a while again as it upgrades many packages. Again "This will take a while, so do something productive. Or not productive." After it's done, you can reboot your system. Connect to it again via SSH. If you have an LCD4 cape attached, you'll see that the autologin is disabled. Basically you'll see the login screen asking you to select a user.



This is something you may want to fix. You have to open /etc/gdm/custom.conf with vi and insert the following under [daemon]



This will login as root after you reboot your system.

You may also notice the date and time is not correct. Upgrade procedure sets up the ntp client so we get a recent time but if your location is not set correctly, it may be off a few hours. I live in Tokyo, so I issued the following commands to set up the timezone

root@beaglebone:~# cd /etc/
root@beaglebone:/etc# rm localtime
root@beaglebone:/etc# ln -s /usr/share/zoneinfo/Asia/Tokyo localtime
root@beaglebone:/etc# ls -al localtime
lrwxrwxrwx 1 root root 30 Mar  6 19:50 localtime -> /usr/share/zoneinfo/Asia/Tokyo


Now date command gives you the correct time. List /usr/share/zoneinfo and it's subdirectories to find a suitable timezone. Your system is now set.


Install RTL-SDR

For this, I followed the guide at RTL-SDR wiki. You need to install cmake and libusb-1.0-dev packages. You can do this with

root@beaglebone:~# opkg update
root@beaglebone:~# opkg install cmake libusb-1.0-dev


After this just run the following commands to install RTL-SDR

root@beaglebone:~# git clone git://
root@beaglebone:~# cd rtl-sdr/
root@beaglebone:~/rtl-sdr# mkdir build
root@beaglebone:~/rtl-sdr# cd build/
root@beaglebone:~/rtl-sdr/build# cmake ../
root@beaglebone:~/rtl-sdr/build# make
root@beaglebone:~/rtl-sdr/build# make install
root@beaglebone:~/rtl-sdr/build# ldconfig


After this plug in your SDR dongle and test it with rtl_test

root@beaglebone:~# lsusb
Bus 001 Device 002: ID 0bda:2838 Realtek Semiconductor Corp. RTL2838 DVB-T
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
root@beaglebone:~# rtl_test
rtl_test: error while loading shared libraries: cannot open shared object file: No such file or directory


OOOPS! What is it? Apparently in Angstrom the library path for librtlsdr is not set properly during install so ldconfig does nothing. You have two solutions, one is to run

export LD_LIBRARY_PATH=/usr/local/lib/

each time you login or you can run

echo "/usr/local/lib/" > /etc/

which sets up the library path during each boottime. I went with the second choice. Now if I run rtl_test

root@beaglebone:~# rtl_test
Found 1 device(s):
  0:  Realtek, RTL2841UHIDIR, 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.

Info: This tool will continuously read from the device, and report if
samples get lost. If you observe no further output, everything is fine.

Reading samples in async mode...
lost at least 4 bytes
^CSignal caught, exiting!

User cancel, exiting...
Samples per million lost (minimum): 0
rtlsdr_demod_write_reg failed with -1
Segmentation fault


I stopped it with CTRL-C combo, that's the reason for the entries after line 15. Now we are set to test our FM streaming.


Receive and Stream with RTL-SDR

rtl_fm comes with RTL-SDR and can put the data on STDOUT at a given sample rate. Also there is a real nice program called netcat which can be used for many many things, including writing client-server type applications on the shell. So first install netcat

root@beaglebone:~# opkg install netcat


I use rtl_fm to tune to a certain frequency, then pipe it to netcat. netcat is in listen mode so it'll wait for incoming connections and if a client is connected, it'll push the data. NHK radio is on 82.5 MHz so I tune to it.

root@beaglebone:~# rtl_fm -f 82.5M -s 44.1k - | netcat -l -p 8080
Found 1 device(s):
  0:  Realtek, RTL2841UHIDIR, SN: 00000001

Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Tuner gain set to automatic.
Tuned to 82753575 Hz.
Oversampling input by: 23x.
Oversampling output by: 1x.
Buffer size: 8.08ms
Exact sample rate is: 1014300.020041 Hz
Sampling at 1014300 S/s.
Output at 44100 Hz.


8080 is the port I chose for streaming it, you can change it as you wish. On my laptop with netcat and aplay installed, I can listen to some Japanese radio.

tayken@tayken-labtop:~$ netcat 8080 | aplay -r 44.1k -t raw -c 1 -f S16_LE
Playing raw data 'stdin' : Signed 16 bit Little Endian, Rate 44000 Hz, Mono
^CAborted by signal Interrupt...


One word of warning is the server will quit if you terminate the client connection with CTRL-C as the messages are sent both ways on netcat. One workaround is to put the server in a while loop so that each time the client sends the exit signal, it starts again. You can do this with

root@beaglebone:~# while true; do rtl_fm -f 82.5M -s 44.1k - | netcat -l -p 8080; done


You'll have to send rapid a few interrupt signals on the server shell to stop it. Here is a network diagram explaining this system. I'm putting it here as I'll be adding another server to this chain for streaming purposes.




In the next post I'll be adding another machine with ffserver running to stream the audio. It'll also have a basic webpage so that I'll get the audio when I click the link.

As I expected, the BBB SDR road test would lead me down an exciting road to discovery.  I have not been disappointed.  The 1st step was of course to unpack all of

the components of the road test package.  I was impressed by the small size of the SDR USB dongle.  I have had previous experience with the BeagleBone Black,

having purchased one in late 2013.  The LCD display however was entirely new to me.


I admit to requiring a moment to figure out exactly how the LCD display mounts on top of the BeagleBone Black, since there wasn't any documentation specifically

explaining which direction it was to be mounted.  Fortunately, on closer inspection you discover that the display can only be mounted successfully in one

orientation.  A quick confirmation on the Internet proved my deduction correct.


For your own reference, the LCD display mounts with the left side of the display above the 5 V power connector and ethernet connector of the BeagleBone Black.  The

right side of the LCD display, which contains the 5 pushbuttons for controlling the display, hangs over the right side of the BeagleBone Black above the USB





The display is easy to mount into the 2 sets of header sockets on the top of the BeagleBone Black.  There isn't any set up required, just plug it in and reboot

your BBB and voilà you have your LCD display.  With the keyboard plugged in you have a complete self-contained standalone Linux-based computer.


Since I had no previous experience with the USB SDR dongle, I felt the best way to proceed was to start by connecting it to my desktop PC.  After doing some

research on the web, I found and downloaded several Windows-based software packages which would interface with the SDR.


I have experimented with the following:




While each of these offer slightly different features, the SDR# was the easiest to install and get operational.  I was able to confirm that my USB SDR dongle was

capable of receiving local commercial FM broadcast signals.




I was intending to use the local WeatherRadio Canada broadcast station close to my location has a known radio source.  The station broadcasts at 162.400 MHz,

continuously 24 hours a day.  My initial experimentation with the SDR dongle showed that I was just barely able to pick out the signal from the background noise

with the SDR antenna mounted on my office desk beside me.  This discovery leads me to believe that if I intend to produce an accurate RF signal map of the local

radio sources in my area I will need to improve the signal-to-noise ratio of incoming signals.  This will probably mean that I will need to replace the magnetic

mount antenna that comes default with the SDR dongle, or at the very least mount the antenna outside in a better receiving position.


In the meantime, I've decided to proceed with a proof of concept where I will scan across the commercial FM broadcast band and make an inventory of the stations

I'm able to receive.  The stations are strong enough to be able to be received by the default antenna in a convenient indoor location.  In addition they bring with

them the bonus that I know where to expect to find these stations.  Once I've developed a system capable of scanning across that band and successfully locating and

identifying the frequencies and received signal strengths of those stations then I can concentrate on improving the reception capabilities of the SDR.


It is now time to turn my attention to getting the SDR dongle to work on the BeagleBone Black device.  Initially I had envisioned using the GnuRadio software

system as the heart of my frequency scanner.  As I did more research I realized that the processing requirements of that software package might in fact be too

intense for the BeagleBone Black.  I did install this package on a Ubuntu Linux VM running in VMware on my Windows 7 PC.  It certainly lives up to its reputation

as being a very complex piece of software.  I can appreciate the power and flexibility that it seems to provide.  I began to wonder however if it was overkill for

my application.


I took a step back and decided to try a minimalist approach.  I followed the procedures described here ( to install the

rtlsdr library and utility programs designed to work with the Realtek RTL2832U based SDR dongle's.


The RTLSDR library was fairly straightforward to install.  Make sure that you take note of the requirement to have the development packages for libusb1.0 installed

on your BeagleBone Black before you attempt to install the RTLSDR software.


Once I completed the installation of the RTLSDR library, I was able to test the success of the installation by running the following command from the BeagleBone

Black terminal.

root@beagleboneblack:~# rtl_test -t


This provided me with the following return information thereby confirming the successful installation and connection to my SDR dongle.


Found 1 device(s):

  0:  Realtek, RTL2841UHIDIR, 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.



After looking through the documentation available for the RTLSDR library, I discovered that there is a utility called rtl_power, which may do exactly what I need to help me create my local RF source map.  In my next blog installment, I will describe in detail how I plan to use rtl_power for my BeagleBone Black Internet Radio Challenge Road Test.