Getting started with RTL-SDR

Code - 24-07-2018

What is RTL-SDR?

Software-defined radio (SDR) is a radio communication system where components that have been traditionally implemented in hardware (e.g. mixers, filters, amplifiers, modulators/demodulators, detectors, etc.) are instead implemented by means of software on a computer. This gives a lot of freedom to the user with the signal processing.

While SDR hardware used to be pretty expensive, it was discovered by Eric Fry that the RTL2832U chipset on a mass produced TV tuner could be used as a wideband software defined radio via a custom software driver. RTL-SDR has become extremely popular and has democratized access to the radio spectrum.

A RTL-SDR dongle

With a classic RTL2832U+R820T USB dongle priced at 5$, the RX bandwidth is 24 to 1766MHz. Thank to the concept of SDR, we can demodulate and detect about everything transmitted with radio communication within this range, including:

  • ISS (International Space Station) streams,
  • Ham radio transmissions,
  • Radar/aeronautical data,
  • 433MHz domotic appliances,
  • ...

Some of these require a matching antenna and some sort of signal conditionning. However, this can also be DIYed.

This article is a quick start guide with RTL-SDR to begin capturing and decoding signal on GNU/Linux (Ubuntu 16.04 in my case), and two simple example projects.

Getting started with RTL-SDR on Linux

To start using the RTL-SDR on GNU/Linux, the bare minimum is the librtlsdr library from osmocom. It includes the driver and some basic SDR command line tools.

Prerequisite:

sudo apt-get install cmake git libusb-1.0-0-dev zlib1g-dev

First, we download the library's source from osmocom's git deposit.

git clone git://git.osmocom.org/rtl-sdr.git
cd rtl-sdr/

Then, we configure the build and launch the compilation.

mkdir build
cd build
cmake ../ -DINSTALL_UDEV_RULES=ON -DDETACH_KERNEL_DRIVER=ON
make

Finally, we can install the library on your system.

sudo make install
sudo ldconfig

To make sure it is correctly installed, you can run the rtl_test command with your RTL dongle plugged in. The output should look like this:

$ rtl_test
> Found 1 device(s):
>     0: Realtek, RTL2838UHIDIR, SN: 00000000
> 
> Using device 0: Generic RTL2832U OEM
...

Success, the hardest part is over!

Note: if you want to update a preexisting installation of librtlsdr later, you must call sudo make uninstall prior to the installation.

GNU radio & GQRX

While you could technically use the library as is, there are dozens of graphical programs to use with the RTL-SDR including general purpose software, single purpose software and research software. You can find an almost exhaustive list here. There are two you should install regardless of what you actually want to do with your SDR:

  • GNU Radio is the SDR development toolkit. Using blocks in a flowchart style, it generates signal processing code. It does requires some amount of work to get you started, but there is pretty much no limit to what you can achieve with this software and a RTL-SDR. The interface of GNU Radio
  • GQRX is based on GNU Radio. It is a grapical spectrum analysis tool to view, demodulate and listen to about anything. It perfect for quick analysis of the spectrum and discovering the power of SDR. The interface of GQRX

To install both of them, we simply enter the following commands:

sudo add-apt-repository -y ppa:myriadrf/drivers                                    
sudo add-apt-repository -y ppa:myriadrf/gnuradio                                  
sudo add-apt-repository -y ppa:gqrx/gqrx-sdr                               
sudo apt-get update
sudo apt-get install gnuradio gqrx-sdr

You are done! To launch them, use your application menu, or gqrx/gnuradio-companion commands. You should get familiar with GQRX and your RTL-SDR before you can really start having fun with your own radio projects and start learning about GNU Radio.



Simple projects examples

To start actually using RTL-SDR, here my two first quick and easy projects.

Spectrum scanning

The rtl_power command (part of librtlsdr) scans a range of the radio spectrum and outputs tabular data of the average power per frequency. I wanted a one-time scan from 95MHz to 105MHz, with a resolution of 100kHz, integrated over 10s. This is the command I used (found from the man):

rtl_power -f 95M:105M:100k -i 10 -1 > fmscan.csv

To exploit this CSV (Comma Separated Values) data, I imported into LibreOffice Calc, rearranged it, and created a XY graph.

A plot (average power per frequency) of the radio scan

Those large spikes correspond to FM radio broadcasts.

Listening to aircraft's VHF broadcasts

The airband is the group of frequencies in the VHF radio spectrum allocated to radio communication in civil aviation for radionavigational aids and air traffic control. Voice transmissions use amplitude modulation on frequencies from 118–136.975 MHz.

Using GQRX, we can tune our RTL-SDR to this frequency range and configure the demodulation to AM. Using the waterfall view, we can very precisely tune to a channel with some activity (118.858 MHz in my case) and start listening.

A communication in the airband, on GQRX

Adjusting the digital filtering bandwidth to the width of the channel contribute to improve the quality of the output.

Reception can be greatly improved by using a quarter wavelength monopole antenna, i.e. a 62.5cm piece of wire. This was my setup:

The antenna used to listen to the airband

Coming up next

There is a lot you can do with this fantastic technology. Here is a list of more advanced RTL-SDR projects I am currently working on:

  • A passive ADS-B radar to listen to information broadcasted by airplanes flying by,
  • A doppler radar to measure the speed of an object using the doppler effect,
  • A radio telescope/camera.

Expect more projects using this technology in the future!

Author:


What is on your mind?

  • #1 Tim

    At last I find some valuable info on GQRX! Thank you.
    I have been trying for several days to figure out how to tune the GQRX receiver frequancy It is really confusing and it seems to me that it is totally illogical and random. Whenever I try to change ONE number, ALL of them change, very unpredictably and again, it seems to me to be somewhat random. I have NEVER seen another program that works (or doesn't work) like this, and I simply don't know how to use it. It's very unique in a bad way. To me, it's buggy to a point of being totally unusable!
    Perhaps you could post instructions.
    Thank you, Charles.

    on February 22 2021, 21:27

  • #2 neuro

    Hi :)
    > To exploit this CSV data,
    > I imported into LibreOffice Calc,
    > rearranged it,
    > and created a XY graph.
    could you explain how you "rearranged" the data?
    I got the csv but struggle to get the values plotted…
    Thank you!

    on March 10 2022, 19:28

  Back to projects

Related articles