Software Defined Radio for Raspberry Pi 3B+ (Part 1)

Raspberry Pi 3B+ Running Software Defined Radio Program: GQRX

Software-defined radios (SDR) can capture virtually any form of radio: ranging from cellular signals to digital television and amateur radio bands.  So far, we’ve explored some very low-cost receivers and transmitters that were designed with this mind.  This includes our recent unboxing of the Realtek SDR (RTL-SDR) and the half-duplex receiver/transmitter: HackRF One.  Today, I thought I would share another implementation of SDR that leverages the popular single-board computer: the Raspberry Pi.

Raspberry Pi Overview

For those unfamiliar, the Raspberry Pis are a series of tiny single-board computers (SBCs) that are roughly the size of a full deck of playing cards.  In spite of their small size and low cost, these SBCs pack some impressive specifications that make them useful for general-purpose computing.  Recent models such as the Raspberry Pi 3B+ (introduced in March 2018 for about $35 USD) contain:

  • A quad-core, 64-bit ARMv8-A Processor
  • Integrated Wi-Fi and Ethernet Connectivity
  • Integrated Universal Serial Bus (USB)
  • Integrated High-Definition Multimedia Interface (HDMI) Support
  • General-purpose headers for prototyping, hacking, etc.

The latest in this series is the Raspberry Pi 4, but because the Raspberry Pi 3B+ is still being supported, the 3B+ is the one I will be focusing on today. 

Objective

This walkthrough you will show you how to set up the Raspberry Pi 3B+ to use the inexpensive RTL-SDR receiver.  By the end, we will be able to demodulate or record radio signals using two common rtl-sdr software packages for Linux: rtl-sdr and GQRX.

  • rtl-sdr contains a set of command-line tools for testing the RTL-SDR device as well as receiving wideband frequency modulation (WBFM) broadcasts, among other things.
  • GQRX is a graphical tool based on GNU Radio.  It has the ability to demodulate WBFM, amplitude modulation (AM) and several other formats much like other tools we have used here.

I will also share some first-hand experiences and pitfalls I’ve encountered in this and similar setup procedures.

Resources Used

Note that this article uses the Raspberry Pi 3B+ with a connected keyboard, video monitor, and mouse.  There are ways to set up and use a Raspberry Pi without these attached devices by using a secure shell (SSH) connection, but this is beyond the scope of the article.  For the official instructions on using the SSH method instead of an attached monitor and keyboard, see the official Raspberry Pi webpage: https://www.raspberrypi.org/documentation/remote-access/ssh/.

This process will begin in Windows 10, where I will download the software tools to get started.  This includes preparing a microSD (Secure Digital) card that will contain the operating system the Raspberry Pi 3B+ needs in order to function.  If you are not a Windows user, feel free to use the official setup guide.

Hardware Resources Used

  • Raspberry Pi 3B+
  • Blank Micro SD card with at least 16 GB storage
  • MicroSD card writer
  • 5V Power Supply for Raspberry Pi 3B+
  • RTL-SDR dongle with antenna
  • Wi-Fi or Ethernet Network (Administrative privileges recommended)
  • Windows PC (Administrative privileges recommended)
  • USB Type A to Type B connector (USB Extension Cable)
  • HDMI Display (I used touch display part number: NHD-7.0-HDMI-N-RSXN-CTU)
  • HDMI Cable (Male to Male)
  • Keyboard and Mouse
  • PC Speakers (with amplifier)
  • Recommended: Anti-static workstation
  • Optional: USB Type A to Type B micro (for the touch display)
  • Optional: Ethernet Cable

Software Resources Used

  • Windows 10, 64-bit
  • Balena Etcher
  • Raspbian OS Image File (.img)
  • Recommended: Anti-malware Program

Cybersecurity Note

As with anything you download off the web, I highly recommend you scan all files and programs you use for this procedure with your favorite anti-malware program.  Even though I have used these programs for myself and I trust them, you can never be too safe.

Anti-Static Notice

To protect the Raspberry Pi, I recommend using an anti-static mat or anti-static wrist strap.  These should be considered bare minimum tools if you intend to avoid accidentally damaging the Raspberry Pi or other electronics with an Electrostatic Discharge event (ESD) from your body.

Getting Raspbian onto the Raspberry Pi

First off, there are many Linux distributions designed with the Raspberry Pi in mind.  The one I will be using is the Raspbian operating system.  The latest version supported by the Raspberry Pi Foundation is named Raspbian Buster, and is available from the official Raspberry Pi website: https://www.raspberrypi.org/downloads/raspbian/

To get this onto your Raspberry Pi 3B+, you will need to download an image file containing the Raspbian operating system, and then use a special program to flash Raspbian onto the MicroSD…file system and all.

Downloading the Raspbian Image

We’ll start with the Raspbian image file.  The file is quite large (2.541 MB for the version I will be downloading).  In this procedure, I will be downloading “Raspbian Buster with desktop and recommended software” below, which contains everything you need to use the Raspberry Pi 3B+ as a full desktop computer. 

Figure 1: Options for Raspbian Image Downloads

In my case, I downloaded the latest version as a large zip file.  decompressing the zip file yielded a 6.6 GB Raspbian image file: 2019-09-26-raspbian-buster-full.img on my Windows system.

Downloading Balena Etcher

Next, we need software to flash the Raspbian image onto the microSD card.  Uploading the .img file directly to the microSD card (i.e. copy-pasting it onto the drive) won’t do any good.  Instead, the image needs to be flashed onto the microSD by overwriting its file system.

NOTICE: The following step will permanently delete any information that is already stored on the microSD card.  If this is not acceptable, you must use a different or blank microSD card.

I used the Balena Etcher utility available at: https://www.balena.io/etcher/.  This software works for Windows, Mac OS, and Linux.

Figure 2: The balenaEtcher Home Page

Flashing Raspbian on the MicroSD Card

Now that we have both the Raspbian operating system image and Etcher, its time to reflash the microSD card.  Attach the microSD card and/or microSD card reader and wait a few seconds for it to become visible on your system.  Then run the Etcher application.

Figure 3: The balenaEtcher User Interface

In Figure 3 above, the “image” is the Raspbian image file we downloaded in prior steps.  Click “select image” to designate it as the image to be flashed to the microSD card.

The “SD Device” in Figure 3 is the target microSD device.  Take care to make sure you have plugged in the microSD card you want to overwrite by this step.  It’s a good idea to also unplug any other devices such as cameras or USB drives so that you cannot accidentally delete them in the next step.

Figure 4: The “Flash” Button is Illuminated, Indicating the MicroSD Will Be Overwritten Next

You may receive a Windows security notification asking you to approve or reject changes to the file system.  If they are coming from Etcher, it’s okay to approve.

Figure 5: balenaEtcher Actively Erasing and Overwriting the MicroSD Card

Flashing my 32 GB microSD card through a USB 2.0 cable took less than 10 minutes to complete. 

As soon as the process is complete, you should see a notification pop up.  Windows may also offer to format the disk.  DO NOT let Windows reformat anything, or else you will have to reflash the microSD card all over again.  Instead, hit cancel, eject the microSD card drive, and then remove the microSD card from your computer.

Figure 6: DO NOT FORMAT! Just Press “Cancel”

This concludes the Windows portion of this walkthrough.

Setting up the Raspberry Pi Hardware

Now that you have a functional microSD card running the latest Raspbian OS, its time to set up the Raspberry Pi 3B+ and peripherals.  We’ll start by connecting an HDMI video monitor, keyboard, and mouse.  In my case, the keyboard and mouse were both wireless devices, so I only had to plug in the wireless USB adapter to use them.  If your keyboard or mouse is wired, simply plug it into one of the Raspberry Pi’s USB ports.

Figure 7: System-Level Diagram of the Hardware Test

Supplying Power

I have used a common USB 2.0 micro-B charger to supply power to the Raspberry Pi 3B+.  Note that only the smaller, micro-B USB connector on the Raspberry Pi 3B+ is suitable for delivering power to the device, and the larger USB connectors are not.  There is also a way to deliver power to the Raspberry Pi 3B+, such as through the general-purpose input/output (GPIO) header (see the official Raspberry Pi guidelines on using GPIO).

Figure 8: Peripherals and Cabling for Testing the Raspberry Pi 3B+

Booting the Raspberry Pi

If all goes well, you should see a color gradient when you first power up both the display and the Raspberry Pi 3B+.  Within a few seconds, you should also see a set of Raspberry Pi logos on-screen (typically in the top-left corner), followed by the moving text of the console.  If the whole system appears to reboot over and over again on an endless loop, that is a strong sign that the 5-volt power supply going to the Raspberry Pi 3B+ is underpowered, and it can’t keep up with the Raspberry Pi 3B+ power demand.

Figure 9: The Rainbow-Like Color Gradient is Good a Sign That Things are Working Properly

Without any intervention, the system should eventually boot to the graphical user interface as shown below.

Figure 10: The Initial Raspberry Pi Configuration Tool

Coming Up in Part 2…

If you have made it this far, then congratulations!  You have made it more than halfway toward receiving radio using the Raspberry Pi 3B+ and the Raspbian operating system.  In the next part, I will walk through the configuration steps, and then proceed to install, test, and then use utilities for the RTL-SDR receiver.

Software Defined Radio for Raspberry Pi 3B+ (Part 2): https://unboxing-tomorrow.com/software-defined-radio-for-raspberry-pi-3b-part-2/

References

[1] B. R. Mayes, “Unboxing the RTL-SDR.com Software Defined Radio,” Voxidyne Media LLC, 10 Nov 2019. [Online]. Available: https://unboxing-tomorrow.com/unboxing-the-rtl-sdr-com-software-defined-radio/. [Accessed 24 Nov. 2019].
[2] B. R. Mayes, Unboxing the HackRF One Software Defined Radio,” Voxidyne Media LLC, 17 Nov. 2019. [Online]. Available: https://unboxing-tomorrow.com/unboxing-the-hackrf-one-software-defined-radio/. [Accessed 24 Nov. 2019].
[3] Raspberry Pi Foundation, “SSH (Secure Shell),” Raspberry Pi Foundation, [Online]. Available: https://www.raspberrypi.org/documentation/remote-access/ssh/. [Accessed 23 Nov. 2019].
[4] Raspberry Pi Foundation, “Raspbian,” Raspberry Pi Foundation, [Online]. Available: https://www.raspberrypi.org/downloads/raspbian/. [Accessed 24 Nov. 2019].
[5] Balena, “balenaEtcher – Home,” Balena, [Online]. Available: https://www.balena.io/etcher/. [Accessed 24 Nov. 2019].

Important Notice: This article and its contents (the “Information”) belong to Unboxing-tomorrow.com and Voxidyne Media LLC. No license is granted for the use of it other than for information purposes. No license of any intellectual property rights is granted.  The Information is subject to change without notice. The Information supplied is believed to be accurate, but Voxidyne Media LLC assumes no responsibility for its accuracy or completeness, any error in or omission from it or for any use made of it.  Liability for loss or damage resulting from any reliance on the Information or use of it (including liability resulting from negligence or where Voxidyne Media LLC was aware of the possibility of such loss or damage arising) is excluded.