Experience SDR on Raspberry Pi 4

What is SDR?

The definition of SDR (Software-defined Radio) on Wikipedia is: replacing some hardware components in wireless communication systems with software components on computers or embedded systems. SDR is not a new concept but a mature technology that has been widely used in military and mobile communications. It, along with SDA (Software-defined Antenna), contributes to CR (Cognitive Radio). In summary, devices using SDR are more flexible than traditional radio devices (software-implemented components are flexible and variable), and they are also cheaper (underlying hardware is relatively uniform and changes less).

Experience SDR on Raspberry Pi 4

In the IT industry, a particularly popular term in the past two years is “middle platform.” The concept of a “middle platform” in the communication field appeared at the end of the last century, and its key core technology is SDR. More than 20 years ago, the famous US military Joint Tactical Radio System (JTRS) was a representative of this kind of “middle platform.” The US military has hundreds of thousands of radios, involving dozens of series and hundreds of models, with single functions, frequency bands, and waveforms, making networking very difficult and equipment upgrades very expensive.

According to the “middle platform thinking,” it is necessary to break down silos, establish architectural norms, unify the underlying “stability layer,” and separate various components in the “change layer.” Such changes are inseparable from the significant advancements in digital devices and software technology at the end of the last century. The new series of tactical radios from the US military has upgraded from limited waveform, low-cost terminals to multi-band, multi-mode, multi-channel radios that can be interconnected over the network, with the following characteristics:

  • Wide operating spectrum (2~2000MHz)

  • Open architecture (SCA)

  • Hardware/software modularization for easy upgrades and introduction of new technologies

  • Programmable waveforms and functions

  • Collaborative networking capabilities

  • Multiple application fields (airborne, shipborne, mobile, fixed)

Experience SDR on Raspberry Pi 4

Back to daily life, take a look at the radio devices around you: The radio I listened to when I was in elementary school could only receive medium wave broadcasts, the FM radio in high school had excellent sound quality, and in college, I had a watch-type walkie-talkie that allowed me to meet friends downstairs for lunch, and I even received the BPM time broadcast in Beijing with a shortwave radio, receiving a postcard from the Shaanxi Lintong Time Center. Later, I became interested in civil aviation and bought an aviation frequency receiver to listen to airport ATIS, approach, ground, and tower communications. Each of these dedicated devices has its own small frequency band and can receive and process specific waveform signals.

So, is there an amateur SDR solution similar to the US military’s wide-band multi-band radios that can be happily played with software? Of course, there are many options, and the cheapest one is the GNU Radio + RTL-SDR solution.

GNU Radio

GNU Radio is an open-source software system that defines the way radio waves are transmitted and received through minimal hardware integration, building radio communication systems.

Experience SDR on Raspberry Pi 4

GNU Radio applications are written in Python, while the actual information processing is implemented by C++ floating-point extension libraries. Therefore, developers can obtain a real-time, efficient, and reusable application development environment. Although GNU Radio is not primarily used for simulation, it can also develop signal processing algorithms without real hardware by using pre-recorded or generated data.

GNU Radio provides a library of signal processing modules (blocks) and connects individual processing modules to form a radio system by establishing a flow graph. Python is used to construct the flow graph and the graphical interface of the application, while C++ is used to write various blocks.

The properties of signal processing blocks include the number of input and output ports and the type of data flowing through them. Commonly used data types include short, float, and complex types. Some processing modules have only output or input ports, which are called data sources and sinks, respectively.

GNU Radio includes a rich set of blocks, including various filters, FFT transformations, modulation/demodulation modules, channel encoding/decoding modules, and time-frequency synchronization modules, some of which are optimized using CPU’s enhanced instruction sets (such as MMX, SSE, 3D Now!) to improve performance.

RTL-SDR

“TV stick” is its disguise (please ignore the remote control and CD), the cheapest SDR hardware is its true identity (MCX antenna and USB stick are the key). The RTL2832U+R820T2 in my hand (recommended!) cost only 45 yuan with free shipping on Taobao at the time, and now the cheapest ones are close to 60 yuan.

Experience SDR on Raspberry Pi 4

Some people have dismantled the case and soldered a 102 ceramic capacitor (1000pf) at the center point of Q+ and the antenna socket, which is said to modify the Q channel to expand the frequency from 0 to 30Mhz, achieving a frequency span of 100K~1766Mhz. There is a store on Taobao selling the modified version, which also comes with an MCX to SMA adapter and OTG adapter, all for under 80 yuan, a great deal!

RTL-SDR can only receive radio signals and does not have transmission capabilities, so everyone can play with it safely. SDR hardware with transmission capabilities is suitable for professionals for research and development, including USRP, HackRF, LimeSDR, and BladeRF, which are powerful but also expensive.

Wait a minute? Who just said RTL-SDR doesn’t have transmission capabilities? OH2FTG was the first to discover and utilize the local oscillator signal leaked from the “TV stick” due to poor shielding (although extremely weak) and successfully received this signal using another receiver.

According to his analysis, the leaked local oscillator frequency from the TV stick is basically equal to four times the output frequency of the TV stick plus the first intermediate frequency (for the 820T2 tuning chip, this frequency is 6MHz). Those interested can go take a look (they are still further improving it, please bring your own ladder to worship).

https://sites.google.com/site/oh2ftg/home/rtl-sdr-transmitter-experiments

GQRX

GQRX is an SDR receiver with a graphical interface based on GNU Radio, which supports various SDR hardware through gr-osmosdr, including Funcube Dongle, RTL-SDR, Airspy, HackRF, BladeRF, RFSpace, USRP, and SoapySDR. It can receive AM/FM/SSB modulated signals and restore them to sound output, and it can also be used as an FFT waterfall spectrum analyzer. Successfully installing this software means that we can experience the fun of SDR.

Experience SDR on Raspberry Pi 4

Experience GQRX on Raspberry Pi 4

Continuing from the previous article where we discussed how to install the Ubuntu 19.10 desktop on Raspberry Pi 4, we will now set up GQRX on this system, using the RTL2832U+R820T2 hardware shown in the above image. What? apt install? Haha? I’ve already tried it, the pitfalls are too big; let’s install from source.

Installing from source requires installing various dependency tools with apt, such as automake, make, cmake, gcc, libboost-all-dev, libgmp-dev, etc. Generally, it’s fine to install them when prompted for missing dependencies.

Here are the specific steps (I installed the git project directory as /home/ubuntu/git_home, starting each step from this directory):

Install librtlsdr

git clone https://github.com/steve-m/librtlsdrcd librtlsdrmkdir buildcd buildcmake ../makesudo make installsudo ldconfig

Install gnuradio

git clone --recursive https://github.com/gnuradio/gnuradio.gitcd gnuradiomkdir buildcd buildcmake  ../makesudo make installsudo ldconfig

Install gr-osmosdr

git clone git://git.osmocom.org/gr-osmosdrcd gr-osmosdr# Since the gnuradio installed in the previous step is already 3.9, this step still requires 3.8, so we need to change the configuration file: vi CMakeLists.txt# Find the line "find_package(Gnuradio "3.8" ..." and change 3.8 to 3.9, save and exitmkdir buildcmake ../makesudo make installsudo ldconfig

Install GQRX

git clone https://github.com/csete/gqrx.git# Currently (2020.3.8), the master code has issues compiling parser_impl.cc, which is a major pitfall -_-|||# Fortunately, a recent contributor has proposed a PR that hasn't been merged yet# https://github.com/csete/gqrx/pull/762# We need to merge this PR locally to continue git pull origin refs/pull/762/headmkdir buildcmake ../makesudo make install

Start GQRX

Method 1: Execute the gqrx command in the terminal

Method 2: Copy a .desktop file in /usr/share/applications and rewrite the content (the icon path may need to be replaced):

[Desktop Entry]Name=GQRXComment=SDR ReceiverExec=gqrxIcon=/home/ubuntu/git_home/gqrx/resources/icons/gqrx.icoTerminal=falseType=ApplicationStartupNotify=trueCategories=Application;Utility;

After saving and closing, drag this file to the desktop, right-click and select “Allow Launching” to create a desktop shortcut.

Experience SDR on Raspberry Pi 4

Now, please enjoy listening!!!

Friendly reminder: The FFT waterfall chart consumes a lot of CPU, and keeping the interface open can easily overheat the CPU, so it is recommended to minimize the interface after adjusting.

The ways to play with RTL-SDR are numerous; today we have just scratched the surface. If you want to know more, please visit the RTL-SDR website:

About RTL-SDR

Leave a Comment

×