Raspberry Pi Software Defined Radio

OK, so I failed in my attempt to get the GQRX Software Defined Radio (SDR) to work on my Raspberry Pi.

But I've now come up with a simpler arrangement using rtl_fm that does work.

By using rtl_fm and some simple lines of code, I now have a Pi SDR with preset stations and the ability to fine tune.

In an earlier post I described how to create an SDR using a cheap TV dongle on a Debian based Linux machine.

I was not able to get this working on my Pi-2 as there was a pulse-audio error. It looks like gqrx v2.3.1 was compiled to use pulse-audio, so it would probably need to be compiled from source to use Alsa (I'm not that keen!).

But playing around with rtl_fm I found I could get it to work on the Pi just using a terminal command like this:-

rtl_fm -f 100900000 -M wbfm -s 200000 -r 48000 – | aplay -r 48000 -f S16_LE

…which gave me ClassicFM at 100.9MHz.

The Pi-2 seemed well behaved, with “top” reporting 10-15%cpu useage.

Gambas SDR application

So I thought I'd make a simple SDR application using Gambas. You could use almost any language for this, including Python. This is a pretty trivial programming task, as I just need to run a command with appropriate parameters, and make sure I kill the task when changing stations.

The idea is that I can selected from a number of preset stations via radio buttons (no, they really are called radio buttons!). The frequencies for each station can either be hard coded, or stored in a settings/config file.

The “fine tuning” buttons change the frequency in 10kHz steps, and the final frequency can be saved back to the settings file.

I can also select “manual” then enter a frequency, select a modulation mode, and then Go to the channel.

So at the heart of the code I have this:-

Raspberry Pi Software Defined Radio

Public Function PlayStation() As Boolean
Dim strCommand As String

strCommand = “rtl_fm” & ” -f ” & strFrequency & “e6″ & ” -M ” & strModulation & ” -s ” & strSampleRate
strCommand = strCommand & ” -r ” & strSampleAudio & ” – | aplay -r ” & strSampleAudio & ” -f ” & strAudioFormat
hPlay = Shell strCommand


…and when I click on a radio button to change stations, I do something like this:-


For more detail: Raspberry Pi Software Defined Radio

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top