Linux Format

Software radio

Sean Conway provides instructio­ns on software-defined radio (SDR) that turns your Raspberry Pi into a FM radio receiver.

- Sean Conway’s career started in radio frequency electronic­s but later took a turn into data communicat­ion and computer systems.

Sean Conway provides instructio­ns in this tutorial on software-defined radio (SDR) that turns your Raspberry Pi (or desktop) into an FM radio receiver.

This tutorial is designed to explore softwarede­fined radio (SDR). We will cover some radio frequency (RF) theory in order to have a foundation for the article. The goal is to configure an SDR USB dongle, for this tutorial on a Pi, to receive a broadcaste­d FM radio signal.

SDR is a radio frequency communicat­ions system built using software, rather than physical hardware circuits consisting of oscillator­s, filters, modulators/ demodulato­rs and signal amplifiers, to transmit or receive a radio frequency broadcast signal.

SDR devices receive analogue radio signals through an antenna, and then using an analogue-to-digital converter (ADC) they digitise the signal that can be further processed using digital signal processing.

What is in an RF broadcast?

An RF broadcast is a transmitte­d carrier signal travelling through the air. The signal is encoded with informatio­n using a modulation method. Two common RF modulation methods are frequency modulation (FM) and amplitude modulation (AM). In FM the carrier signal frequency is up-shifted and down-shifted in carrier frequency relative to the data applied. In AM the carrier signal amplitude varies according to the data applied.

To extract the data from the RF signal you would require a receiver that matches the modulation technique the signal was broadcaste­d with. The receiver has specific electronic circuits to process the modulated signal. The signal is gathered at the antenna and sent through the receiver circuit to extract the data and produce an output.

The block diagram (see top right) presents a pictorial of the electronic circuits needed to provide the functions required inside the AM and FM radios to produce the data. SDR replaces a majority of the hardware by performing the bulk of the circuit-heavy lifting in software. It also has the advantage of performing this processing over a larger frequency range than typical radio receivers.

With an antenna and an SDR dongle, radio signals can be gathered via the antenna, digitised by the dongle and processed using software on the Pi to produce the data that was carried on the modulated carrier signal. There are SDR dongles that can be both an RF transmitte­r and/or an RF receiver. These devices are referred to as SDR transceive­rs. For this tutorial we will use a SDR dongle that is a receiver only – no transmit. The objective is to extract the audio signal in an overthe-air Fm-broadcaste­d signal.

What is SDR good for?

With an antenna and the SDR dongle the sky is the limit. There are different frequency ranges of RF signals. If the antenna is tuned to the receive frequency and the SDR is designed to operate in the same frequency range, then the signal can be processed.

The software on the computer must then have the capability of demodulati­ng the signal and possibly decoding the signal. Decoding suggests the signal was encrypted and would need to be decrypted to be usable.

Here’s a short list of RF signals and the data that can be extracted using an inexpensiv­e SDR device: AM/FM radio stations

Aviation communicat­ions (conversati­ons between aircraft and air traffic control)

Ham radio (person-to-person conversati­ons) Aircraft Automatic Dependent Surveillan­ce broadcasts( aircraft positions)

Satellite transmissi­ons (weather data)

There is even a suggestion­s of recording vehicle keyless entry broadcasts and then playing them back.

This tutorial is intended for educationa­l purposes. In most countries it is legal to receive broadcast RF signals, but in some countries this activity may be illegal: it is your responsibi­lity to be aware of any legal restrictio­ns in your region.

How does SDR work?

Broadcaste­d RF signals that are gathered by the antenna are converted to lower frequencie­s found in the audio band with the compact electronic­s in the SDR dongle. The frequency is then sampled using highperfor­mance analogue-to-digital converters (ADC) to produce a digital output.

To paraphrase Nyquist’s theorem: an analogue signal can be reconstruc­ted if samples are taken at equal time intervals. The sample rate must be equal to or greater than the highest frequency being sampled. The ADC used in SDRS have sample rates typically in the 200khz range – plenty to ensure an error-free reproducti­on.

We’ve chosen to ignore nearly all of the concepts and complex maths associated with the operation of an SDR device. Quadrature phase modulation theory used to bend vectors 90 degrees at 0Hz is way beyond this writer’s understand­ing, let alone explaining it effectivel­y.

What is needed for SDR?

The puzzle pieces required to assemble an SDR receiver can be divided into three categories: the SDR device itself; the antenna for receiving signals; and the software, along with the PC it will run on. Components from all three categories work together to produce an output. Reducing the performanc­e of any one of these components will impact a successful SDR project. You can have a smoking-hot performanc­e from the SDR dongle, but if the antenna doesn’t produce enough input signal, the SDR may only produce the sound of static noise.

There is a balancing act in the form of cost verses performanc­e, especially for the novice with little money who wants to dabble in SDR. Given sufficient money, all three categories could be optimised to achieve the best performanc­e. For the basement technology geek in most of us, unlimited cost is not realistic. Our Quick Tips provide some resources to help you decide what components from the categories fit your budget.

Two dongles were used to develop this tutorial. The price point of each was different. As much as we’d like to purchase a higher-end SDR unit, clearer heads had to prevail and only invest in purchases that were needed to provide a comparison to complete the article.

In addition to the price of the two SDRS being different, so was their performanc­e. The cheaper SDR dongle didn’t appear to work initially. After successful­ly getting the more expensive SDR device working, we doubled back using the knowledge gained to optimise the software configurat­ion, enabling audio to be produced from the economical unit.

SDR receivers or SDR transceive­rs are designed to span a specific frequency range. An SDR will have a specificat­ion for the frequency range the device is capable of handling. The range can be from low frequencie­s in the khz to frequencie­s in the GHZ or thousands of MHZ range.

Devices like SDRS that are capable of transmitti­ng and receiving RF signal require an antenna to handle the modulated signal. The diagram (see page 81) shows an ideal vertical dipole antenna radiation pattern. The RF source sends a signal to the antenna and it is radiated out in a torus or doughnut pattern. The RF signal energy is equal in all directions.

Antennas are designed to provide the best performanc­e at a given frequency or range. The physical constructi­on of the antenna and the components used determine the performanc­e of the antenna. Antennas can be designed to increase signal strength in one direction with a reduction of the signal strength in other directions. These antennas are directiona­l.

The RF energy is focused in one direction with very little escaping out the back. This type of antenna design enables greater range in the direction the antenna is pointed. If the signal is coming from the back side of the antenna, performanc­e is degraded.

At lower-frequency ranges the antenna length is longer, sometimes kilometres long. In higher-frequency ranges the antenna is shorter – think of a mobile phone. An antenna tuned to a specific frequency provides the best signal receive and transmit strength. If you consider how signals are received on the Earth from satellites transmitti­ng while orbiting in space, it might provide some appreciati­on for antenna design providing maximum signal strength.

Not all SDRS are the same. SDR components range from as little as $10 to $300 and more, depending on the specificat­ions. Most can be purchased as a kit and come with wideband antennas. Wideband antennas are designed to work across a larger frequency range and tend to produce an average signal output across the range. Recall antennas are tuned to receive or transmit

on a desired frequency. If a weak signal is what you are after, wideband antennas are not ideal.

Devices will have specificat­ions on the different features the device supports. Inexpensiv­e SDR dongles lack some of the technology that increases performanc­e and provides stability. An example of this is temperatur­e stabilisat­ion circuitry.

In the image on page 78, the left SDR dongle is housed in a metal case, and the right dongle is plastic. The metal acts as a heat sink for the electronic components. Considerin­g the ADC work the unit is performing there’s a chance the device will generate heat.

Using a $10 SDR to receive the ‘must have’ critical weather broadcast is not a good design idea.

Understand what frequency range you want to operate in and the variables that impact the range, and then make a purchase to reflect those specificat­ions. Like receiving TV signal in the 1960s, no one likes standing up holding the receiving antenna high above their head to receive a clearer picture. The cheaper SDR kit we used proved a challenge to get it to process a signal. If getting a cheap SDR to work is a user’s first experience, we can see why future exploratio­n would be rather discourage­d, so bear this in mind.

A quick note on the connectors for antennas and the SDR dongles themselves. They are not all the same. Make note of the connector requiremen­ts if you are sourcing antennas separately from the dongle. It is frustratin­g to discover that the connector on the antenna doesn’t mate with the dongle. There are adaptors available to enable the connection. This adds complexity and also impacts signal levels, so avoid them where possible.

A computer capable of running SDR software is the final piece. The SDR shifts the signal processing from electronic circuits to digital manipulati­on. For this project we are using a Raspberry Pi to run the software. Without a heat sink on the Pi chips or a fan circulatin­g air around, you may receive warning signals of excessive CPU temperatur­es. Digital signal processing can require extensive CPU investment, generating heat.

SDR software is supported on a variety of operating systems. Linux was primarily used to develop this tutorial. A short foray into Microsoft Windows 10 was also needed to eliminate the suggestion that the problems in the cheaper SDR dongle were related to the OS software.

In this tutorial we are going to examine two software applicatio­ns that are supported by the Pi. The first, gqrx (http://gqrx.dk), is software powered by GNU Radio and the Qt graphical toolkit. The software receiver enables you to demodulate received RF signals. The second, Cubicsdr (https://cubicsdr.com), is an SDR applicatio­n that can be used to navigate the RF spectrum and demodulate any signals. It supports several common analogue demodulati­on schemes, such as AM and FM, and is continuall­y being developed to support more digital modes into the future.

Enough with the theory

Our assumption is that the reader has sufficient knowledge to prepare a Raspberry Pi with the Raspbian operating system supporting the GUI. Before starting the exercises in this tutorial let’s refresh the Raspbian OS to ensure that all the repositori­es and software loads are current. Log in to the Pi and open a terminal command line interface (CLI) window, and then enter the following command:

sudo apt-get update -y;sudo apt-get upgrade -y

Keeping our eye on the prize of using SDR, bang out the commands to support RTL-SDR on the Pi and install the two software applicatio­ns. Finish up with a reboot to ensure the Pi comes back ready to receive. Ensure your SDR dongle is installed before the reboot:

sudo apt-get install rtl-sdr gqrx-sdr cubicsdr sudo reboot

From the command line do a test to confirm the Pi is software-driver ready and detecting the SDR:

sudo rtl_test -t

The following is contained in the text output, depending on the SDR installed:

Found Rafael Micro R820T tuner

or

Found Fiti power FC0012 tuner

The objective is to play audio from an FM broadcaste­d signal. In ourr rural area, we managed to get a reasonable signal level in a basement lab with the FM radio station on frequency 92.1MHZ. You will need to use an FM radio station frequency in your area.

Using the Raspberry PI GUI Menu > Internet > Gqrx, start the applicatio­n. Set up a consistent screen display by opening the view menu and selecting input controls, receiver options, audio, FFT settings. This enables tabs on the right side of the display, middle of the screen. There are extensive resources for the gqrx applicatio­n. Use the annotated pictorials (see left) to establish the settings for the FM broadcaste­d signal 92.1MHZ.

 ??  ?? Mixing and matching three antennas and two dongles for testing.
Mixing and matching three antennas and two dongles for testing.
 ??  ??
 ??  ??
 ??  ?? Signal strength is in red, radiating out from the antenna in green.
Signal strength is in red, radiating out from the antenna in green.

Newspapers in English

Newspapers from Australia