RTL-SDR basic setup

2020-01-11 sdr wireless

What is a Software Defined Radio (SDR)

I recently got my hands on a RTL-SDR which is a software defined radio (SDR). A 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 a means of software on a personal computer or embedded system.

In recent years SDRs have become very affordable using commedy hardware. SDRs used to only be available to academics and industrial applications in the past. I have chosen the RTL-SDR which is a very modest $20 dollars for just the SDR and $30 including extension cables and multiple different antennas.

TestDisk Scan

SDRs can be used to decode a miriad of protocols. Here’s a short list of the possibilities.

  • AM/FM radio
  • Iridium satallite tracking
  • Aircraft tracking beacons
  • HAM radio
  • lighting detection

Driver Setup

In order to use the RTL-SDR on your system the drivers must be installed. These instructions assume the suer is running a flavor of Linux. Make sure the following applications are installed.

git, cmake, build-essential, and libusb-1-0-0-dev

# Clone SDR-RTL linux drivers.
git clone git://git.osmocom.org/rtl-sdr.git
cd rtl-sdr/
mkdir build
cd build
cmake ../ -DINSTALL_UDUV_RULES=ON
make
sudo make install

# On my Manjaro system /usr/local/lib is not in the ldconfig path, so the following command fixed the issue
echo "/usr/local/lib" | sudo tee -a /etc/ld.so.conf

# Add the shared libraries into the system cache.
sudo ldconfig

# Copy the udev rules which are used to recognized the RTL-SDR USB device.
sudo cp ../rtl-sdr.rules /etc/udev/rules.d/

# This command allows the device to be recognized without restarting your computer.
# Although if it doesn't work restarting may be required to get the device to be recognized.
udevadm control --reload-rules && udevadm trigger

These instructions allow the SDR-RTL to be accessed from the system using the library that was just installed. This allows other applications to access the SDR.

There is one more step required to get the RTL-SDR to work properly on the system. Currently the original drivers are being used for the RTL-SDR dongle which will conflict with the new drivers that were just installed. To fix this the original drivers need to be blacklisted, so that our new correct drivers are used for the RTL-SDR.

# Blacklist instructions
# Navigate to the /etc/modprobe.d directory
cd /etc/modprobe.d
# Create new file called blacklist-rtl.conf
# Add this one line.
# blacklist dvb_usb_rtl28xxu
echo "blacklist dvb_usb_rtl28xxu" | sudo tee -a /etc/modprobe.d/blacklist-rtl.conf

The RTL-SDR dongle can now be tested by the rtl_test executable. The prompt below shows the expected output of the test executable. The system may have to be restarted after blacklisting the drivers in order to get the correct drivers loaded.


jhamberg@falcon /e/ld.so.conf.d> rtl_test -t
Found 1 device(s):
  0:  Realtek, RTL2838UHIDIR, SN: 00000001

Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
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
[R82XX] PLL not locked!
Sampling at 2048000 S/s.
No E4000 tuner found, aborting.

Cubic SDR (FM Radio)

There are multiple applications that can now take advantage of the RTL-SDR cababilities. One of the first one’s I tried is called CubicSDR. It has the ability to decode multiple different kinds of radio protocols, but I am currently using it to listen to FM radio. There is an excellent Wikipedia article explaining how FM radio works.

https://en.wikipedia.org/wiki/FM_broadcasting

In America the frequency range from 87.5 MHZ to 108.0 MHZ is used. FM stands for frequency modulation which describes the modulation technique used to encode audio into radio waves to transmit over the air. Frequency modulation encodes the time series amplitude values of the audio in a way that is proportional to the frequency being transmitted. FM radio has a bandwidth of 200 kHz which means if a radio station is transmitting at 89. 5 MHz it is actually transmitting at a range of 89.4 MHz to 89.6 MHz.

When using the Cubic SDR application to listen to FM radio, choose the center frequency that aligns with the desired radio station. For FM radio 89.5 select 89,500,000 as the center frequency and 200 kHz as the bandwidth. The Cubic SDR application will decode this frequency into the audio that is being transmitted from station’s radio tower.

Here is an example of what the CubicSDR application looks like when listening to a FM radio station.

Cubic SDR

Here is a 30 second audio sample from my favorite EDM station in Seattle, C89.5 that was captured from my apartment. Happy listening!

comments powered by Disqus