How to calibrate the RTL-SDR dongle for use with an APRS RX only iGate

I didn’t feel it was worth mentioning this as part of my original build document because the dongle I recommend seems to be pretty accurate out of the box.  However, it’s worth remembering that every RTL-SDR dongle will have a small frequency error due to mass production and the fact that they’re probably not tested for any kind of accuracy before they’re sold.

This frequency error is constant across the whole frequency range and it’s possible to adjust for the error by entering an offset value in PPM (parts per million) when running the APRS iGate software.

There’s a very simple way to determine what the offset value should be using a utility that’s already installed on your Raspberry Pi as part of the initial install.

Log into your Raspberry Pi and reboot it.

sudo reboot now

After it’s rebooted, you need to run this command before the minute ticks over otherwise cron will start your gateway and take control of the RTL dongle.

rtl_test -p

Leave this running for a while until the figure settles down.

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

Using device 0: Generic RTL2832U OEM
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
[R82XX] PLL not locked!
Sampling at 2048000 S/s.
Reporting PPM error measurement every 10 seconds...
Press ^C after a few minutes.
Reading samples in async mode...
lost at least 180 bytes
real sample rate: 2048000 current PPM: 0 cumulative PPM: 0
real sample rate: 2047994 current PPM: -3 cumulative PPM: -1
real sample rate: 2047951 current PPM: -24 cumulative PPM: -9
real sample rate: 2048067 current PPM: 33 cumulative PPM: 2
real sample rate: 2047986 current PPM: -7 cumulative PPM: 0
real sample rate: 2048013 current PPM: 7 cumulative PPM: 1
real sample rate: 2047947 current PPM: -26 cumulative PPM: -3
real sample rate: 2048034 current PPM: 17 cumulative PPM: 0
real sample rate: 2047986 current PPM: -6 cumulative PPM: -1
real sample rate: 2048020 current PPM: 10 cumulative PPM: 0
real sample rate: 2047956 current PPM: -21 cumulative PPM: -2
real sample rate: 2048006 current PPM: 3 cumulative PPM: -1
real sample rate: 2048002 current PPM: 1 cumulative PPM: -1
real sample rate: 2048016 current PPM: 8 cumulative PPM: 0
real sample rate: 2047983 current PPM: -8 cumulative PPM: -1
real sample rate: 2048009 current PPM: 5 cumulative PPM: -1
real sample rate: 2047950 current PPM: -24 cumulative PPM: -2
real sample rate: 2047993 current PPM: -3 cumulative PPM: -1
real sample rate: 2047943 current PPM: -28 cumulative PPM: -2
real sample rate: 2048039 current PPM: 20 cumulative PPM: -1
real sample rate: 2047979 current PPM: -10 cumulative PPM: -1
real sample rate: 2048028 current PPM: 14 cumulative PPM: -1
real sample rate: 2047958 current PPM: -20 cumulative PPM: -1
real sample rate: 2048046 current PPM: 22 cumulative PPM: -1
^CSignal caught, exiting!

User cancel, exiting...
Samples per million lost (minimum): 0

(I left this running for about twenty minutes but have chopped a lot of the lines out)

In my case, I take this to be an average of -1 which is not very much at all.
You now need to edit the appropriate configuration file to reflect this PPM correction.

sudo nano -c dw-start.sh
Scroll down to line 79 and you’ll see a line starting with DWCMD="bash"

Edit this line so that directly after the frequency, you add -p x where x is the figure you obtained from the calibration routine.
My entire line looks like this
DWCMD="bash -c 'rtl_fm -f 144.80M -p 1 - | direwolf -c sdr.conf -r 24000 -D 1 -'"

Save the file by pressing ctrl-x, then hit the Y key and then press enter.

Reboot.

sudo reboot now

You’re done – You’ve found a calibration figure and that’s being passed to the software.

Click here to return to the original article.

Comments are closed.