Home | Ham Radio |     Share This Page
Software-Defined Radios II

An updated account of the revolution in computer-aided radio reception

— All content Copyright © 2024, P. LutusMessage Page

Most recent update:

Figure 1: Virtual radio (SDR++) displaying the spectrum of FM broadcast stations (click image for full-size)

Introduction | Hardware and Software Improvements | Installation / Configuration | Building a Frequency Database | Setup and Testing | Conclusion

(double-click any word to see its definition)

NOTE: This article is meant as a support resource for this video:

Create Your Own Open-Source Software-Defined Radio.
Introduction

Since my earlier article on this topic (2018), much has changed in the world of Software Defined Radios (hereafter SDR). The earlier article provides a technical and mathematical overview that's desirable for understanding the topic but not essential. This article describes changes — all improvements — in both hardware signal converters and software support.

I explain how to install and use a relatively new multi-platform SDR program named SDR++. I also show how to install and use a new, better-performing, less expensive SDR dongle I've been testing. It's quite a breakthrough — it does more and costs less.

Hardware and Software Improvements

Since the time of my earlier article, hardware designers have taken advantage of technical improvements and cost decreases in integrated circuits, so that this pictured configuration, which until recently was necessary for reception below 25 MHz:

Has been replaced by this:

The RTL-SDR V4 device is directly tunable from 500 KHz to 1.7 GHz, with no frequency gaps and no need to use offset tuning as was required in the past.

This device's decreased cost and increased usability are the good news. But because the pictured RTL-SDR V4 device is so new, there are driver issues on all platforms. These issues will abate in time, but at the time of writing (April 2024), those who want to use this device need to change their system configuration to accommodate it and take advantage of what it can do.

Installation / Configuration

This is a step-by-step guide to install a terrific, free, open-source SDR program called SDR++, as well as drivers to support the above-pictured hardware device. Here's a link to a PDF that describes installation procedures for all platforms SDR++ supports.

A digression about the SDR dongle shown above. More than one all-in-one device exists for this purpose. A similar device is shown here (Nooelec NESDR V5), but I now have both devices and in side-by-side tests I found that the RTL-SDR V4 device is a better performer in low-frequency operation with typical longwire antennas. One suggested remedy for the Nooelec device is to use a balun and/or antenna tuner to match the device's input impedance to the antenna, but this remedy, although helpful, doesn't erase the difference between these devices — in my opinion the RTL-SDR V4 device is overall the better choice.

Windows Installation

I'll start with the most widely used platform: Windows. These steps will get the RTL-SDR V4 dongle pictured above working with my favorite SDR frontend program, SDR++:

  • Phase I: Install the free, open-source SDR++ receiver program:

    • Go to this webpage and choose the right SDR++ download package for your operating system.
    • Windows 10/11 users on relatively new computers will want to download the package named sdrpp_windows_x64.zip
    • The sdrpp_windows_x64.zip download should appear in your Windows 10/11 "Downloads" directory.
    • In the Downloads directory, right-click the sdrpp_windows_x64.zip file and choose "Extract All".
    • Your system will ask for a destination for the extraction — enter "C:\" and select "Extract".
    • Navigate to the newly created directory C:\sdrpp_windows_x64 and enter it.
    • Within this directory you will find an executable named "sdrpp.exe", which is the SDR++ program.
    • Create a shortcut with one of these methods:
      • Right-click the SDR++ program and, while pressing the Ctrl and Shift keys, drag from the directory to the desktop, which should create a link to the program in the system Desktop.
      • Or, point your mouse cursor at the SDR++ executable, press the right mouse button, choose "Show more options" (Windows 11), then "Create shortcut". A shortcut will be created in the same directory. This shortcut can then be dragged from its present location to the desktop.
    • Now that you have an SDR++ desktop icon available, click it.
    • At your click, modern Windows installations will show a dialog warning that SDR++ is an "unrecognized app" and will offer the choice not to run it.
    • Instead of accepting the default choice, click the "More info" link, then click "Run anyway."
    • This completes the initial setup of the SDR++ application.
  • Phase II: Configure the SDR++ program to accept the RTL-SDR V4 Software Defined Radio dongle:

    • In this phase, we will replace a DLL file in the C:\sdrpp_windows_x64 directory with one that will allow the SDR++ program to work with the RTL-SDR V4 dongle pictured above. This step may not be necessary in the future, but as of April 2024, it's still required.
    • Go to this RTL-SDR support page and review the Windows section for guidance.
    • Now click the link for the RTL-SDR Blog Driver Github releases page.
    • At the bottom of the topmost (meaning most recent) "Windows Release" section, locate and download a file named "release.zip", which I won't link here because as new releases become available, any link I might choose will quickly become obsolete.
    • In your Downloads directory, locate the Release.zip file and unpack it anywhere convenient.
    • In the unpacked Release directory, you will find two subdirectories named "x64" and "x86". Open the directory appropriate to your Windows computer's architecture — for most modern computers, "x64" is the right choice.
    • In this directory, locate a file named rtlsdr.dll.
    • Copy the file rtlsdr.dll from this directory into the SDR++ program directory C:\sdrpp_windows_x64, replacing a file with the same name.
    • This DLL-replacement step makes the SDR++ program compatible with the RTL-SDR V4 dongle.

Again, all these steps are needed in April 2024, but chances are the configuration complexity will abate with the passage of time. One hopes it will eventually become a turnkey installation, like installing a printer or mouse. One can only hope.

Linux Installation

I assume Linux users have more technical skill, so this installation relies more on command-line actions and less on file manager manipulations.

First, let's install SDR++, the Software Defined Radio app that displays received signals:

  • Go to this page and choose a download appropriate to your Linux distribution.
  • Put the download in any convenient location and open a terminal session at that location.
  • Issue these commands (the '$' at the left signifies a terminal session, you don't type it):
    $ sudo apt install libfftw3-dev libglfw3-dev libglew-dev libvolk2-dev \
      libsoapysdr-dev libairspyhf-dev libiio-dev libad9361-dev librtaudio-dev \
      libhackrf-dev zstd
    
    $ sudo dpkg -i (name of the package you downloaded above).deb
                  
  • At this point there should be an SDR++ program icon in your desktop manager's menu system.

Next, let's make sure your system can recognize and use the RTL-SDR V4 device:

  • Go to this RTL-SDR support page and review the Linux section for guidance. The procedure below is an edited version that includes some things that were left out.
  • In a terminal session, perform these steps to purge the default Linux driver:
    $ sudo apt purge ^librtlsdr
    $ sudo rm -rvf /usr/lib/librtlsdr* /usr/include/rtl-sdr* /usr/local/lib/librtlsdr* \
      /usr/local/include/rtl-sdr* /usr/local/include/rtl_* /usr/local/bin/rtl_*
                  
  • Now install the RTL-SDR driver:
    $ sudo apt-get install libusb-1.0-0-dev git cmake pkg-config build-essential
    $ git clone https://github.com/rtlsdrblog/rtl-sdr-blog
    $ cd rtl-sdr-blog
    $ mkdir build
    $ cd build
    $ cmake ../ -DINSTALL_UDEV_RULES=ON
    $ make
    $ sudo make install
    $ sudo cp ../rtl-sdr.rules /etc/udev/rules.d/
    $ sudo ldconfig
                  
  • Now blacklist any installed DVB-T TV drivers, which if activated will prevent use of the intended driver:
    $ echo 'blacklist dvb_usb_rtl28xxu' | \
      sudo tee --append /etc/modprobe.d/blacklist-dvb_usb_rtl28xxu.conf
                  
  • Reboot your system so these changes take effect.

Other Platforms

There are SDR++ and RTL-SDR V4 installation procedures for other platforms such as the Macintosh, Raspberry Pi and Android computers, but they're increasingly arcane and esoteric, so they're not covered here.

Conclusion

The installation procedures above are current in April 2024, but as time passes they will change, and one hopes will become unnecessary as this new hardware becomes more common.

Building a Frequency Database

This section explains how to make and install frequency lists for the SDR++ program. The program is much more useful when it has a handy list of frequencies, especially if the user can create the list. Here is a step-by-step process:

  • The SDR++ program stores its frequency lists in a file named "frequency_manager_config.json".
  • This file is located in various places on different platforms. Here are two of the locations:
    • Linux: /home/username/.config/sdrpp/frequency_manager_config.json
    • Windows: (program install directory)\frequency_manager_config.json
    • Macintosh: (program install directory)/frequency_manager_config.json
  • This frequency-table-storage feature isn't available on the Android version of SDR++ at the moment, but a suggestion to make this possible is in the development pipeline for future changes.
  • The frequency table has this internal JSON layout:
    {
        "lists": {
            "Example list name 1": {
                "showOnWaterfall": true,
                "bookmarks": {
                    "Example bookmark name 1": {
                        "bandwidth": (bandwidth in Hz),
                        "frequency": (frequency in Hz),
                        "mode": (see below for a list of numerical codes)
                    },
                    "Example bookmark name 2": {
                        ... as shown above
                    }
                }
            },
            "Example list name 2": {
              ... as shown above
            }
        },
        "bookmarkDisplayMode": 1,
        "selectedList": "Example list name 1"
    }
                  
  • The "mode" numerical codes are:
    1. Narrowband FM
    2. Wideband FM
    3. Amplitude Modulation (AM)
    4. Double Sideband (DSB)
    5. Upper Sideband (USB)
    6. Continuous Wave (CW or Morse code)
    7. Lower Sideband (LSB)
    8. Raw
  • Care must be taken with the internal JSON syntax of this file, including the option fields "showOnWaterfall", "bookmarkDisplayMode" and "selectedList", without which SDR++ may crash. This is because the program assumes it's the only source of data entries, so has no guards against syntax errors created by mere mortals.
  • Instead of trying to hand-edit JSON, users familiar with Python programming may prefer to use a utility library like json as a data generator, to assure the correctness of the syntax.
  • Here is a link to my personal SDR++ frequency table, parts of which may prove useful. Because it works with SDR++, it can be used as a syntax sanity check.
Setup and Testing

This section is optional, for advanced users — it's not required to be able to use the above-described SDR receiver setup. Most users will want to connect their RTL-SDR dongle to an antenna and start exploring the airwaves. Others may want to test their setups by generating test signals and applying them to the hardware/software combination described above. This section explains how and provides example Python and Rust generator programs.

This section requires a computer-compatible source for test signals (a "transmitter"), and few are available. One of the more frequently described is the HackRF One, which, although effective, is rather expensive. I have yet to find a similar device at a more reasonable price.

Here is a typical test setup, using a HackRF One signal generator source:

For best results and to avoid buffer underflows, it's best to use two computers — one to generate test signals and another to process the results. One computer can be used for both sending and receiving, but in that case, don't be surprised to see data underflows, because two simultaneous, high-bandwidth programs (the signal generator program and SDR++) will be relying on two overworked USB data pathways, even at the slowest data clock rate allowed by the HackRF One (2 MHz).

For the HackRF signal generator task, here are two generator programs for CW, AM, FM and WFM signals, one in Python for greater convenience, one in Rust for greater speed:

To my annoyance, these programs only work on Linux. In testing I found that the current Windows OS (11) has some architectural shortcomings that prevent successful operation there.

On Linux, a less important limitation exists. When using these generators, if one computer is expected to both generate and receive signals, then buffer underflow becomes an issue on all but the fastest computers. If this is an issue, the Rust program is somewhat less susceptible to underflows, but on most systems the primary bottleneck is USB I/O (both the HackRF One transmitter and the RTL-SDR V4 receiver dongle rely on USB connections). The HackRF One has a minimal sampling rate of 2 MHz, and on a single system this data flow rate is essentially doubled because the receiver must also keep up with that rate.

The programs linked above accept manual entries for the desired signal duration, carrier frequency, modulation frequency, modulation depth and mode.

As mentioned above, in testing I discovered that the above programs work very well on Linux, but not at all on Windows, because of Windows' primitive architecture. As is widely understood and lamented, Windows refuses to allow piping between applications, whether the pipes are anonymous or named, and in the event of an error Windows creates orphans of running processes without any chance to recover except by rebooting the machine — no, really, in 2024.

So, after giving up on making these small, efficient programs run on Windows, and aware that most people run Windows, I wrote a portable signal generator using the GnuRadio development environment. Here is the GnuRadio source file:

Here is the GnuRadio diagram for the signal generator, which generates CW, AM, USB, LSB, FM, and Wide FM signals by way of a HackRF One (click for full-size):

Here are the relevant equations for the modulation modes supported by this generator:

Amplitude Modulation: $$y(t) = \cos(2 \pi f_c t) (\frac{1+m(t)}{2})$$

Where:

  • $t$ = time, seconds
  • $f_c$ = carrier frequency, Hz
  • $m(t)$ = message signal in terms of $t$

Frequency Modulation: $$y(t) = \cos(2 \pi f_c t + k_f \int_0^t m(t)d t)$$

Where:

  • $t$ = time, seconds
  • $f_c$ = carrier frequency, Hz
  • $k_f$ = proportionality constant or frequency sensitivity of the modulator, units Hz/volt
  • $m(t)$ = message signal in terms of $t$

Single Sideband Modulation:

  • Upper Sideband: $$y(t) = m(t) \cos(2 \pi f_c t) + \hat m(t) \sin(2 \pi f_c t)$$
  • Lower Sideband: $$y(t) = m(t) \cos(2 \pi f_c t) - \hat m(t) \sin(2 \pi f_c t)$$

Where:

  • $t$ = time, seconds
  • $m(t)$ = message signal in terms of $t$
  • $\hat m(t)$ = Hilbert transform of message signal $m(t)$

This signal generator is configured to use an audio WAV file for testing — this is because only a wideband audio signal can reliably demonstrate unwanted-sideband suppression and permit realistic signal evaluation. The audio file is expected to have a 44,100 Hz sample rate. This rate can be changed as required.

If the user doesn't have a WAV audio file available or sees no need for this option, the program can be modified to rely only on a sinewave signal source:

  • Remove the WAV file reader block located at the lower left.
  • Replace it with a "null source".
  • The result should look like this.

This GnuRadio signal generator approach has another advantage — it can use any external output device able to generate signals, so unlike the simpler Python and Rust programs listed above, the user isn't obliged to use HackRF One.

But given that few alternatives exist, let's assume a HackRF One generator is available. To prepare a Windows system to interact with GnuRadio and a HackRF One, download and run the most recent GnuRadio installer located on this page:

RadioConda Installer

Then install the HackRF One drivers from this page:

PothoSDR driver page

Choose the most recent release.

There are some annoying issues with installing GnuRadio on Windows, issues too numerous to list, but that could be said about virtually any program not written by Microsoft.

To prepare a Linux system to interact with GnuRadio and a HackRF One, install these packages (on Linux, everything is easier):

    $ sudo apt install --install-suggests gnuradio hackrf
          

These installers include a number of HackRF One utilities including hackrf_transfer, the utility my Python and Rust programs use.

Conclusion

This Web page is meant as a technical support resource for the video linked at the top of this page. That video shows many examples of SDR activity using the RTL-SDR V4 dongle as a source of signals, and the SDR++ program as a display and control device. It's my hope that this page gives sufficient technical depth to allow successful setups on both Windows and Linux.

Home | Ham Radio |     Share This Page