Installing The RTL-SDR On Raspberry Pi

I recently discovered a USB device called an RTL-SDR (Realteck RTL2832U Software Defined Radio), which is a small device that can listen to a wide variety of electromagnetic signals from 52 Hz to 2200 MHz. This means you can listen to the radio on it, but also tune into digital TV signals, check the time using radio clocks, listen to ham radio broadcasts, even listen to airplane transponder codes.

Whilst most systems have pre-built drivers that you can install quickly, the Raspberry Pi Ubuntu system I was using requires the driver to be compiled and installed before you can start using it.

First, we need to install some packages needed during the build process. Since I was Using Ubuntu I could use apt-get here, but your system might be different on this step.

$ sudo apt-get install git cmake libusb-1.0.0-dev build-essential

Note that git is used to download the driver source code quickly. You can instead just download the package from the git repo at the address https://gitea.osmocom.org/sdr/rtl-sdr.

Once you have all of the pre-requisites you can download and compile the driver. The following steps will take you through this process.

$ git clone https://gitea.osmocom.org/sdr/rtl-sdr.git
$ cd rtl-sdr/
$ mkdir build
$ cd build
$ cmake ../ -DINSTALL_UDEV_RULES=ON -DDETACH_KERNEL_DRIVER=ON
$ make
$ sudo make install
$ sudo ldconfig
$ sudo cp rtl-sdr.rules /etc/udev/rules.d/

It's worth rebooting the device at this point just to make sure that the kernel changes has been applied correctly.

Note that if you want to update the driver in the future you need to run the "sudo make uninstall" from the current driver source code directory before you run the update.

You can now test that the driver is installed correctly using the rtl_test command, which comes with the driver install. This will show the following output if everything worked correctly.

$ rtl_test
Found 1 device(s):
  0:  RTLSDRBlog, Blog V4, SN: 00000001

Using device 0: Generic RTL2832U OEM
Detached kernel driver
Found Rafael Micro R828D tuner
RTL-SDR Blog V4 Detected
Supported gain values (29): 0.0 0.9 1.4 2.7 3.7 7.7 8.7 12.5 14.4 15.7 16.6 19.7 20.7 22.9 25.4 28.0 29.7 32.8 33.8 36.4 37.2 38.6 40.2 42.1 43.4 43.9 44.5 48.0 49.6 
Sampling at 2048000 S/s.

Info: This tool will continuously read from the device, and report if
samples get lost. If you observe no further output, everything is fine.

Reading samples in async mode...

If you don't see anything after this message then everything should be working. You can now go on to use the rtl_sdr command line application (that also comes with the driver) or install the GNU Radio Companion to start receiving messages from the SDR.

This is working well for me on my Clockwork uConsole.

For more information about using the RTL-SDR you can refer to the Osmocom RTL-SDR wiki.

The RTL-SDR dongle is quite cheap (currently £40 on TechnoFix UK) and is well worth getting as it opens up a few different projects.

Add new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
11 + 9 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.