Intro to SDR

Intro to SDR and GQRX Lab

Objectives:

  • Introduction to software-defined radio (SDR) recording
  • Basic signal characteristics
  • Waveform analysis
  • Introduction to GQRX – Listening to a local FM radio station

Background

Wireless communication is a very complex and deep topic that can encompass many volumes. As a result, this background will provide information relevant to the lab so that participants understand what they are investigating and reproducing at a basic level.

With regard to wireless communication, three types of modulation are typically discussed in a basic communications course. In this context, modulation is the process of altering one signal with another to convey information between communicating partners using the air as a transmission medium. The two signals involved are the carrier signal and the information signal. The carrier signal is usually a sinusoidal waveform that operates at a frequency that the sender and receiver must be tuned to in order to exchange information.

Image source: https://files.csound-tutorial.net/floss_manual/Release06/Cs_FM_06_ScrapBook/csound-picts-01_basics-sinewave-en.png

The information signal is used, along with the rules of the modulation technique, to modify the carrier in such a way that the original information signal can be recovered by the receiver of the modulated waveform by demodulating (reversing the modulation process) the received stream. An example information signal could be human speech.

The three basic transmission modulation techniques that are relevant to this lab are amplitude ­­modulation, frequency modulation, and phase modulation. Amplitude and phase modulation should be familiar from the broadcast radio system. AM and FM radio are one application of these modulation techniques.

Amplitude modulation uses the information signal to modify the amplitude of the carrier waveform. Graphing the resulting waveform, the heights of the peaks mimic the behavior of the input information waveform. A depiction of this behavior can be seen below.

Image source: https://www.watelectronics.com/wp-content/uploads/Basic-Amplitude-Modulation-Wave.png

In contrast, frequency modulation uses the information signal to modify the frequency of the carrier waveform. As a result, the modulated waveform appears to compress and decompress based on the input information waveform. This behavior can be seen in the graph below.

Image source: https://img.tfd.com/cde/_FMMOD.GIF

The final transmission modulation technique is phase modulation. Many variants of phase modulation exist. However, they all perform the same operation to transmit digital information. The phase of the carrier wave is modified by the input information signal in order to form symbols that represent the digital input stream. Phase modulation systems with more symbols typically lead to higher throughput and better compression. An example phase modulation technique, Binary Phase Shift Keying (BPSK), can be seen below.

Image source: https://static.wikia.nocookie.net/bmet/images/7/7a/100_unit4fig7_phase_shift_key.gif/revision/latest?cb=20090720000517

In the diagram above, the phase of the carrier wave is shifted by 180 degrees when a transition between a logic one and a logic zero occur. In BPSK, the carrier wave is inverted at each transition.

Communication systems that have to transmit a small amount of data, like the one we explore in this lab, use on-off keying. On-off keying can be considered an extension of amplitude modulation where the data waveform is digital and the carrier waveform is essentially turned on and off where transitions occur.

Intro to GQRX

You can download the virtual machine image for this lab here.

The file is quite large (~16GB).

After downloading the file, you can use ImageUSB by PassMark to create a bootable USB with the downloaded file. Otherwise, the first two steps can be used to install the tools needed to complete this lab.

  1. Create a new Ubuntu, Kali, or Debian virtual machine. Many of the required tools only work on Linux, so this is a required step.
  2. If you’re doing the Way West 2021 Swag Bag Lab, you must use Ubuntu 18.04.5 LTS and GQRX version 2.9. Newer versions of GQRX do not show the signal in stereo, so you won’t be able to discern the two different streams and thus won’t be able to complete the lab.
  3. Install the package “gqrx-sdr” with the following command.

sudo apt install -y gqrx-sdr

  1. Search for the application “gqrx” and click the icon to open it (Note: in Ubuntu if you click on the 3 x 3 row of “dots”, the search box will show up).
  2. Select the “Device” dropdown and select your RTL-SDR device. If you are using the SDR-RTL that came with the Swag Bag Lab, then it will be the one indicated in the screenshot below. Then, click “OK”.

  1. The main GQRX window should now open. Click “File” at the top and select “Start DSP” to start the digital signal processor in your device. Waveforms should start to appear in the main window. You will probably hear static as well depending on what frequency GQRX is set at. In this case, the frequency was set at 14.236 kHz as shown in the second screenshot.
  2. If you have a favorite radio station in your local area and know the frequency, then tune to that frequency. If you do not know of a radio station in your area, you could also conduct a search at https://radio-locator.com/.
  3. Start to tune GQRX to the frequency of a radio station until you hear noise coming through the application. There are several ways to do this. One is to just change the frequency in the Frequency dialogue box under Receiver Options (see image below). The other way is to click on the far-left number above the waveforms; then you can just type in the numbers. If you click, you will notice the numbers will also change. You can also use the up and down arrows and tab to change the numbers. Change the “Mode” dropdown to select “WFM (stereo)”. Keep in mind that most radio stations are listed in MHz, and the “Frequency” input box requires kHz. For example, the radio station 95.1 becomes 95100 kHz.

  1. You may have to move your antenna a bit to clear up the signal, but you should start to hear music coming through your speakers!
  2. You can look for more “hills” in the graph and drag the red line to hear different radio stations.

Problems or questions? Check out the FAQ below or post a question in the #?swag-bag-lab channel in the conference Discord server.

Troubleshooting – Frequently Asked Questions (FAQ)

  • What if I don’t get anything in the waterfall?
    • Wrong radio selected (pick the right one)
    • Not currently running (click the Play button)
    • Things froze up (reboot)
  • Why am I getting no sound or weird sound?
    • The “mode” in “Receiver Options” is set wrong; you want “WFM (stereo)”.
    • Not tuned correctly (you want to be dead center on the peak of the signal).
  • Where can I get more of this great-sounding music?
    • Tune GQRX to the year 1990 and shout “BMG Music Club!” three times as loud as you can. Send a self-addressed stamped envelope (a SASE) to the address that appears in the clouds to the west. Wait six to eight weeks for a reply.

If you are not using the live USB and you have problems with your RTL-SDR not playing (active waveform with sound), try the following.

1. Open a terminal and confirm you’re in your home directory. This is the preferred convention and will be assumed throughout this text.

2. Update your distribution.
sudo apt-get update

3. Install the tools needed to retrieve (git), compile (cmake) and build (build-essential).
sudo apt-get install git
sudo apt-get install cmake
sudo apt-get install build-essential

4. Install libusb-1.0-0-dev which is a C library that provides generic access to USB devices.
sudo apt-get install libusb-1.0-0-dev

5. Retrieve, build and compile the RTL2832U Osmocom drivers from the source.
git clone git://git.osmocom.org/rtl-sdr.git
cd rtl-sdr/
mkdir build
cd build
cmake ../ -DINSTALL_UDEV_RULES=ON
make
sudo make install
sudo ldconfig
sudo cp ../rtl-sdr.rules /etc/udev/rules.d/

6. Blacklist the default driver that is automatically loaded for using the dongle as a TV device as it doesn’t work for SDR purposes and clashes with the new Osmocom drivers we just installed.
A. Open your /etc/modprobe.d folder as an administrator.
B. Create a new file ‘blacklist-rtl.conf’ and add this one line: blacklist dvb_usb_rtl28xxu
C. Save the file, close the editor and restart the machine.