Skip to content

Instantly share code, notes, and snippets.

@floehopper
Last active August 11, 2024 09:07
Show Gist options
  • Save floehopper/99a0c8931f9d779b0998 to your computer and use it in GitHub Desktop.
Save floehopper/99a0c8931f9d779b0998 to your computer and use it in GitHub Desktop.
Install rtl-sdr on Raspian on Raspberry Pi
jamesmead@floehopper.local:~$ sudo dd bs=1m if=/Users/jamesmead/Downloads/2015-02-16-raspbian-wheezy.img of=/dev/disk2
pi@raspberrypi ~ $ sudo raspi-config
# Choose option 1 to "Expand Filesystem" - Ensures that all of the SD card storage is available to the OS
# Choose Finish & reboot

pi@raspberrypi ~ $ sudo apt-get update
pi@raspberrypi ~ $ sudo apt-get upgrade
pi@raspberrypi ~ $ cat <<EOF >no-rtl.conf
blacklist dvb_usb_rtl28xxu
blacklist rtl2832
blacklist rtl2830
EOF
pi@raspberrypi ~ $ sudo mv no-rtl.conf /etc/modprobe.d/

pi@raspberrypi ~ $ sudo apt-get install git-core
pi@raspberrypi ~ $ sudo apt-get install git
pi@raspberrypi ~ $ sudo apt-get install cmake
pi@raspberrypi ~ $ sudo apt-get install libusb-1.0-0-dev
pi@raspberrypi ~ $ sudo apt-get install build-essential

pi@raspberrypi ~ $ git clone https://gitea.osmocom.org/sdr/rtl-sdr.git
pi@raspberrypi ~ $ cd rtl-sdr/
pi@raspberrypi ~/rtl-sdr $ mkdir build
pi@raspberrypi ~/rtl-sdr $ cd build
pi@raspberrypi ~/rtl-sdr/build $ cmake ../ -DINSTALL_UDEV_RULES=ON
pi@raspberrypi ~/rtl-sdr/build $ make
pi@raspberrypi ~/rtl-sdr/build $ sudo make install
pi@raspberrypi ~/rtl-sdr/build $ sudo ldconfig
pi@raspberrypi ~/rtl-sdr/build $ cd ~
pi@raspberrypi ~ $ sudo cp ./rtl-sdr/rtl-sdr.rules /etc/udev/rules.d/
pi@raspberrypi ~ $ sudo reboot

pi@raspberrypi ~ $ rtl_test
Found 1 device(s):
  0:  Generic, RTL2832U, SN: 77771111153705700

Using device 0: Generic RTL2832U
Found Rafael Micro R820T tuner
Supported gain values (29): 0.0 0.9 1.4 2.7 3.7 7.7 8.7 12.5 14.4 15.7 16.6 19.7 20.7 22.9 25.4 28.0 29.7 32.8 33.8 36.4 37.2 38.6 40.2 42.1 43.4 43.9 44.5 48.0 49.6
Sampling at 2048000 S/s.

Info: This tool will continuously read from the device, and report if
samples get lost. If you observe no further output, everything is fine.

Reading samples in async mode...

pi@raspberrypi ~ $ sudo apt-get install libasound-dev
pi@raspberrypi ~ $ sudo apt-get install libpulse-dev

pi@raspberrypi ~ $ wget  http://www.aishub.net/downloads/aisdecoder-1.0.0.tar.gz
pi@raspberrypi ~ $ tar zxvf aisdecoder-1.0.0.tar.gz
pi@raspberrypi ~ $ cd aisdecoder-1.0.0/
pi@raspberrypi ~/aisdecoder-1.0.0 $ mkdir build
pi@raspberrypi ~/aisdecoder-1.0.0 $ cd build/
pi@raspberrypi ~/aisdecoder-1.0.0/build $ cmake ../ -DCMAKE_BUILD_TYPE=Release
pi@raspberrypi ~/aisdecoder-1.0.0/build $ make
pi@raspberrypi ~/aisdecoder-1.0.0/build $ sudo cp aisdecoder /usr/local/bin
pi@raspberrypi ~/aisdecoder-1.0.0/build $ cd ~
pi@raspberrypi ~ $

@allendav
Copy link

allendav commented Sep 7, 2015

Thank you for sharing this - this worked like a charm for me as well :)

@tonamsterdam
Copy link

Had to recompile with:

cmake ../ -DINSTALL_UDEV_RULES=ON -DDETACH_KERNEL_DRIVER=ON

before it worked.

Just sharing as it might help someone else as well.

Thanks for this posting!

@inspector71
Copy link

This seems to have run error-free for me so thanks!

@il0v3biko
Copy link

new in linux here.Does this work in Raspberry Pi 3 Raspbian Jessie?
Got everything installed as intructed but I did not see any sofware icon in the RTL SDR folder.
...is the software is it only thru terminal? how?

@lponced
Copy link

lponced commented May 8, 2017

Hi, I am new in this List, i am trying to use Raspberry Pi 3 with a RTL2832U + R820T USB ISDB-T Digital Television Receiver, I am in Ecuador nad we use ISDB-T for digita air TV. I wan to make a digital TV server on my home network, and try to use TVheadend with Libreelec version of Kody that handles ISDB-T for Server. My problem is that i can not get the corect driver for this device to work with the Raspberry Pi3. Any help on a driver that get to work RTL2832U + R820T USB ISDB-T with this device?

@chrisjosack
Copy link

I used this method on my RPi4 but after I installed Spyserver . I thought Spyserver already had the rtl communications built in. I now get this error:
Kernel driver is active, or device is claimed by second instance of librtlsdr.
In the first case, please either detach or blacklist the kernel module
(dvb_usb_rtl28xxu), or enable automatic detaching at compile time.

usb_claim_interface error -6
Failed to open rtlsdr device #0.

I used the blacklist as detailed in your method but I still get the error.
Any help would be appreciated.
Thanks in advance,
Chris

@Festerstoybox
Copy link

I used this method on my RPi4 but after I installed Spyserver . I thought Spyserver already had the rtl communications built in. I now get this error: Kernel driver is active, or device is claimed by second instance of librtlsdr. In the first case, please either detach or blacklist the kernel module (dvb_usb_rtl28xxu), or enable automatic detaching at compile time.

usb_claim_interface error -6 Failed to open rtlsdr device #0.

I used the blacklist as detailed in your method but I still get the error. Any help would be appreciated. Thanks in advance, Chris

i'm also having this issues, i've tried everything i can find but still no luck. strange thing was it was running couple month ago (last time i used it).

@0xHorace
Copy link

Had to recompile with:

cmake ../ -DINSTALL_UDEV_RULES=ON -DDETACH_KERNEL_DRIVER=ON

before it worked.

Just sharing as it might help someone else as well.

Thanks for this posting!

This is still relevant in 2022

@Jakuko99
Copy link

Jakuko99 commented Jun 13, 2022

Had to recompile with:

cmake ../ -DINSTALL_UDEV_RULES=ON -DDETACH_KERNEL_DRIVER=ON

before it worked.
Just sharing as it might help someone else as well.
Thanks for this posting!

This is still relevant in 2022

Compiled it same way, but got message No supported devices found. I already tried compiling and installing driver for rtl sdr many different ways, but with no luck. I have no idea at this point what I am doing wrong. Could it be caused by Raspberry OS 64-bit system?

EDIT: It works now, problem was in crappy USB extension cable.

@robrackn
Copy link

robrackn commented Mar 25, 2024

2024 here. You might have to use this link below instead of the git link posted in the instructions:
git clone https://github.com/osmocom/rtl-sdr.git

@floehopper
Copy link
Author

2024 here. You might have to use this link below instead of the git link posted in the instructions: git clone https://github.com/osmocom/rtl-sdr.git

Thanks. It looks as if the canonical repo has moved to Gitea: https://gitea.osmocom.org/sdr/rtl-sdr.git but there is an official mirror on Github: https://github.com/osmocom/rtl-sdr.git. I'll update the instructions accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment