Using the Realtek RTL2832 USB “dongle” as a gnuradio multimode receiver

MultimodeRTLSDR-ReceiverThese notes document the sequence I went through to install and run my Realtek RTL2832U/E4000 USB Dongle using the gnuradio flow graph  “multimode”.  This turns your PC and the dongle into a rudimentary  multimode VHF/UHF receiver. The sequence is briefly: (a) Get the dongle driver, compile and install, and test.  (b) Get the multimode gnuradio framework  (multimode.grc) and bring that up in gnuradio.  This sequence assumes you have gnuradio installed.  Commands and responses to commands entered in a terminal are shown.

FYI, I purchased my “dongle” from NooElec Inc,  Box 710, 6090 Loud Drive, Oscoda, Michigan 48750 (888-OLD-ELEC)  http://www/nooelec.com.  Item sku 100514.  Cost was about $20 USD.

1. Get source for the RTL-SDR driver

lj@lian ~ $ git clone git://git.osmocom.org/rtl-sdr.git

Cloning into ‘rtl-sdr’…
remote: Counting objects: 1210, done.
remote: Compressing objects: 100% (1069/1069), done.
remote: Total 1210 (delta 879), reused 197 (delta 133)
Receiving objects: 100% (1210/1210), 271.24 KiB | 179 KiB/s, done.
Resolving deltas: 100% (879/879), done.

2. Build the driver using the cmake utility:

lj@lian ~ $ cd rtl-sdr/
lj@lian ~/rtl-sdr $ mkdir build
lj@lian ~/rtl-sdr $ cd build
lj@lian ~/rtl-sdr/build $ cmake ../
— The C compiler identification is GNU
— Check for working C compiler: /usr/bin/gcc
— Check for working C compiler: /usr/bin/gcc — works
— Detecting C compiler ABI info
— Detecting C compiler ABI info – done
— Build type not specified: defaulting to release.
— checking for module ‘libusb-1.0′
— found libusb-1.0, version 1.0.9-rc3
— Found libusb-1.0: /usr/include/libusb-1.0, /usr/lib/x86_64-linux-gnu/libusb-1.0.so
— Looking for include files CMAKE_HAVE_PTHREAD_H
— Looking for include files CMAKE_HAVE_PTHREAD_H – found
— Looking for pthread_create in pthreads
— Looking for pthread_create in pthreads – not found
— Looking for pthread_create in pthread
— Looking for pthread_create in pthread – found
— Found Threads: TRUE
— Udev rules not being installed, install them with -DINSTALL_UDEV_RULES=ON
— Configuring done
— Generating done
— Build files have been written to: /home/lj/rtl-sdr/build

lj@lian ~/rtl-sdr/build $ sudo make install
[sudo] password for lj:
Scanning dependencies of target rtlsdr_shared
[ 5%] Building C object src/CMakeFiles/rtlsdr_shared.dir/librtlsdr.c.o
[ 11%] Building C object src/CMakeFiles/rtlsdr_shared.dir/tuner_e4k.c.o
[ 16%] Building C object src/CMakeFiles/rtlsdr_shared.dir/tuner_fc0012.c.o
[ 22%] Building C object src/CMakeFiles/rtlsdr_shared.dir/tuner_fc0013.c.o
[ 27%] Building C object src/CMakeFiles/rtlsdr_shared.dir/tuner_fc2580.c.o
[ 33%] Building C object src/CMakeFiles/rtlsdr_shared.dir/tuner_r820t.c.o
Linking C shared library librtlsdr.so
[ 33%] Built target rtlsdr_shared
Scanning dependencies of target rtl_adsb
[ 38%] Building C object src/CMakeFiles/rtl_adsb.dir/rtl_adsb.c.o
Linking C executable rtl_adsb
[ 38%] Built target rtl_adsb
Scanning dependencies of target rtl_eeprom
[ 44%] Building C object src/CMakeFiles/rtl_eeprom.dir/rtl_eeprom.c.o
Linking C executable rtl_eeprom
[ 44%] Built target rtl_eeprom
Scanning dependencies of target rtl_fm
[ 50%] Building C object src/CMakeFiles/rtl_fm.dir/rtl_fm.c.o
Linking C executable rtl_fm
[ 50%] Built target rtl_fm
Scanning dependencies of target rtl_sdr
[ 55%] Building C object src/CMakeFiles/rtl_sdr.dir/rtl_sdr.c.o
Linking C executable rtl_sdr
[ 55%] Built target rtl_sdr
Scanning dependencies of target rtl_tcp
[ 61%] Building C object src/CMakeFiles/rtl_tcp.dir/rtl_tcp.c.o
Linking C executable rtl_tcp
[ 61%] Built target rtl_tcp
Scanning dependencies of target rtl_test
[ 66%] Building C object src/CMakeFiles/rtl_test.dir/rtl_test.c.o
Linking C executable rtl_test
[ 66%] Built target rtl_test
Scanning dependencies of target rtlsdr_static
[ 72%] Building C object src/CMakeFiles/rtlsdr_static.dir/librtlsdr.c.o
[ 77%] Building C object src/CMakeFiles/rtlsdr_static.dir/tuner_e4k.c.o
[ 83%] Building C object src/CMakeFiles/rtlsdr_static.dir/tuner_fc0012.c.o
[ 88%] Building C object src/CMakeFiles/rtlsdr_static.dir/tuner_fc0013.c.o
[ 94%] Building C object src/CMakeFiles/rtlsdr_static.dir/tuner_fc2580.c.o
[100%] Building C object src/CMakeFiles/rtlsdr_static.dir/tuner_r820t.c.o
Linking C static library librtlsdr.a
[100%] Built target rtlsdr_static
Install the project…
— Install configuration: “Release”
— Installing: /usr/local/lib/pkgconfig/librtlsdr.pc
— Installing: /usr/local/include/rtl-sdr.h
— Installing: /usr/local/include/rtl-sdr_export.h
— Installing: /usr/local/lib/librtlsdr.so.0.0.0
— Up-to-date: /usr/local/lib/librtlsdr.so.0
— Up-to-date: /usr/local/lib/librtlsdr.so
— Installing: /usr/local/lib/librtlsdr.a
— Installing: /usr/local/bin/rtl_sdr
— Removed runtime path from “/usr/local/bin/rtl_sdr”
— Installing: /usr/local/bin/rtl_tcp
— Removed runtime path from “/usr/local/bin/rtl_tcp”
— Installing: /usr/local/bin/rtl_test
— Removed runtime path from “/usr/local/bin/rtl_test”
— Installing: /usr/local/bin/rtl_fm
— Removed runtime path from “/usr/local/bin/rtl_fm”
— Installing: /usr/local/bin/rtl_eeprom
— Removed runtime path from “/usr/local/bin/rtl_eeprom”
— Installing: /usr/local/bin/rtl_adsb
— Removed runtime path from “/usr/local/bin/rtl_adsb”

lj@lian ~/rtl-sdr/build $ sudo ldconfig

4. Install UDEV rules so that your USB dongle is loaded when you plug it in

lj@lian ~/rtl-sdr/build $ cmake ../ -DINSTALL_UDEV_RULES=ON
— Build type not specified: defaulting to release.
— Configuring done
— Generating done
— Build files have been written to: /home/lj/rtl-sdr/build

5. Plug in your dongle. Check that the driver got installed:

lj@lian ~ $ rtl_test -t
Found 1 device(s):
0: ezcap USB 2.0 DVB-T/DAB/FM dongle

Using device 0: ezcap USB 2.0 DVB-T/DAB/FM dongle
Found Elonics E4000 tuner
Supported gain values (14): -1.0 1.5 4.0 6.5 9.0 11.5 14.0 16.5 19.0 21.5 24.0 29.0 34.0 42.0
Benchmarking E4000 PLL…
[E4K] PLL not locked for 52000000 Hz!
[E4K] PLL not locked for 2228000000 Hz!
[E4K] PLL not locked for 1114000000 Hz!
[E4K] PLL not locked for 1274000000 Hz!
E4K range: 53 to 2227 MHz
E4K L-band gap: 1114 to 1274 MHz

6. Grab source for the multimode receiver from SVN checkout at cgran. This dumps source to a home directory named GRC-Tutorials/multimode

lj@lian ~$ svn co https://www.cgran.org/svn/projects/multimode/trunk/ ~/GRC-Tutorials/multimode
A /home/lj/GRC-Tutorials/multimode/multimode_helper.py
A /home/lj/GRC-Tutorials/multimode/multimode.py
A /home/lj/GRC-Tutorials/multimode/COPYING
A /home/lj/GRC-Tutorials/multimode/multimode.grc
A /home/lj/GRC-Tutorials/multimode/Makefile
A /home/lj/GRC-Tutorials/multimode/README
Checked out revision 1078.

7. Run these python programs from the command line

lj@lian ~/GRC-Tutorials/multimode $ python multimode_helper.py
lj@lian ~/GRC-Tutorials/multimode $ python multimode.py

This last command (python multimode.py) should bring up your receiver similar to the screen shot.

This entry was posted in Amateur Radio, GNU Radio Companion, GNURadio, GRC, RTL2832 USB Dongle. Bookmark the permalink.