Installing drivers and support for the SDRplay
RSP1A, HackRF One and RTL-SDR on a Raspberry Pi
On a newly installed 64-bit DietPi operating system
with the LXDE desktop environment.
There seems to be little Linux support for SDRplay devices outside of the
convenient images from SDRplay with preinstalled software. That software was
limited and out of date as of this writing. I have spent quite a bit of time
getting an up-to-date system on which to install the latest Linux SDR software.
I have added support for the HackRF One. This procedure uses Debian, whose
packages are much more up-to-date and is cleaner than the Ubuntu. It does not
have the flaky screen saver issues. I hope this helps you. These procedures may
work for other SDR hardware except for the drivers and device specific items.
Both built-in audio interfaces are present and working.
I suggest turning off power saving features as they will halt your SDR reception.
There are several places where this should be done. There are details
near the end of this section.
I only included prerequisites that were not found on my system. However,
there may be a few packages listed that are already installed. This is OK.
Note: I have included support for the SDRplay RSP1A, HackRF One and RTL-SDR. You will only need to install support for
the device(s) that you have.
Install DietPi Debian Bookworm:
You may also see the official How to install page.
- Download the latest DietPi ARMv8 Bookworm arm64 Raspberry Pi image here:
https://dietpi.com/downloads/images/?C=M;O=D
The file name will be similar to DietPi_RPi-ARMv8-Bookworm.img.xz
- Install the image on a 4 GB or larger SD card. This installation needs
16 GB, though. Use your favorite image
program. Use
Raspberry Pi Imager
or
balenaEtcher on Windows. For more help extracting and flashing
the image, look on the image help page.
You may try a smaller SD card if everything will fit on that.
-
Steps to use the DietPi
"beta" branch if you prefer:
- Open the SD card drive/folder that contains the boot files and
update dietpi.txt using a text editor of your choice.
Open the file named
dietpi.txt.
Change DEV_GITBRANCH=master to DEV_GITBRANCH=beta
(located near the bottom of the file).
Save the file or leave it open
if you want to enable WiFi in the next step.
- Boot the image in your Raspberry Pi.
- Log in using "root", password: "dietpi".
- DietPi Update runs after login.
If a wired network is not connected,
update will not be successful.
Select DietPi-Config
Select
Language/Regional Options
Change:
Locale : [en_US.UTF-8]
Timezone :
[...your time zone...]
Generic 104 key PC (or your actual keyboard)
Keyboard : [English-us]
(go to the other menu, then select it on the main menu displayed)
Tab to
<Ok>, press Enter
Select English (US), press Enter
Select The default
for the keyboard layout, press Enter
Under Compose key select Right Alt
(AltGr), press Enter
Select Back<Ok>
Select Network Options: Adapters
Highlight Onboard WiFi. If it is off, press enter to turn it on.
Select
WiFi <Enter>
<Ok>
Wait for several minutes.
Select
Country
Select your country and press Enter.
Select Scan and configure SSID
Select 0: [unused]
Select to configure and press Enter.
Scan and configure an SSID
Select
your WiFi
Press enter
Select WPA-PSK if you use this type of
authentication
Press Enter
Type WiFi password
Press Enter
Tab to
<Done>
Press Enter.
Use arrow keys to <Apply>
Press Enter
Tab to <Ok>, press enter
Wait a few minutes
<Back>
<Back>
<Exit>
<Exit>
<Ok>
In the Reboot now window, press <Ok>
- DietPi Update runs after login.
Configuration boxes for the following will appear:
DietPi GPL license
It will automatically update.
SD Card Hot Plug Detection
DietPi Survey
Change passwords
Disable serial console
- The DietPi-Software menu will run. These are the settings I use, but
yours may differ.
Select Browse Software
Under Desktops, highlight LXDE, press space
Under File Server Clients, highlight Samba
Client, press space
Under System, select FFmpeg
Select any other software that you would like to
install such as:
TigerVNC Server
OpenSSH Client
Web browser of your choice
Tab to <Confirm> and press enter
Press down arrow to
select Install and press enter
Select <Ok>.
The GUI and other
selected software will be installed.
Select <Ok>for increased GPU
memory.
- Before you launch the GUI,
usermod -a -G sudo,plugdev dietpi
- Run dietpi-config
Select AutoStart Options
Under Local Terminal,
select Automatic Login, select the DietPi user
Under Desktops/LightDM login mask, select
Automatic Login, select the DietPi user
Select Exit
Select Display Options / GPU/RAM Memory Split
Select 128 : Gaming
Select:
<Ok>
<Cancel>
<Back>
<Exit>
Select
<Ok> to exit.
<Ok> to reboot
- The dietpi user should be logged in to the GUI automatically.
- There is problem with the firmware installation in recen DietPi
distributions. There is a migration script ot fix it.
- Determine if we need the patch
ls /boot/firmware
# if it says "ls: cannot access '/boot/firmware': No such file or directory", you need to run the script.
- Run the script
su
bash <(curl -sSf 'https://raw.githubusercontent.com/MichaIng/DietPi/dev/.meta/dietpi-rpi-firmware-migration')
# For Raspberry Pi 2-5, choose No.
# For Raspberry Pi 5, choose Yes.
exit
- reboot (as suggested by the script)
- The GPU memory settings above and
these configurations will install OpenGL version 2.1, compatible with SDR++.
sudo dietpi-config
Select Display Options
Select Display Resolution
Highlight vc4-fkms-v3d : OpenGL | 1920 x 1080
Press Enter
Tab to <Cancel> and press enter
<Back>
<exit>
<Ok> to reboot
- Samba client: Can be installed and setup by DietPi-Drive_Manager.
To
mount a Windows share, run
"sudo dietpi-drive_manager" in a terminal and select "Add network drive".
Go through the procedure to set up the share and remount automatically after reboot.
- Create standard directories
mkdir ~/Documents
mkdir ~/Downloads
- Scroll bar configuration
Sometimes scroll bar behavior is
different between applicatons and from what you may prefer. This procedure
will make your scroll bar work more like most other operating systems.
Edit or create these files. You may change the values to your preference.
mkdir ~/.config/gtk-3.0
mousepad ~/.config/gtk-3.0/settings.ini
# Insert the following into the file:
[Settings]
gtk-primary-button-warps-slider = false
# Save the file.
mousepad ~/.config/gtk-3.0/gtk.css
# Insert the following into the file:
.scrollbar {
-GtkScrollbar-has-backward-stepper: true;
-GtkScrollbar-has-forward-stepper: true;
min-width: 18px;
min-height: 18px;
}
scrollbar slider {
/* Size of the slider */
min-width: 14px;
min-height: 14px;
border-radius: 5px;
/* Padding around the slider */
border: 2px solid transparent;
}
# Save the file.
Before you begin
Install software:
- I recommend that you uncompress the apt index files to improve the speed of
installations.
su
# Log in to the root account and run these commands:
echo 'Acquire::GzipIndexes "false";' > /etc/apt/apt.conf.d/98dietpi-uncompressed
/boot/dietpi/func/dietpi-set_software apt-cache clean
apt update
exit
- Qt5 5.15
-
sudo apt-get install libqt5core5a
- Install additional Qt5 packages
sudo apt install qt5-qmake qtbase5-dev qtmultimedia5-dev libqt5multimediawidgets5 libqt5multimedia5-plugins qtgstreamer-plugins-qt5 qtcreator libqt5svg5-dev libqt5serialport5-dev qttools5-dev libqwt-qt5-6 libqwt-qt5-dev
sudo apt install libqt5websockets5-dev libqt5charts5-dev qml-module-qtlocation qml-module-qtpositioning qml-module-qtquick-dialogs qml-module-qtquick-controls qml-module-qtquick-controls2 qtdeclarative5-dev qtpositioning5-dev qtlocation5-dev libqt5texttospeech5-dev libqt5opengl5 libqt5opengl5-dev
- Install some more basics
sudo apt install python3.11-dbg python3.11-dev pyqt5-dev python3-sip python3-pyqt5.sip python3-pyqt5 python3-venv python3-pip
sudo apt install man git g++ build-essential ntfs-3g apt-utils libudev-dev at-spi2-core usbutils xarchiver
- Optionally Install the muon package manager.
- Install muon
sudo apt install muon
- cmake
- To install the version in the packager: sudo apt-get install cmake
- For the latest version of cmake,
Instructions are here, but the
packager version will work. This is a long
procedure.
- Before installing any compiled software, set these compiler
optimization flags. This must be repeated after a reboot or if you use a
different terminal window.
Note that with this optimization, this image may not boot on other
Raspberry Pi hardware.
# For a 64-bit operating system on a Raspberry Pi 4:
export CXXFLAGS='-O3 -mtune=cortex-a72'
export CFLAGS='-O3 -mtune=cortex-a72'
# For other operating systems:
export CXXFLAGS='-O3 -march=native -mtune=native'
export CFLAGS='-O3 -march=native -mtune=native'
- SDRplay API Installation
If you upgrade to API 3.14 from an earlier
version, it will break your system.
- Prerequisites
sudo apt install libusb-1.0-0 libusb-1.0-0-dev usbutils libfftw3-dev file
sudo service udev restart
- Download API 3.14.0 or later for Linux (64 bit) (3.14) from
https://www.sdrplay.com/downloads/.
cd ~/Downloads # or wherever you downloaded the file
chmod 755 SDRplay_RSP_API-Linux-3.14.0.run
sudo ./SDRplay_RSP_API-Linux-3.14.0.run
sudo ldconfig
- To stop and start the API service, use the following commands...
sudo systemctl stop sdrplay
sudo systemctl start sdrplay
- Type lsusb. Bus 001 Device 003: ID 1df7:3000
or similar should be displayed.
- If you have SDRplay driver crashes, try this:
msi2500 driver conflicts
- HackRF One installation
- Prerequisites
If you did not install these for SDRplay:
sudo apt install libusb-1.0-0-dev usbutils libfftw3-dev
- Install
cd ~/
git clone https://github.com/greatscottgadgets/hackrf
cd hackrf/host
mkdir build
cd build
cmake ..
make -j 4
sudo make install
sudo ldconfig
- Reboot
- You need to update the HackRF firmware if it does not match the
version of the driver. As of this writing, the latest firmware/driver
version was 2024.02.1
Many HackRF devices have firmware version 2018.01.1 or earlier. Use hackrf_info
to see if the firmware version matches the driver that you installed.
hackrf_info
If you see "Firmware Version: 2024.02.1 (API:1.08)", then it is up to date and
you do not need to do the firmware update shown below.
# Transfer rate test:
hackrf_transfer -r /dev/null -s 20000000
# Connect an antenna and test sending data:
hackrf_transfer -t /dev/zero
- Firmware updating instructions are based on this:
https://hackrf.readthedocs.io/en/latest/updating_firmware.html#updating-the-spi-flash-firmware
Note that the zip and tar.xz archives have the firmware files.
The git clone procedure does not.
Download
hackrf-2024.02.1.zip
Extract only the firmware-bin directory into the ~/hackrf directory
cd ~/hackrf/firmware-bin
# To update the firmware on a working HackRF One, use the hackrf_spiflash program:
hackrf_spiflash -w hackrf_one_usb.bin
# Press the reset button on the HackRF.
hackrf_info
# The new firmware version should now displayed.
# Perform the hackrf_transfer tests above.
- Install the rtl-sdr driver
Based on a NESDR SMArt SDR. Others should be similar.
- GNU Radio 3.10
This will install GNU Radio from packages supplied with Debian. It saves a
few hours of installation time over compiling it
Alternately, you can Click Here
to install and compile UHD and GNU Radio from source or
install a different package version,
then skip past this section.
- Prerequisites
- Install these packages. (some may already be installed).
sudo apt install g++ libcodec2-dev libvolk2-bin libvolk2-dev libvolk2.5 build-essential libgtk-3-dev
sudo apt install libboost-all-dev libgmp-dev swig python3-requests python3-ruamel.yaml python3-setuptools python3-numpy python3-mako python3-sphinx python3-lxml doxygen libsdl1.2-dev libgsl-dev libzmq3-dev cppzmq-dev python3-yaml python3-click python3-click-plugins python3-zmq python3-scipy python3-docutils liborc-0.4-0 liborc-0.4-dev python3-gi-cairo python3-waitress liblog4cpp5-dev liblog4cpp5v5
sudo apt install libsndfile1-dev osspd osspd-pulseaudio sudo osspd-alsa libcppunit-dev libqt5opengl5-dev libpthread-stubs0-dev libudev-dev libxtrx-dev
sudo apt install pybind11-dev python3-pybind11 pybind11-json-dev libspdlog-dev libspdlog1.10 python3-pygccxml
- Install recommended packages
sudo apt install python3-matplotlib python3-networkx python3-pyqt5.qwt libeigen3-dev python3-json-pointer python3-rfc3987 python3-uritemplate python3-webcolors python3-pyqt5.qtopengl
- Install UHD and GNU Radio 3.10
- Installing them separately will prevent them from installing unwanted packages.
sudo apt-get install --no-install-recommends libuhd4.3.0 libuhd-dev
sudo apt-get install --no-install-recommends gnuradio gnuradio-dev
# Show version
gnuradio-config-info -v
mousepad ~/.xsessionrc
#add this export command to the end of the file or to any existing PYTHONPATH line. Save changes to make the variables permanent.
export PYTHONPATH=/usr/lib/python3.11/dist-packages:/usr/lib/python3/dist-packages:/usr/local/lib/python3.11/dist-packages:$PYTHONPATH
- Create a file named /etc/ld.so.conf.d/gnuradio.conf containing: /usr/lib
sudo mousepad /etc/ld.so.conf.d/gnuradio.conf
# insert the line: /usr/lib
# Save the file
sudo ldconfig
- Run VOLK profiler for optimal performance
volk_profile
- reboot
- Install SoapySDR
SoapySDR is installed with GNU Radio. We need to add
a few packages.
sudo apt install libsoapysdr-dev soapysdr-tools
- Install the Soapy SDR module for SDRPlay
cd ~/
git clone https://github.com/pothosware/SoapySDRPlay3.git
cd SoapySDRPlay3
mkdir build
cd build
cmake ..
make -j4
sudo make install
sudo ldconfig
# Type these commands. If your SDR is listed, the hardest work is done!
SoapySDRUtil --info
SoapySDRUtil --probe="driver=sdrplay"
- Install the Soapy SDR module for HackRF
cd ~/
git clone https://github.com/pothosware/SoapyHackRF.git
cd SoapyHackRF
mkdir build
cd build
cmake ..
make -j4
sudo make install
sudo ldconfig
# Type this command. Check that your SDR is listed and the details are correct.
SoapySDRUtil --probe="driver=hackrf"
- Soapy SDR plugin for RTL-SDR
cd ~/
git clone https://github.com/pothosware/SoapyRTLSDR.git
cd SoapyRTLSDR
mkdir build
cd build
cmake ..
make -j4
sudo make install
sudo ldconfig
# Type this command. Check that your SDR is listed and the details are correct.
SoapySDRUtil --probe="driver=rtlsdr"
- Alternate gr-osmosdr module for SDRplay API 3.x - supports RSPduo (all modes) and RSPdx
Please note that this code is still experimental. The installer does find SDRplay, Soapy
and HackRF. OsmoSDR does appear in GNU Radio Companion, no reference to SDRplay or Soapy.
cd ~/
git clone https://github.com/fventuri/gr-osmosdr.git
cd gr-osmosdr/
mkdir build
cd build
cmake .. -DENABLE_NONFREE=TRUE
Under Gnuradio enabled components in the terminal text, check that SDRplay RSP (NONFREE), SoapySDR, HackRF
and Osmocom RTLSDR support are listed.
make -j4
sudo make install
sudo ldconfig
- gr-sdrplay3
GNU Radio OOT module for SDRplay RSP devices (SDRplay API V3.x)
cd ~/
git clone https://github.com/fventuri/gr-sdrplay3.git
cd gr-sdrplay3
mkdir build
cd build
cmake ..
make -j4
sudo make install
sudo ldconfig
- Run GNU Radio Companion and check that OsmoSDR and SDRplay3 are present
with all of the SDRplay devices under SDRplay3 in the tree on the
right side of the window.
- Install Pulse Audio and Volume Control
If you don't hear any
audio, output may be on the incorrect audio device.
sudo apt-get install libpulse0 pulseaudio pavucontrol paprefs pulseaudio-utils libpulse-dev
# Optionally, for systems with Qt5 installed
sudo apt-get install libpulse0 pulseaudio pavucontrol-qt paprefs pulseaudio-utils libpulse-dev
- If you find that the operating system only has mono audio:
sudo mousepad /usr/share/pulseaudio/alsa-mixer/profile-sets/default.conf
- Comment out each line in the [Mapping analog-mono] section with a ";" at the beginning of the line.
- Save the file and reboot.
- Audio tuning
So far, audio support on DietPi Bookworm is poor.
- Screen savers and power features should not be installed on DietPi.
Back to the index