Rtl-sdr in Raspi

As you might be well aware that we are crossed by hundreds of radio waves[1], or say, electromagnetic radiation everyday. Those wave could be either from our portable devices (WiFi, Bluetooth) or from public transmissions(FM-, AM- radios, radar, satellite, cellphone, and various other communication devices). In this and several other post, I will try to access those signals that are freely moving around us in the air. Moreover, I will show you how we can read those signals with raspberry pi and rtl-sdr USB stick.

Note that, all the post in this website are kept and preserved for my personal reference as an online notebook, and therefore typos and other mistake might be frequent. Also, be aware that scanning and transmitting any signal might involve legal issues, please continue it at your own risk.

This post will show how to install the rtl-sdr driver in the raspberry pi or any Debian flavor of Linux system. Please follow the instruction as below:

Since rtl-sdr driver requires installation of few additional packages. First update and upgrade your system packages with the following commands:

sudo apt-get update 
sudo apt-get upgrade

After that we should disable pre-installed standard drivers that enables dongles to execute in their default mode i.e. USB Radio or TV devices. To access the rtl-sdr dongle and blacklist the included drivers, we create a blacklist-dvb-t.conf file and include the command to blacklist the drivers.

nano blacklist-dvb-t.conf 
# type the following lines inside nano

blacklist dvb_usb_rtl28xxu 
blacklist rtl2832 
blacklist rtl2830 

CTRL-x and press y to save the file

After, creating the file we need to move the file in the /etc/modprobe.d/

sudo mv blacklist-dvb-t.conf /etc/modprobe.d/

Next step is to install the required packages

sudo apt-get install git-core git cmake build-essential libusb-1.0-0-dev

After installing required package we can clone the rtl-sdr repository and build the driver from the source as follows:

# clone the rtl-sdr repository
git clone https://github.com/osmocom/rtl-sdr.git

# get into the rtl-sdr folder
cd rtl-sdr/

# make build folder 
mkdir build/

# get into the build folder
cd build/

# enable configuration option
cmake ../ -DINSTALL_UDEV_RULES=ON

# make
make

# build dependencies and install them 
sudo make install

# reload configuration
sudo ldconfig

# switch to home folder
cd --

# copy rtl-sdr.rules to the /etc/udev folder
sudo cp ./rtl-sdr/rtl-sdr.rules /etc/udev/rules.d/

# reboot the system
sudo reboot 

# test the device
rtl_test

Once the system is rebooted, plugin the rtl-sdl stick in the USB port and type in the above command to test the device. The device is configured successfully if the command's (rtl_test) output is similar to the one below: 

Found 1 device(s):
  0:  Realtek, RTL2838UHIDIR, SN: 00000001

Using device 0: Generic RTL2832U OEM
Found Fitipower FC0012 tuner
Supported gain values (5): -9.9 -4.0 7.1 17.9 19.2 
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...

CTRL-X to close

Finally, the rtl-sdr drive is installed and the device is ready to use. In the next post, I will update on installing the software to scan the radio signals.