SDR install - albertmon/smarthome GitHub Wiki

Hardware installation on Linux is sometimes hard to do.
For SDR-dongles you need software from several sources and you have to build it yourself.
For our home automation project I have prepared and checked code (works on Raspbian Buster, probably on Bullseye). You can check your version with
grep VERSION /etc/os-release
or
cat /etc/os-release

The script is split in two parts, because after the first part you will have to reboot your system.
Of course you must make a backup of your system before you run these scripts, because Murphy is always lurking.

The script

Part 1

#################################
## Stage 1
#################################
## Setup environment requirements
#################################
## Copied from: https://sdr-setup-notes.readthedocs.io/en/latest/setup_REQUIREMENTS.html

sudo apt-get install -y autoconf automake autotools-dev icu-devtools libfftw3-bin libfftw3-dev \
libicu-dev libltdl-dev libsigsegv2 libtool libxml2-dev m4 libtool libusb-1.0-0-dev \
build-essential cmake pkg-config librtlsdr-dev rtl-sdr

mkdir ~/rtl_setup

#################################
## Stage 2
#################################
## Setup rtl_sdr (Native)
#################################
## Copied from: https://sdr-setup-notes.readthedocs.io/en/latest/dev_rtlsdr.html

cd ~/rtl_setup

git clone git://git.osmocom.org/rtl-sdr.git
cd rtl-sdr/

mkdir build
cd build
cmake ../ -DINSTALL_UDEV_RULES=ON
make
sudo ldconfig
sudo cp ../rtl-sdr.rules /etc/udev/rules.d/

# Add line to blacklist-rtl.conf
file=/etc/modprobe.d/blacklist-rtl.conf
text="blacklist dvb_usb_rtl28xxu"
grep -qs "$text" $file || echo "$text" | sudo tee -a $file

# By hand: sudo nano /etc/modprobe.d/blacklist-rtl.conf
# # add line: blacklist dvb_usb_rtl28xxu

sudo udevadm control --reload-rules && sudo udevadm trigger
sudo reboot

Part 2


##############################
## Stage 3
##############################
## Test sdr_rtl
##############################
## Copied from: https://sdr-setup-notes.readthedocs.io/en/latest/dev_rtlsdr.html#run
## After rebooting you should be able to test your stick
## Connect your RTL Stick (Virtual Box Menu Devices->USB-> Realtec RTL )
## The name may depend on the manufacturer of your Stick

cd ~/rtl_setup

rtl-sdr/build/src/rtl_test

## check the output if it finds the stick

# press ctrl+c to cancel rtl_test.

#################################
## Stage 4
#################################
## Setup RTL_433 tool
#################################
## Copied from: https://sdr-setup-notes.readthedocs.io/en/latest/dev_rtlsdr.html#rtl-433-tool-setup

## In your “rtl_setup” Directory clone and build rtl_433:

cd ~/rtl_setup

git clone https://github.com/merbanan/rtl_433.git

cd rtl_433/ && mkdir build && cd build && cmake ../ && make

sudo make install

##############################
## Stage 5
##############################
## Test rtl_433
##############################
## Start rtl_433 (RTL-SDR) (test)

rtl_433

## check the output if it finds the stick

# press ctrl+c to cancel rtl_test.