RTL-SDR

From EMC23 - Satellite Of Love
Jump to navigation Jump to search

RTL-SDR[edit]

is a very cheap ~$25 USB dongle that can be used as a computer based radio scanner for receiving live radio signals in your area (no internet required). Depending on the particular model it could receive frequencies from 500 kHz up to 1.75 GHz. Most software for the RTL-SDR is also community developed, and provided free of charge. DVB-T dongles based on the Realtek RTL2832U can be used as a cheap SDR, since the chip allows transferring the raw I/Q samples to the host, which is officially used for DAB/DAB+/FM demodulation. The possibility of this has been discovered by Eric Fry (History and Discovery of RTLSDR).

Software Defined Radio[edit]

Radio components such as modulators, demodulators and tuners are traditionally implemented in analogue hardware components. The advent of modern computing and analogue to digital converters allows most of these traditionally hardware based components to be implemented in software instead. Hence, the term software defined radio. This enables easy signal processing and thus cheap wide band scanner radios to be produced.

RTL-SDR Radio Scanner Applications[edit]

The RTL-SDR can be used as a wide band radio scanner. Applications include:

   Use as a police radio scanner.
   Listening to EMS/Ambulance/Fire communications.
   Listening to aircraft traffic control conversations.
   Tracking aircraft positions like a radar with ADSB decoding.
   Decoding aircraft ACARS short messages.
   Scanning trunking radio conversations.
   Decoding unencrypted digital voice transmissions such as P25/DMR/D-STAR.
   Tracking maritime boat positions like a radar with AIS decoding.
   Decoding POCSAG/FLEX pager traffic.
   Scanning for cordless phones and baby monitors.
   Tracking and receiving meteorological agency launched weather balloon data.
   Tracking your own self launched high altitude balloon for payload recovery.
   Receiving wireless temperature sensors and wireless power meter sensors.
   Listening to VHF amateur radio.
   Decoding ham radio APRS packets.
   Watching analogue broadcast TV.
   Sniffing GSM signals.
   Using rtl-sdr on your Android device as a portable radio scanner.
   Receiving GPS signals and decoding them.
   Using rtl-sdr as a spectrum analyzer.
   Receiving NOAA weather satellite images.
   Listening to satellites and the ISS.
   Radio astronomy.
   Monitoring meteor scatter.
   Listening to FM radio, and decoding RDS information.
   Listening to DAB broadcast radio.
   Listening to and decoding HD-Radio (NRSC5).
   Use rtl-sdr as a panadapter for your traditional hardware radio.
   Decoding taxi mobile data terminal signals.
   Use rtl-sdr as a high quality entropy source for random number generation.
   Use rtl-sdr as a noise figure indicator.
   Reverse engineering unknown protocols.
   Triangulating the source of a signal.
   Searching for RF noise sources.
   Characterizing RF filters and measuring antenna SWR.
   Decoding Inmarsat STD-C EGC geosynchronous satellites.
   Listening to the ISS (International Space Station).

Furthermore, with an upconverter or V3 RTL-SDR dongle to receive HF signals the applications are expanded to:

   Listening to amateur radio hams on SSB with LSB/USB modulation.
   Decoding digital amateur radio ham communications such as CW/PSK/RTTY/SSTV.
   Receiving HF weatherfax.
   Receiving digital radio mondiale shortwave radio (DRM).
   Listening to international shortwave radio.
   Looking for RADAR signals like over the horizon (OTH) radar, and HAARP signals.

Note that not all the applications listed may be legal in your country. Please be responsible. What is the RTL-SDR frequency range?

This is dependent on the particular tuner variant used in the dongle, and the particular implementation. Some dongles, like our RTL-SDR Blog V3 also utilize the direct sampling mode which can enable reception below 28 MHz.

Caption text
Tuner Frequency range
Elonics E4000 52 – 2200 MHz with a gap from 1100 MHz to 1250 MHz (varies)
Rafael Micro R820T/2 24 – 1766 MHz (Can be improved to ~13 - 1864 MHz with experimental drivers)
Fitipower FC0013 22 – 1100 MHz
Fitipower FC0012 22 – 948.6 MHz
FCI FC2580 146 – 308 MHz and 438 – 924 MHz (gap in between)
Example Example
Example Example
Example Example


Table Source: Osmocom

As you can see from the table, the Elonics E4000 and Rafael Micro R820T/2 dongles have the greatest frequency range.

RTL-SDRs sample rate[edit]

The maximum sample rate is 3.2 MS/s (mega samples per second). However, the RTL-SDR is unstable at this rate and may drop samples. The maximum sample rate that does not drop samples is 2.56 MS/s, however some people have had luck with 2.8MS/s and 3.2 MS/s working well on some USB 3.0 ports.

Dropped samples are okay if you are just visualizing the spectrum, but will cause problems if you want to demodulate/decode signals.

Specifications[edit]

The RTL2832U outputs 8-bit I/Q-samples, and the highest theoretically possible sample-rate is 3.2 MS/s, however, the highest sample-rate without lost samples that has been tested wit regular USB controllers so far is 2.4 MS/s.

A stable sample-rate of 3.2 MS/s without lost samples is only possible with the Etron EJ168/EJ188/EJ198 series of host controllers due to their specific maximum latency.

The frequency range is highly dependent of the used tuner, dongles that use the Elonics E4000 offer the widest possible range (see table below).

Note: Many devices with EEPROM have 0x2838 as PID and RTL2838 as product name, but in fact all of them have an RTL2832U inside.br

Realtek never released a chip marked as RTL2838 so far.

People over at reddit are collecting a list of other devices that are compatible.

Software[edit]

driver download: https://zadig.akeo.ie/downloads/

Much software is available for the RTL2832. Most of the user-level packages rely on the librtlsdr library which comes as part of the rtl-sdr codebase. This codebase contains both the library itself and also a number of command line tools such as rtl_test, rtl_sdr, rtl_tcp, and rtl_fm. These command line tools use the library to test for the existence of RTL2832 devices and to perform basic data transfer functions to and from the device.

Because most of the RTL2832 devices are connected using USB, the librtlsdr library depends on the libusb library to communicate with the device.

At the user level, there are several options for interacting with the hardware. The rtl-sdr codebase contains a basic FM receiver program that operates from the command line. The rtl_fm program is a command line tool that can initialize the RTL2832, tune to a given frequency, and output the received audio to a file or pipe the output to command line audio players such as the alsa aplay or the sox play commands. There is also the rtl_sdr program that will output the raw I-Q data to a file for more basic analysis.

For example, the following command will do reception of commercial wide-band FM signals:

rtl_fm -f 96.3e6 -M wbfm -s 200000 -r 48000 - | aplay -r 48k -f S16_LE

On a PC or Mac, a similar command that works is as follows. This assumes that the sox package is installed

rtl_fm -f 90100000 -M wbfm -s 200000 -r 48000 - | play -r 48000 -t s16 -L -c 1  -

play is no longer supported by sox on windows

rtl_fm.exe -M fm -s 200k -A fast -r 48k -l 0 -E deemph -f 97.29M | sox -V1 -b 16 -c 1 -e signed-integer -r 48k -t raw - -t waveaudio default

If you want to do more advanced experiments, the GNU Radio collection of tools can be used to build custom radio devices. GNU Radio can be used both from a GUI perspective in which you can drag-and-drop radio components to build a radio and also programmatically where software programs written in C or Python are created that directly reference the internal GNU Radio functions.

The use of GNU Radio is attractive because of the large number of pre-built functions that can easily be connected together. However, be aware that this is a large body of software with dependencies on many libraries. Thankfully there is a simple script that will perform the installation but still, the time required can be on the order of hours. When starting out, it might be good to try the command line programs that come with the rtl-sdr package first and then install the GNU Radio system later.

Binary Builds[edit]

Windows[edit]

While Osmocom in general is a very much Linux-centric development community, we are now finally publishing automatic weekly Windows binary builds for the most widely used Osmocom SDR related projects: rtl-sdr and osmo-fl2k. You can find the binaries at

   https://ftp.osmocom.org/binaries/windows/osmo-fl2k/
   https://ftp.osmocom.org/binaries/windows/rtl-sdr/

The actual builds are done by roox who is building them using MinGW on OBS, see

   https://build.opensuse.org/project/show/network:osmocom:mingw:mingw32 and
   https://build.opensuse.org/project/show/network:osmocom:mingw:mingw64

The status of the osmocom binary publish job, executed once per week from now on, can be found at https://jenkins.osmocom.org/jenkins/view/All%20no%20Gerrit/job/Osmocom-OBS_MinGW_weekly_publish/ Source Code

The rtl-sdr code can be checked out with:

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

It can also be browsed via cgit, and there's an official mirror on github that also provides packaged releases.

If you are going to "fork it on github" and enhance it, please contribute back and submit your patches to: osmocom-sdr at lists.osmocom.org

A gr-osmosdr GNU Radio source block for OsmoSDR and rtl-sdr is available. Please install a recent gnuradio (>= v3.6.4) in order to be able to use it.

Building the software[edit]

rtlsdr library & capture tool[edit]

You have to install development packages for libusb1.0 and can either use cmake or autotools to build the software.

Please note: prior pulling a new version from git and compiling it, please do a "make uninstall" first to properly remove the previous version.

Building with cmake:

cd rtl-sdr/
mkdir build
cd build
cmake ../
make
sudo make install
sudo ldconfig

In order to be able to use the dongle as a non-root user, you may install the appropriate udev rules file by calling cmake with -DINSTALL_UDEV_RULES=ON argument in the above build steps.

cmake ../ -DINSTALL_UDEV_RULES=ON

Building with autotools:

cd rtl-sdr/
autoreconf -i
./configure
make
sudo make install
sudo ldconfig

The built executables (rtl_sdr, rtl_tcp and rtl_test) can be found in rtl-sdr/src/.

In order to be able to use the dongle as a non-root user, you may install the appropriate udev rules file by calling

sudo make install-udev-rules

[RelWithDebInfo.zip pre-built Windows version":http://lists.osmocom.org/mailman/listinfo/osmocom-sdr] Gnuradio Source

The Gnu Radio source requires a recent gnuradio (>= v3.7 if building master branch or 3.6.5 when building gr3.6 branch) to be installed.

The source supports direct device operation as well as a tcp client mode when using the rtl_tcp utility as a spectrum server.

Please note: prior pulling a new version from git and compiling it, please do a "make uninstall" first to properly remove the previous version.

Please note: you always should build & install the latest version of the dependencies (librtlsdr in this case) before trying to build the gr source. The build system of gr-osmosdr will recognize them and enable specific source/sink components thereafter.

Building with cmake (as described in the gr-osmosdr wiki page):

git clone git://git.osmocom.org/gr-osmosdr
cd gr-osmosdr/
<pre>
If you are building for gnuradio 3.6 series, you have to switch to the gr3.6 branch as follows
<pre>
git checkout gr3.6

then continue with

mkdir build
cd build/
cmake ../

Now cmake should print out a summary of enabled/disabled components. You may disable certain components by following guidelines shown by cmake. Make sure the device of your interest is listed here. Check your dependencies and retry otherwise.

-- ###################################################### -- # gr-osmosdr enabled components -- ###################################################### -- * Python support -- * Osmocom IQ Imbalance Correction -- * sysmocom [[OsmoSDR]] -- * [[FunCube]] Dongle -- * IQ File Source -- * Osmocom RTLSDR -- * RTLSDR TCP Client -- * Ettus USRP Devices -- * Osmocom [[MiriSDR]] -- * [[HackRF]] Jawbreaker -- -- ###################################################### -- # gr-osmosdr disabled components -- ###################################################### -- -- Building for version: 4c101ea4 / 0.0.1git -- Using install prefix: /usr/local

Now build & install

make
sudo make install
sudo ldconfig

NOTE: The osmocom source block (osmocom/RTL-SDR Source) will appear under 'Sources' category in GRC menu.

For initial tests we recommend the multimode receiver gnuradio companion flowgraph (see "Known Apps" table below).

You may find more detailed installation instructions in this recent tutorial. Automated installation

Marcus D. Leech has kindly integrated the forementioned build steps into his gnuradio installation script at "This is the most user-friendly option so far. h2. Mailing List

We discuss both OsmoSDR as well as rtl-sdr on the following mailing list: [1].

You can subscribe and/or unsubscribe via the following link: https://lists.osmocom.org/mailman/listinfo/osmocom-sdr

Please make sure to read the MailingListRules before posting. Usage rtl-sdr

Example: To tune to 392.0 MHz, and set the sample-rate to 1.8 MS/s, use:

./rtl_sdr /tmp/capture.bin -s 1.8e6 -f 392e6

to record samples to a file or to forward the data to a fifo.

If the device can't be opened, make sure you have the appropriate rights to access the device (install udev-rules from the repository, or run it as root). rtl_tcp

Example:

rtl_tcp -a 10.0.0.2 [-p listen port (default: 1234)":http://www.sbrac.org/files/build-gnuradio]. Found 1 device(s). Found Elonics E4000 tuner Using Generic RTL2832U (e.g. hama nano) Tuned to 100000000 Hz. listening... Use the device argument 'rtl_tcp=10.0.0.2:1234' in OsmoSDR (gr-osmosdr) source to receive samples in GRC and control rtl_tcp parameters (frequency, gain, ...).

use the rtl_tcp=... device argument in gr-osmosdr source to receive the samples in GRC and control the rtl settings remotely.

This application has been successfully crosscompiled for ARM and MIPS devices and is providing IQ data in a networked ADS-B setup at a rate of 2.4MSps. The gr-osmosdr source is being used together with an optimized gr-air-modes version (see Known Apps below). It is also available as a package in OpenWRT.

A use case is described here. rtl_test

To check the possible tuning range (may heavily vary by some MHz depending on device and temperature), call

rtl_test -t

To check the maximum samplerate possible on your machine, type (change the rate down until no sample loss occurs):

rtl_test -s 3.2e6


A samplerate of 2.4e6 is known to work even over tcp connections (see rtl_tcp above). A sample rate of 2.88e6 may work without lost samples but this may depend on your PC/Laptop's host interface.

Using the data

To convert the data to a standard cfile, following GNU Radio Block can be used:br

The GNU Radio Companion flowgraph is available as rtl2832-cfile.grc. It is based on the FM demodulation flowgraph posted by Alistair Buxton on this thread.

Please note: for realtime operation you may use fifos (mkfifo) to forward the iq data from the capture utility to the GRC flowgraph.

You may use any of the the following gnuradio sources (they are equivalent):

gr-osmosdr sources

What has been successfully tested so far is the reception of Broadcast FM and air traffic AM radio, TETRA, GMR, GSM, ADS-B and POCSAG.

Starting Point RTL_Map[edit]

Installation[edit]

Dependencies[edit]

   libusb1.0 (development packages must be installed manually, see libusb.info)
   gnuplot (must be installed manually, see installation page)
   librtlsdr (cmake / automatic installation & linking)
   fftw3 (cmake / automatic installation & linking)

Clone Repository[edit]

git clone https://github.com/orhun/rtl_map

Building with CMake (recommended)[edit]

cd rtl_map
mkdir build
cd build
cmake ../
make
sudo make install
sudo ldconfig

Building with GCC[edit]

gcc rtl_map.c -o rtl_map -lrtlsdr -lfftw3 -lm

Usage[edit]

Command Line Arguments

-d, set device index (default: 0)
-s, set sample rate (default: 2048000 Hz)
-f, center frequency (Hz) [mandatory argument]
-g gain (0 for auto) (default: ~1-3)
-n number of reads (default: int_max.)
-r, refresh rate for continuous read (default: 500ms)
-D, don't show gnuplot graph (default: show)
-C, continuously read samples (default: off)
-M, show magnitude graph (default graph: dB)
-O, disable offset tuning (default: on)
-T, turn off terminal log colors (default: on)
-h, show help message and exit
filename (a '-' dumps samples to stdout)

Example[edit]

Print samples to file

[k3@arch ~]$ rtl_map -f 88000000 -D capture.dat
[01:00:26] INFO Starting rtl_map ~
[01:00:26] INFO Found 1 device(s):
[01:00:26] INFO #0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
[01:00:27] INFO Using device: #0
[01:00:27] INFO Gain set to 14.
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 
128.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 
[01:00:27] INFO Center frequency set to 88000000 Hz.
[01:00:27] INFO Sampling at 2048000 S/s
[01:00:27] INFO Reading samples...
[01:00:27] INFO Done, exiting...

Useful Links[edit]

http://sdr.osmocom.org/trac/wiki/rtl-sdr - Official RTL-SDR Osmocom website

http://www.reddit.com/r/RTLSDR - Reddit RTL-SDR forum

www.rtlsdr.org - RTL-SDR community Wiki (not updated in a while)

http://www.dxzone.com/ - A good ham related database useful for research

http://www.dangerousprototypes.com - A blog about open source hardware projects that often has SDR related posts.

http://www.hackaday.com - A blog about DIY hardware that also often has SDR related posts.

http://radioforeveryone.com/ - Formerly known as "SDR4Mariners". Another blog about RTL-SDR and radio projects.

http://labyrinth13.com/ - Strange Beacons. Radio user who records and makes videos about several interesting signals he finds. Often uses an RTL-SDR.

https://www.elecrow.com/ - Full Raspberry Pi Kit. Probably useful for an RTL-SDR carry kit.

For a comprehensive book about the RTL-SDR you may be interested in our eBook available on Amazon.

The Hobbyist's Guide to the RTL-SDR: Really Cheap Software Defined radio.