RTL-SDR WITH LINRAD.
(Oct 27 2012)

The rtlsdr USB dongle.

Marketed as DVB-T LAPTOP DIGITAL TV Tuner USB Stick HDTV Realtek RTL2832U / E4000 SDR or similar one can find these surprisingly good receivers on the Internet for perhaps USD 20. They may look like the ones in figure 1.


Fig. 1. USB dongles for digital TV and FM radio.

For more info look here: http://sdr.osmocom.org/trac/wiki/rtl-sdr

The first version of Linrad that could be used with rtl-sdr was linrad-03.40. Look here RTL-SDR with Linrad-03.40 for performance tests.

The osmocom library is continously changing and linrad-03.40 to 03-44 can only use old versions of the library.

Starting with Linrad-03.45 there is a complete Linrad version of the rtl-sdr library. Linrad-03.45 works with the standard library and may continue to do so, but the Linrad version allows a much better usage of the hardware. The modifications are not elegant, but they are simple. The feature that Linrad adds is to allow different gain distributions for different usages. The modifications have been posted on the osmocom mailing list as a diff file but it seems maintainers are not interested.

Multiple dongles.

Since they are cheap we can afford several dongles. The utility rtl_eeprom that is a part of the rtl-sdr package can be used to change the serial number so each dongle gets its own serial number. Linrad can then use several dongles simultaneously. Figure 2 shows the screen with 7 dongles running simultaneously on a D5400XS with two 4-core Xeon E5410 processors under Ubuntu 12.04. That computer is now several years old and modern cores are significantly faster. Yet the CPU load is only about 40%. I can not try more dongles, 7 is as many as I have.... Each instance of Linrad uses 40% of one core. Administration (X11 and gnome) uses 63% for a total of 3.43 times one core or 43% of the totally available CPU power.


Fig. 2. Seven dongles running simultaneously under Ubuntu Linux on a D5400XS computer.

For unknown reasons Windows is far more CPU hungry. See figure 3.


Fig. 3. Seven dongles running simultaneously under Windows 7 on a D5400XS computer.

Operation is stable even though the CPU usage is 90%. There is not much resources to run decoders however....

When the dongles are set to produce a small bandwidth it is possible to run several of them on an old computer with just a single CPU core. Figure 4 shows the screen when running 6 rtl-sdr dongles with 240 kHz sampling speed on a PentiumIV computer with the CPU running at 2.66 GHz. Each instance of Linrad uses about 9% of the CPU and the X11 overhead is 29% for a total load of 83%. Gimp which was used to capture the screen is running slowly but it does not cause glitches on Linrad.


Fig. 4. Six dongles running simultaneously under Debian Wheezy on a Pentium IV computer.

Dynamic range.

Linrad allows four gain modes with rtl-sdr when the hardware uses the e4000 tuner chip.

  • 0. AGC mode.

  • 1. Compromise. This is the gain settings available in the rtl-sdr library as of October 2012.

  • 2. Linearity mode. For use without filters in environments with strong signals. Low front end gain and high gain after filters.

  • 3. Sensitivity mode. For use in rural locations or when filters and preamplifiers are placed between the antenna and the dongle. High front end gain and low gain after the filters.
The first version of Linrad to have selectable gain modes is linrad-03.45. The dynamic range performance in the three non AGC modes is listed in tables 1 to 3. The AGC mode does not work properly, at high levels the AGC oscillates. That should be easy to cure, the original rtl-sdr library june 2012 had a well working AGC mode.


                    143.8           145.5             154.2
Gain  NF    MDS    Sat.  DR        Dgr.  DR         Dgr    DR
(dB) (dB)  (dBm)  (dBm) (dB)      (dBm) (dB)       (dBm)  (dB)
 42  7.9  -139.1   -63   76        -54   85         -53    86
 34 12.6  -134.4   -56   78        -45   89         -46    88
 29 12.6  -134.4   -56   78        -45   89         -46    88
 24 17.4  -129.6   -51   79        -40   90         -40    90
 22  19    -128    -49   79        -38   90         -38    90
 19  22    -125    -47   78        -35   90         -35    90  
 17  25    -122    -43   79        -32   90         -32    90
 14  27    -120    -42   78        -30   90         -30    90
 12  30    -117    -38   79        -27   90         -27    90
  9  32    -115    -37   78        -25   90         -25    90
  7  35    -112    -34   78        -22   90         -22    90
  4  37    -110    -31   79        -19   91         -19    91
  2  41    -106    -28   78        -16   90         -16    90
 -1  42    -105    -26   79        -14   91         -14    91

Table 1. The E4000 tuner. Performance of Linrad with the original OSMOCOM gain setting routines of Oct 2012. Gain mode 1 in Linrad.
Sat. is the signal level where the A/D converter saturates.
Dgr. is the signal level that causes a 3 dB loss of S/N.




                    143.8           145.5             154.2
Gain  NF    MDS    Sat.  DR        Dgr.  DR         Dgr    DR
(dB) (dB)  (dBm)  (dBm) (dB)      (dBm) (dB)       (dBm)  (dB)
 25  8.3  -138.7   -66   73        -54   85         -30   109 
 20 12.5  -134.5   -60   75        -49   86         -25   110 
 15 15.5  -131.5   -56   76        -45   87         -23   109
 10  20    -127    -51   76        -40   87         -18   109
  5  26    -121    -46   75        -35   86         -13   108
  0  31    -116    -40   76        -29   87          -9   107
 -5  36    -111    -35   76        -24   87          -7   104
-10  38    -109    -31   78        -20   89          -6   103
-15  43    -104    -26   78        -15   89          -6    98
-20  47    -100    -21   79        -10   90          -6    94
-25  49     -98    -14   84        -10   88          -6    92

Table 2. The E4000 tuner. Performance of Linrad with the linearity gain setting, gain mode 2 in Linrad. This mode is suitable when very strong signals are present at frequencies 10 MHz or more away from the desired signal. Note the bold numbers in the table.
Sat. is the signal level where the A/D converter saturates.
Dgr. is the signal level that causes a 3 dB loss of S/N.




                    143.8           145.5             154.2
Gain  NF    MDS    Sat.  DR        Dgr.  DR         Dgr    DR
(dB) (dB)  (dBm)  (dBm) (dB)      (dBm) (dB)       (dBm)  (dB)
 25  7.0   -140    -69   71        -58   82         -30   110 
 20  7.5  -139.5   -64   76        -53   87         -30   110
 15  8.6  -138.4   -59   79        -48   90         -30   108
 10 10.0  -137.0   -54   83        -43   94         -30   107
  5 15.0  -132.0   -49   83        -38   94         -27   105
  0  17    -130    -44   86        -36   94         -26   104
 -5  23    -125    -40   85        -34   91         -23   102
-10  28    -120    -35   85        -33   87         -19   101
-15  32    -116    -29   87        -29   87         -15   101
-20  37    -111    -27   84        -24   87         -12    99
-25  41    -107    -26   81        -26   81          -7   100  

Table 3. The E4000 tuner. Performance of Linrad with the sensitivity gain setting, gain mode 3 in Linrad. This mode is suitable when a filter is used to eliminate signals outside the band of interest.
Sat. is the signal level where the A/D converter saturates.
Dgr. is the signal level that causes a 3 dB loss of S/N.



The data delivered from the rtlsdr is only 8 bit. An ideal 8-bit A/D converter should have a SNR of 50 dB The bandwidth delivered by the rtlsdr is 2 MHz while we measure MDS in a bandwidth of 500 Hz. The bandwidth factor is 4000 and that provides a gain of 36 dB. Note that the dongle reaches the theoritical limit in sensitivity mode at gain settings of 0 to -15 dB. Measurements have to be made with a third signal present because otherwise the A/D converter might give the same value most of the time. With a GAAS FET LNA having the gain required to lift the noise floor by 3 dB in sensitivity mode with 0 dB gain setting and with adequate filtering one can get very good performance with the E4000 dongle. With a 1 MHz wide filter at i.e. 432 MHz one can get a dynamic range near 86 dB with a sensitivity only about 3 dB worse than optimum. By increasing the gain to 15 dB one would then have a sensitivity very close to the theoretical limit at a dynamic range of about 68 dB. Note that LO spurs and reciprocal mixing can be the limiting factors.

Installing librtlsdr.

There is a librtlsdr.a file in the linrad-libs.zip (1059849 bytes) package for Windows that allows the dongles to work under Windows.

To install the current Osmocom library for rtl-sdr under Linux one can use the following set of commands:
   rm -r /usr/src/rtl-sdr*
   cd /usr/src
   git clone git://git.osmocom.org/rtl-sdr.git
   mkdir build
   cd build
   cmake ../rtl-sdr
   make
   make install
Two routines need to be changed to get the results demonstrated on this page: librtlsdr.c and tuner_e4k.c. October 18 2012 they differ from the original library as can be seen in this diff file: linrad-oct18.diff (10267 bytes) The diff might be useful to get the Linrad modifications into newer versions of the library. The source code of the modified library as of Oct 18 2012 is contained here rtl-sdr-linrad1.tbz (875606 bytes)

The library at osmocom is improving over time. Here is the source code with the modifications applied to the osmocom code by August 2013. rtl-sdr-linrad4.tbz (101534 bytes) The configure script in Linrad-03.49 suggests the following sequence of commands:
  cd /usr/src
  rm -f rtl-sdr-linrad4.tbz
  wget http://sm5bsz.com/linuxdsp/hware/rtlsdr/rtl-sdr-linrad4.tbz
  tar xvfj rtl-sdr-linrad4.tbz
  cd rtl-sdr-linrad4
  autoconf
  autoreconf -i
  ./configure
  make
  make install
  ldconfig
  Note that you need root privileges and that the packages
  pkg-config, libtool, autoconf, libusb-1.0 and wget have to
  be installed. There may be later versions available:
  http://sm5bsz.com/linuxdsp/hware/rtlsdr/rtl-sdr-linradxx.tbz."