Posts Tagged ‘OsmoSDR’

Simple FM Receiver with OsmoSDR in GNURadio

Monday, May 14th, 2012

Finally, my 20$ EZcap USB DVB-T stick has arrived, and I wanted to start with a simple FM receiver to see how to operate this thing with OsmoSDR in GNURadio!

I’ve already installed GNURadio, RTL-SDR and OsmoSDR using the GNURadio build script on my Ubuntu 11.10 machine. To start out with the USB-receiver, you can just run the example contained in the OsmoSDR sources (./gr-osmosdr/apps/osmosdr_source.grc) to see if the stick works. It should do its job out of the box, at least it did for me. When running this example, you should see a nice FFT of the received radio signal at the defined frequency with sample-rate dependent bandwidth.

Slightly altered osmosdr_source.grc example

If this example works, you can go on and work on bigger things instantly. As already mentioned, I wanted build a very basic FM receiver. GNURadio has everything you need for that on-board, and therefore the grc model for such a receiver looks like this:

Basic FM Receiver in GNURadio Companion

Some comments on the used blocks and their parameters:

  • OsmoSDR Source: gets the desired frequency from the osmo_freq slider, samplerate is chosen in the osmo_samp_rate variable
  • Rational Resampler: gets the decimation and interpolation values from osmo_samp_rate and samp_rate
  • Frequency Xlating FIR Filter: sample rate from samp_rate, filter_taps is defined as a firdes.low_pass(1,samp_rate,100e3,1e3) (feel free to play around with the latter two parameters of the filter!). The center frequency can be changed with xlate_tune
  • WBFM Receive: Quadrature rate is samp_rate
  • For the FFTs, I’ve chosen a configurable refresh rate, you can tweak it according to the performance of your computer (as well as the FFT size…). Also, their baseband frequency is set to osmo_freq, respectively osmo_frequ+xlate_tune to change the x-axis of the FFTs according to the currently slider settings.

After putting everything together, the following GUI should appear and you can tune and listen to your favorite FM station!

Running and receiving fm_rcv


Known issues:

When I’m running GNURadio simultaneousely with other sound sources (e.g. a video in a browser), the grc model throws the following error:

audio_alsa_sink[hw:0,0]: Das Gerät oder die Ressource ist belegt
Traceback (most recent call last):
  File "/home/chris/ufsdr/osmosdr/fm_rcv/", line 280, in 
    tb = FM_rcv()
  File "/home/chris/ufsdr/osmosdr/fm_rcv/", line 201, in __init__
    self.audio_sink_0 = audio.sink(48000, "", True)
  File "/usr/local/lib/python2.7/dist-packages/gnuradio/audio/", line 345, in sink
    return _audio_swig.sink(*args, **kwargs)
RuntimeError: audio_alsa_sink

I solve this problem by a forced restart of the alsa-device by identifying the process(es) using PCM currently with

lsof | grep pcm

and killing the appearing tasks by their ids with



For further (basic) information see:
OsmoSDR Wiki:
GNURadio Homepage: