Saturday, October 18, 2014

Software Defined Radio - A First Taste

I've been interested in Software Defined Radio for a while now, especially since cheap RTL28xx based dongle front-ends have become available. I ordered one on Amazon for $8 four weeks ago. Shipped directly from Shenzhen, it arrived this week. While I was waiting, I started investigating apps to control the radio. By far the most versatile tool appears to be GNU Radio; however, there's a bit of a learning curve for it. While I was waiting for my RTL dongle, I did some of the GNU Radio tutorial.

When my dongle arrived, I found that GNU radio doesn't have an RTL functional block by default. You can download and compile an RTL functional block, but I ran into difficulty which quickly became a rat hole. So plan B was to install every thing I thought might be useful. That kinda worked. Here's what I installed; all from the Ubuntu repositories.

GNU Radio -> apt-get install gnuradio grc
          to run ~$ /usr/bin/gnuradio-companion.
GR-OsmoSDR -> apt-get install gr-osmosdr
RTL-SDR -> apt-get install rtl-sdr
GQRX -> sudo add-apt-repository ppa:gqrx/releases (maybe)
        sudo apt-get install gqrx-sdr
        to run just ~$gqrx  




GQRX looked the most attractive app for a first try because it's like something one might assemble in GNU Radio. In fact it's based on GNU Radio. At first GQRX wouldn't start  because the Linux kernel had control of the radio. I found the fix here: https://opendesignengine.net/news/53, where it says to either

 run this before using the RTL:
    sudo rmmod dvb_usb_rtl28xxu 

Or, for a permanent fix, add this to /etc/modprobe.d/blacklist.conf

    blacklist dvb_usb_rtl28xxu

Once GQRX was started I found lots of static and no radio stations. It was time to try something more basic. I Googled one-line commands to play FM broadcast stations until I found one that worked.

 ~$rtl_fm -f 90.9M -s 192000 -r 48000 - | aplay -r 48k -f S16_LE -t raw -c 1

I found that adjusting orientation of the RTL's little antenna made a big difference.

Next I quit RTL-FM and restarted GQRX. After clicking and un-clicking the AGC button, FM stations appeared and I could move the dial across the spectrum and listen to the various stations.


Tuning on the VHF band with narrow-band FM demodulation is a little more tricky. Here the spectrogram is useful because the traffic is infrequent. You can see that there were two transmissions between 160.22 and 160.788 MHz that were missed because the tuning dial was not on them. Because they are on the spectrogram  the dial can be moved over them, and they can be listened to the next time they light up.