When uring an RTL SDR dongle with a graphic SDR application you will probably notice that the dongle is not spot on to the frequency. Especially when using the waterfall view you can see the peek of the signal beside the expected frequency. When using the dongle in a ‘headless’ application this can lead to disappointment or frustration. Because instead of the expected AIS, ADSB or weather balloon signals, nothing will happen at all.

The description below is a manual how to pinpoint how much the RTL SDR dongle is off frequency. When you know the difference this can be used as a correctional parameter in the SDR application. This manual uses a ‘headless’ setup in a Linux environment. The way of working has been successfully used with different dongles and Raspberries.

Make sure to start with the dongle connected to the computer so it can warm up. Changing temperatures will also cause changing frequency offset.

Start by updating the operating system

sudo apt-get update && apt-get -y upgrade

Then install some necessary dependencies

sudo apt-get -y install librtlsdr-dev librtlsdr0 libfftw3-double3 libfftw3-dev libfftw3-bin

Method 1

Install the calibration software

wget https://launchpad.net/~openplotter/+archive/ubuntu/openplotter/+files/kalibrate-rtl_0.4.2.2-stable_armhf.deb

Alternatively the command below can be used

wget https://www.pe2kmv.nl/downloads/kalibrate-rtl_0.4.2.2-stable_armhf.deb

Install the downloaded file with this command

sudo dpkg -i kalibrate-rtl_0.4.2.2-stable_armhf.deb

From here on continue at ‘Finalize’

Method 2

Install dependencies

sudo apt-get install -y libtool fftw3 libfftw3-dev librtlsdr-dev

Download the source code

wget https://github.com/hayguen/kalibrate-rtl/archive/master.zip

Unzip the downloaded file

unzip master.zip && mv kalibrate-rtl-master kalibrate-rtl

When using the Buster distro you’ll probably need to tweak the file librtlsdr.pc as described below

sudo cp  /usr/lib/arm-linux-gnueabihf/pkgconfig/librtlsdr.pc /usr/lib/arm-linux-gnueabihf/pkgconfig/librtlsdr_old.pc

sudo nano /usr/lib/arm-linux-gnueabihf/pkgconfig/librtlsdr.pc

prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib/arm-linux-gnueabihf
includedir=${prefix}/include

Name: RTL-SDR Library
Description: C Utility Library
Version: 0.6.0
Cflags: -I${includedir}/
Libs: -L${libdir} -lrtlsdr
Libs.private:  -lusb-1.0 

Compile the source code

cd kalibrate-rtl
bash bootstrap
bash configure
make
sudo make install

Finalize

Assuming no errors have occurred, check the installation with the help function

kal -h

Now start the scan for a GSM basestation (in this example using the 900 MHz GSM band)

sudo kal -s GSM900

After a while one or more GSM900 basestations will be displayed

pi@raspberry:~ $ kal -s GSM900
Found 1 device(s):
  0:  Generic RTL2832U OEM

Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Exact sample rate is: 270833.002142 Hz
[R82XX] PLL not locked!
kal: Scanning for GSM-900 base stations.
GSM-900:
    chan:   71 (949.2MHz - 18.161kHz)    power:   72067.98
...chan 124
Only one channel was found. This is unlikely and may indicate you need to provide a rough estimate of the initial PPM. It can be provided with the '-e' option. Try tuning against a local FM radio or other known frequency first.

Start the actual calibration toe determine the frequency error in ppm. In the example below calibration has been carried out using channel 71 (of the GSM900 band) as followed from the previous step

pi@raspberry:~ $ kal -c 71
Found 1 device(s):
  0:  Generic RTL2832U OEM

Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Exact sample rate is: 270833.002142 Hz
[R82XX] PLL not locked!
kal: Calculating clock frequency offset.
Using GSM-900 channel 71 (949.2MHz)
Tuned to 949.200000MHz (reported tuner error: 0Hz)
average		[min, max]	(range, stddev)
- 16.738kHz		[-17199, -16322]	(877, 257.376648)
overruns: 0
not found: 387
average absolute error: 17.634 ppm

This calibration shows an error of 17.634 ppm for this specific RTL SDR dongle