Introduction: RTL-SDR FM Radio Receiver With GNU Radio Companion

RTL-SDR is currently very popular topic on the Net. There are also many guides on how to use it on Windows and Linux too. But starting to use it myself I haven't found any guide that explains whole process from installing necessary drivers and software to building first simple receiver using GNU Radio which is the most capable software which could be used with RTL28xxU chips and that's what this Instructable is about. It should be, for me I hope too, first step to learn how the thing works from scratch and to make projects capable of capturing signals that wasn't decoded using RTL-SDR yet i.e. 433 MHz band.

Step 1: What's RTL-SDR?

If you are interested only in how to make GRC project go to step 5.
RTL-SDR is the cheapest method to get into the world of SDR (Software Defined Radio) - method of receiving (RTL-SDR have no capability to transmit) and processing radio transmission using your PC. Using it you can receive everything that is transmitted between about 20~2000 MHz depending on second chip on the device.
In brief it can hear i.e.:
- ordinary FM radio stations
- police radio transmissions
- plane and ship tracking informations
- small radio devices like car keys
- probably GPS satellites (as of now there is no confirmed method to do this)
- International Space Station and other space equipment that transmits below 2 GHz
- every other device that you know transmits on these frequencies

Step 2: How to Get It?

The simplest method is to get one on eBay. There are many offers that have in their caption names of the chips that are on board. They costs about 10$. Here you need to be aware of few different chips that are currently on market. The difference between them are frequencies they are capable of receiving. Summary of the differences is on that site: 
http://sdr.osmocom.org/trac/wiki/rtl-sdr
The most reasonable choice is R820T chip and that tutorial is based on its capabilities. The other good chip is Elonics E4000 but they are actually more expensive ones.

Step 3: What You Will Need?

I'm using Arch Linux and receiver with RTL2838 and Rafael Micro R820T chips. It would be good if you had good antenna cause the one that is included to the package has really bad performance. Of course every Linux distro could be good.

Step 4: Connecting the Hardware and Installing Software

The first thing is to connect your dongle and check if it has appropriate chips using
$ dmesg | tail
or
$ journalctl
Here I had some troubles with default driver of the dongle that was hanging OS when I unplugged it so I had to disable that driver by creating new .conf file in /etc/modprobe.d that contains one line:
blacklist dvb_usb_rtl28xxu
add that file to initrd by inserting its path to FILES variable in /etc/mkinitcpio.conf:
FILES="/etc/modprobe.d/blacklist.conf"
and generate new image by mkinitcpio -p linux
Now after system restart the problem was solved.
(on other systems the procedure will probably be completely different)
After fixing driver problem you can install packages needed to use RTL-SDR.
Here we will install 'rtl-sdr', 'sdrsharp-svn', 'gnuradio' and 'gr-osmosdr-git'.
rtl-sdr is the main driver and can be installed on Arch from community repo:
# pacman -S rtl-sdr
or its git version available on AUR as rtl-sdr-git
SDR# is the program that offers basic capability to decode FM and AM radio and have easy to learn GUI so using it is the best for beginners. It is available on AUR as sdrsharp-svn.
The most capable software for RTL-SDR is GNU Radio and its graphical tool: GNU Radio Companion. It is also available on AUR (name: gnuradio). It is also required to install package gr-osmosdr-git from AUR that is needed to use RTL-SDR dongle as source in GRC.
(and again on different operating system whole process is different, maybe simpler maybe harder, not tested myself but on Ubuntu rtl-sdr should be available from apt-get and on Fedora it should also be on default repositories, gnuradio has good installation instruction here: http://gnuradio.org/redmine/projects/gnuradio/wiki/InstallingGR)
SDR# could now be used also to find station which signal is strong enough to be received without any disruptions. If you found one after making the program you can check if it's working on that station as good as on SDR#.

Step 5: FM Radio - Theoretical Introduction

The simplest FM radio consists of few elements:
- signal source - in our case it would be RTL-SDR dongle
- low pass filter
- WBFM demodulator
- audio output - your PC's sound card
There can be few other elements depending on input and output sample rate, if it will be possible to match them using only above elements there won't be any other.

Step 6: RTL-SDR Source

osmocom Source can also be used here. We can find both of them in Sources category on the right sidebar of GRC. Our signal input. We need to set its sample rate to 2M. It can be done by editing samp_rate variable and setting its value to 2e6. Here we will also set the frequency of the station we want to receive.

Step 7: Low Pass Filter

The next step is to filter out frequencies other than the one we centered in th previous step. In that task we will use a low pass filter block. It can be found on filters category. We here set cutoff frequency to 100e3. This is because that's standard band's width. I don't know what correct value for transition width should be, but trying to change that I found that the higher value the better so it's finally set to 1M. We also sets decimation to value "int(samp_rate/quadrature)" so it will be slowly matching to our sound card's sample rate.

Step 8: WBFM Receive

Now we could do the nearly final and the most important step: placing the FM demodulator. Its block can be found on modulators menu. In my case its quadrature rate equals 500k. I don't know if it could be changed to something else so if you are not sure just leave it as is. In that setting it should work. 

Step 9: Matching to Audio Output and Volume Regulation

That two tasks can be done by using rational resampler and multiply const blocks. The first can be found in resamplers menu and the second is in math operators category. At first we need to convert rate from 500k to 48k so we need to decimate by 500 and then multiply by 48. In the second block we set const to 'volume'. Now we can create variable or place element named "WX GUI Slider". Placing the second one will let us regulating volume on GUI that will be shown after our program starts. This can be of course done with any other variable. 

Step 10: Audio Sink

And finally we link Audio Sink block (found in Audio) with Multiply const. Now its only required to edit its rate and choose 48k from a drop down list and that's it! If you don't have that option just choose the biggest value and edit value in rational resampler and it should work.

Step 11: Final Remarks

If you don't know how some step has been done you can find finished project on my site. There is also another project that I created trying to figure out how it works so it has few additional features like FFT graphs. The links are in this post: http://v3l0c1r4pt0r.tk/newsy/czytaj/37 which is a bit modified version of this Instructable.
Finally one more note: during the tests of this schematic I realized that decimation to 500k should not been made on the filter block but before it so I modified it and now demodulated audio is much better than before.

Comments

author
snoop911 made it! (author)2017-01-28

I got FM to work fine, any tips on how to do AM?

I'm trying to listen to 640khz with a rtl-sdr and HamItUp/SpyVerter. The upconverter puts the RF at 125Mhz, so I tune the radio to 125.64e6 (125e6 + 640e3), then pass it to a low pass filter before demodulating and outputting to the sound card. Unfortunately, it doesn't work, any idea what could be wrong?

http://imgur.com/a/BxBVQ

author
nfarrow made it! (author)2017-01-06

Anyone know what the audio device path would be for the audio sink running on a raspberry pi?

author
RebeccaS176 made it! (author)2016-11-13

Worked really nicely! The one thing to note is if you are tuning to an FM frequency, it's in MHz. Meaning 100.3 is really 100.3e6. Also I implemented this with QT GUI options (which is preferred with newer GNU Radio).

Screen Shot 2016-11-13 at 11.19.01 AM.png
author
Amit Hambar made it! (author)2016-09-06

Great work... but I think in the Low Pass filter, transition width must be very less. you can choose in between 5k to 10k. Otherwise filtering will not work.

Check filter response...

author
haminhtranhanh made it! (author)2016-08-26

I don't remember what I'd done to install gnuradio and driver for my cheap rtl-sdr device on my mbp, and effort to figure out blocks for version of gnuradio-companion on macport, but finally I can get it work :D

Screen Shot 2016-08-26 at 11.11.12 PM.png
author
MichaelS527 made it! (author)2016-07-23

works like a charm, just had to check a couple things but we got 'er done, thanx!

Screenshot_20160723_193546.png
author
MarcusMuellerEttus made it! (author)2015-07-26

Just a quick heads up: Texts like these are awesome, but they tend to outdate at some point. The official wiki of GNU Radio, www.gnuradio.org, is the place where information on GNU Radio is gathered.

Generally, to get started, I recommend the continously updated, tested and supported Guided tutorials:

https://gnuradio.org/redmine/projects/gnuradio/wiki/Guided_Tutorials

They are not as centric on doing a specific thing with a specific piece of hardware, so this won't get you started as fast doing something, but it will explain the core concepts, so you can do anything pretty quickly!

author
DavidF15 made it! (author)DavidF152015-10-28

https://gnuradio.org/redmine/projects/gnuradio/wiki/Guided_Tutorial_Hardware_Considerations/62#A-Working-Software-Radio-Broadcast-FM-Receiver is an example FM radio setup from the GnuRadio site.

author
gwenhastings made it! (author)2014-02-03

I keep getting error messages about source io size 8 doesnt match sink io size 4 for blocks_multiply_const and for the analog_wbfm_rcv0 with those messages reversed.. dont see a way to alter io size.. what am I doing wrong?

but thanx for an excellent tutorial... some clarification about how to connect block in the flowgraph would have been nice (I know afterwards its obvious but i didnt hunt a bit for a few moments.. for that)...

gwen

author
fduraibi made it! (author)fduraibi2015-01-29

The error message is not meaningful, but it is happening since you have different data types. If you look at the pictures in the instructable above you will notice the "in" & "out" tab colors are half blue and the other half is orange, these colors define the data type such as int, float, complex ...etc and you must match the type on the intput with the output.

So in your case you need to change the default setting for the rational resampler and multiply const blocks to "float" since the FM receiver output is float, and the audio sink input is also float.

author
deadbok made it! (author)2014-02-05

Thanks for getting me started with GNU Radio. Great Instructable.

rtl-fm.grc.png
author
Saeed Nazarian made it! (author)2013-11-01

It's seems cool!

About This Instructable

334,105views

111favorites

License:

More by v3l0c1r4pt0r:RTL-SDR FM radio receiver with GNU Radio Companion
Add instructable to: