Raspberry Pi RTL-SDR Dongle (Thermal drift) APRS RX only iGate Direwolf

In continuation with the APRS iGate experiments, next on the list was an iGate on raspberrypi with a RTL-SDR dongle eliminating the need of an HT and soundcard.

Required:
Rapberrypi 1 connected to internet
RTL-SDR Dongle
download g6nhu custom built Raspberry Pi image (from https://sourceforge.net/projects/amateur-radio-aprs-igate/files/)
pigtail to connect RTL to an pl-259




Lets get busy:


g6nhu custom built Raspberry Pi image is a 1.6Gb file which will expand to approximately 4Gb when you decompress it.  Unzip it and write it to an SD card.  You don’t need a high capacity SD card, this image will fit on a 4Gb card and work perfectly

connect the RTL-dongle and network to raspberry and boot it up. You would need to know what your internet gateway has assigned the RPI IP over DHCP by logging into the gateway and looking at the DHCP table. SSH to the ip using putty (can be downloaded form internet for free) and login to the RPI using user pi and password raspberry.

I have experienced that when direwolf was run, the following error was encountered

Signal caught, exiting!
User cancel, exiting…
Illegal instruction


to correct this, following procedure

cd ~
sudo cp sdr.conf sdr.old
git clone https://www.github.com/wb2osz/direwolf
cd ~/direwolf
make
sudo make install
make install-rpi
make install-conf
cd ~


sudo raspi-config

Use the arrow keys again to move down to Localisation Options and press enter.  Use the arrow keys again to select Change Timezone and press enter.  First select your Geographical area and press enter and then select your Time zone and press enter.
You will now be returned to the main Raspberry Pi Software Configuration Tool main screen.  Use the tab key to select <Finish> and press enter.  You will be asked if you would like to reboot now. Press enter to reboot.

cd ~
sudo nano sdr.conf

Scroll down to line eight and change the xxx to your callsign and required SSID.  I use -3 as my SSID so this line reads MYCALL AP2CJ-3.  Please use your own callsign, mine is just shown as an example.
In the section below, edit the line starting with IGSERVER to be the correct one for your region. I’m in Asia so my line reads IGSERVER asia.aprs2.net
Scroll further down and you’ll find a line that starts with IGLOGIN.  Change the xxx to be the same as the callsign you entered above (including SSID) and then change the numbers 123456 to the passcode you obtained from the APRS Passcode Generator.
At the bottom of that file there is one long line that starts with PBEACON.  Replace xx.xxxxxx with your latitude, yyy.yyyyyy with your longitude and zz with your callsign (including SSID).
Save the file by pressing ctrl-x, then hit the Y key and then press enter.
You can now perfom a test using the following command
(144.800 is the APRS frequency, change as required).

 
rtl_fm -f 144.80M - | direwolf -c sdr.conf -r 24000 -D 1 -


you shall see the screen with direwolf loaded, rtl loaded and connected/logged in to aprsis.

Press ctrl-c to exit the test. 


nano dw-start.sh

comment 
#DWCMD="direwolf -a 100"

un-comment out 
DWCMD="bash -c 'rtl_fm -f 144.80M - | direwolf -c sdr.conf -r 24000 -D 1 -'"

save and exit

The last thing to do is to configure the system so that the APRS iGate starts automatically whenever you reboot the Raspberry Pi.  Enter the following command:

crontab -e

Scroll down to the bottom and you will see the following line.
#* * * * * /home/pi/dw-start.sh >/dev/null 2>&1


Delete the # at the start of that line.
Save the file by pressing ctrl-x, then hit the Y key and then press enter.

Reboot your Raspberry Pi and once it’s restarted, it will automatically connect to the APRS network and operate as a receive only iGate. Nothing will be echoed to the display while it’s running like this so you can check your status on aprs.fi by searching for the callsign you entered (including SSID).  You don’t even need to log into the Raspberry Pi, the gateway will start automatically within ninety seconds of rebooting.




IMPROVEMENTS:

Overlay filesystem

One of the best ways to mitigate both these issues is to change the root file system to read-only. This would be fine except for all those files that actually need to be written and modified during the normal execution! There is however a neat solution to this problem – Overlay Filesystem – which is now built into the Linux kernel. This is a slightly complex, but very useful capability which creates essentially a merged filesystem with an “upper” and “lower” layer. In our case, we can set the “lower” layer to be the read-only root filesystem and the “upper” layer to be a RAM-based temporary filesystem to store those files that are changed during operation. When the power is cycled, the system will come up in the state of the “lower” file system which is in a clean state.
The final component needed is somewhere to store persistent data that needs to remain across reboots (such as log files and a small number of other variables).
Fortunately, there are a number of scripts around that simplify the creation of such an environment. For this project, I’ve used one created by Pavel Pisa from Czech Technical University, Prague. Here’s a presentation describing it: init-overlay. Setting this up is fairly straight forward:


$cd /sbin
$sudo wget https://github.com/ppisa/rpi-utils/raw/master/init-overlay/sbin/init-overlay
$sudo wget https://github.com/ppisa/rpi-utils/raw/master/init-overlay/sbin/overlayctl
$sudo chmod +x init-overlay overlayctl
$sudo mkdir /overlay 
$sudo overlayctl install 
$sudo reboot
 
This is all that’s needed! Read the contents of the two scripts to understand what they are doing if you are interested. Once the overlay filesystem is active, you can’t update the underlying base system (as it’s read-only). So when you need to make changes, you need to deactivate the overlay filesystem. This is simply accomplished using the ‘overlayctl’ script:
 
$ sudo overlayctl disable $ sudo reboot

Similarly, it can be re-enabled:
 
$ sudo overlayctl enable $ sudo reboot
 

 
RTL Dongle FREQUENCY DRIFT

The oscillator on the RTL-SDR is prone to thermal drift, which means that as the dongle heats up from use, the frequency you are tuned to may change over time. A TCXO compensates for differences in temperature and thus keeps the frequency stable as the temperature changes. I thoroughly recommend you use a dongle with TCXO as it won’t drift in frequency and you shouldn’t need to do any frequency calibration. Other dongles are available such as this NooElec version from Amazon which is a little cheaper and will arrive quicker or you can search eBay for similar dongles.

low quality 28.8 MHz oscillator above
high quality 28.8 MHz temperature controlled oscillator above
tested the TCXO dongle against a control RTL-SDR which had a standard non-TCXO oscillator. First we measured the PPM offset at room temperature against a known ATIS signal. The TCXO dongle had an offset that was somewhere around 0.5 PPM. The control RTL-SDR had an offset of 60 PPM.As the dongle heats up from use, the oscillator will experience thermal drift, causing the frequency offset to change. The TCXO should be immune to this problem due to it’s temperature compensation circuitry. To test the TCXOs temperature compensation capabilities we placed both dongles in a freezer for 30 minutes and then took them out and recorded their start and end PPM offsets after 30 minutes of operation. To simulate a warm environment the dongles were also placed under a warm tungsten light during operation.
The control RTL-SDR started with an PPM offset of 58 PPM and ended with an offset of 72 PPM, giving a total drift of 14 PPM. The TCXO RTL-SDR dongle started with a PPM offset of ~0.5 PPM and ended with an offset of ~0.5 PPM, giving a total drift of 0 PPM.
Below we have recorded animated GIFs of the drift observed in both dongles. The first GIF shows the control RTL-SDR. Note how the frequency offset oscillates at first and then slowly drifts away in one direction. The TCXO dongle exhibited no drift whatsoever.



 low quality 28.8 MHz oscillator drift above

  high quality 28.8 MHz temperature controlled oscillator

The results of this simple test show that the TCXO used in these modified dongles is an accurate and stable frequency source as was expected
 

NEXT Phase - Cooling the raspberry and RTL for longer duty cycle





Please note – I am not claiming originality for this setup method, I’ve simply followed what’s already available out there on the internet and created an article with my experience based on those instructions for your convenience (http://qso365.co.uk/2017/02/setting-up-an-aprs-rx-only-igate-using-a-raspberry-pi-and-a-pre-built-image/ - https://www.rtl-sdr.com/tag/thermal-drift/)


Comments