Skip navigation

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.

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.


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.

Hello everyone!


This is the first post for my Beaglebone Black Radio Challenge entry. I own a Beaglebone, so I have some experience with it. I even wrote a blog post about it on my own blog about compiling a new Angstrom image and playing around with GPIO pins from the shell. I also own a Raspberry Pi (I teach about using it at my local hackerspace) and couple of Chumby Hacker Boards. I also worked with Gumstix Overo boards while I was writing my B.Sc. thesis.


Project Description

I submitted two project ideas for the challenge:

  • An internet radio station: We don't have too many FM stations in Japan, here is a list from Wikipedia if you are interested. The idea is to tune to a channel, and then stream this audio signal through a port to a broadcasting server and also through the speakers or headphones if I can find a suitable USB sound card. I'll have to put some sort of streaming server in between if it cannot handle the load. The connection will be over the Ethernet connector as speed is critical and the radio will be fixed in a location. The display will show some basic information like signal strength and tuned frequency. I've worked with a similar system before in my college days so not all is new to me. But I'll have to learn some of it again as long time has passed.
  • A handheld ADS-B receiver: ADS-B is used for tracking aircraft and a similar system also exists for ships called AIS. The idea is to use the SDR to receive the ADS-B messages and show the result on the display. The wireless connection will be used to stream this data to the internet so that others can see what you're seeing on their tablets or from plane tracking websites. This project is the hardest one in terms of hardware as it includes antenna construction (the supplied antennas usually don't perform well at 1090 MHz) and some power electronics in order to have a mobile unit. Software side is easier as there are already some programs written for decoding ADS-B data and I use a couple of them. This project will be most useful for plane watchers as they can see lots of information about the planes about to take off and land. If time permits, I'm planning to design and laser cut a case for it so that I have a compact unit.


Next week I'll play around with my Beaglebone Black and the LCD cape. I'll also try to see if I can directly run dump1090 and see it's web output. This time there will be pictures.