Channels ▼

Al Williams

Dr. Dobb's Bloggers

Soft Radio

September 17, 2012

I've been playing with a $20 USB TV adapter that can work as a software-defined radio (if you missed the description of it, read this). The EZTV-668 is actually made to receive television, but with some software it can receive a large chunk of the VHF and UHF bands.

Of course, that's the problem. What do you use for the software? GNU Radio is perfect but you have to know how to use it. Although GNU Radio uses C++ and Python, you don't need to know much of either to do a lot with it — especially if you use the graphical GNU Radio Companion. You do, however, have to know a little bit about radio.

To avoid that, the last few times I concentrated on using GNU Radio with just the computer's sound card. It hardly deserves the name GNU "Radio" in that case, but it does a fine job of audio processing nonetheless.

This time, however, I'm ready to get the radio part working. You'll need the hardware to follow along, in addition to the software setup from http://sdr.osmocom.org/trac/wiki/rtl-sdr. You might consider testing with SDR# (a .NET program that will run on Windows or under Mono on Linux) just to make sure everything is working.

Take a look at the flowgraph in Figure 1 below. This is more complicated than the earlier ones, but only a little. You still have the main block and the samp_rate variable block. You also have an audio sink (the sound card). You've seen the WX GUI slider boxes before and even the WX GUI FFT Sink — those appeared in the audio examples from last time. You can download the flowgraph here.

The new blocks, of course, are where the action is. If you notice, the ports on several of the new boxes are blue. This indicates the data is complex (that is a real and imaginary part) instead of the orange float data (audio). If you are a signal-processing guru, the complex data represents the I and Q of the signal.

The first block of interest is the OsmoSDR Source. That is one of the blocks that knows how to communicate with the USB radio. In the figure, you can see the sample rate is set to 2.048MHz and the frequency is set to 107.5 MHz (a local radio station).

Keep in mind that some of the settings are actually set by sliders, and the number is just the current setting. For example, the frequency is set by the frequency slider (not surprisingly). You can see a screenshot of the final user interface below.

After the source is a low-pass filter to reject any high-frequency noise. This is similar to the bandpass filter I used last time except it passes all frequencies lower than the threshold (125 kHz in this case). One thing new here is the filter is decimating the signal (that is, reducing the sampling rate. In particular, there is no reason to decode the FM signal at a high sample rate (yet, the receiver works best at that rate). By specifying 8 as the decimation number the output of the filter will be at a lower sample rate (2.048 MHz/8, as you might guess, or 256 kHz).

That explains the FM Demod block having its rate set to 256k. This block converts the radio signal into audio (note the blue input and the orange output). The deviation is set for a broadcast FM station (a two-way radio would be much narrower) and there are some audio parameters as well. The audio rate is decimated by 4, which produces a 64 kHz audio sampling rate.

The sound card isn't going to appreciate 64 kHz data. The Rational Resampler block converts the sample rate easily. The key is the ratio between the decimation and the interpolation. You can see the output will be 48 kHz for a 64 kHz input and that's what the audio sink uses.

Although the flowgraph looks complex, it isn't much different from the earlier examples. It just has the radio source and, of course, a demodulator. If you browse the examples included with GNU Radio, there are examples of decoding different things including AM radio, digital pagers, and many other types of radio signals.

There's lots more you can do with GNU Radio including writing your own code in Python or C. However, I think I've had enough radio fun for awhile. If you've ever had an interest in software defined radio, it is hard to imagine you'll ever find a less expensive way to get started with it. Granted, the included antenna isn't much and the performance of the receiver is not spectacular, but for $20 or $30, how can you complain?

Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.
 


Video