Linux SDR APRS IGate setup

Ok… Firstly, there are many guides to doing this already on the internet, but most of the use a Raspberry Pi. I’m not using one, for reasons that will be made clear later.

Secondly, I couldn’t find any one of the guides that did exactly what we wanted.

Before you read all this rubbish, it is important that to use it you will need an Amateur Radio License and Callsign, and and APRS-IS Passcode. If you don’t have them, then go and get them before continuing.

So, with that in mind…

So, this is just for receiving the APRS signals on the 2M band in the UK, for either forwarding on via t’internet, of just looking at locally.

What are we going to need, and what stages do we go through?

1. Have a Linux machine

In this case, rather that using a Pi, I’m going to use one of my 19″ rack machines – a repurposed Barracuda 300 Spam Firewall Appliance.

I bought it off eBay for about £20.00 a fair few years ago. I has an AMD64 LE1300 processor, 2GB of memory, about 6TB of storage, and currently runs Ubuntu 16.04.7 LTS. It runs as my main fileserver and hosts a couple of virtual machines.

I’m not using a Pi as I’ve tried 5 Pi (of 3 types) with this and had many issues with power. I’ve used the approved PSU, but still had them drop the SDR at random.

2. Get a Software Defined Radio USB Stick

I’m using an old one I bought in 2014. The closest to it is availble from this link. I rattled on about it in another post. Don’t get that, get a better one! I can’t recommend one, as I haven’t got one that I like. Yet.

3. Download the Software

You’ll need two bits of sortware, RTL-SDR and Direwolf.

RTL-SDR talks to the USB Radio. Clearly this is important. It was already installed on my system, but as I’ve been mucking about with this for so long that I can’t remember if I had installed it or not, here is how you do it (as root):

# apt-get install rtl-sdr
Reading package lists... Done
Building dependency tree
Reading state information... Done
rtl-sdr is already the newest version (0.5.3-5).
rtl-sdr set to manually installed.
0 to upgrade, 0 to newly install, 0 to remove and 5 not to upgrade.
#

Direwolf doesn’t the rest.

# apt-get remove gpsd direwolf direwolf-docs
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'direwolf' is not installed, so not removed
Package 'direwolf-docs' is not installed, so not removed
Package 'gpsd' is not installed, so not removed
0 to upgrade, 0 to newly install, 0 to remove and 5 not to upgrade.
root@blackfin:/media/Entertainment/incoming/sort/video# apt-get install direwolfReading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
direwolf-docs
Suggested packages:
gpsd
The following NEW packages will be installed
direwolf direwolf-docs
0 to upgrade, 2 to newly install, 0 to remove and 5 not to upgrade.
Need to get 0 B/7,863 kB of archives.
After this operation, 8,574 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Selecting previously unselected package direwolf-docs.
(Reading database ... 410557 files and directories currently installed.)
Preparing to unpack .../direwolf-docs_1.2-2build1_all.deb ...
Unpacking direwolf-docs (1.2-2build1) ...
Selecting previously unselected package direwolf.
Preparing to unpack .../direwolf_1.2-2build1_amd64.deb ...
Unpacking direwolf (1.2-2build1) ...
Processing triggers for doc-base (0.10.7) ...
Processing 1 added doc-base file...
Processing triggers for desktop-file-utils (0.22-1ubuntu5.2) ...
Processing triggers for gnome-menus (3.13.3-6ubuntu3.1) ...
Processing triggers for mime-support (3.59ubuntu1) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up direwolf-docs (1.2-2build1) ...
Setting up direwolf (1.2-2build1) ...
#
4. Test the installation

First, make sure the system can see the SDR:

# lsusb
Bus 001 Device 002: ID 0bda:2838 Realtek Semiconductor Corp. RTL2838 DVB-T
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
#

Well that’s good. This is where the Pi attempts failed.  0bda:2838 Realtek Semiconductor Corp. RTL2838 DVB-T is what we were looking for. It is probably a good idea to run rtl_test now.

# rtl_test
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.

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...
^CSignal caught, exiting!

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

Hit Control-C to exit it.

So, the interface seems to work.

5. Configure the Software

If you want to create a used just to deal with the APRS stuff, you can do.

# adduser aprs
Adding user `aprs' ...
Adding new group `aprs' (1007) ...
Adding new user `aprs' (1007) with group `aprs' ...
Creating home directory `/home/aprs' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for aprs
Enter the new value, or press ENTER for the default
Full Name []: APRS IGate
Room Number []:
Work Phone []:
Home Phone []:
Other []:
Is the information correct? [Y/n] Y
#

Back out of root, and back as a normal user (with a $ prompt not #), you’ll need a config file in the home directory of the user which will run the IGate. So, back in the Home directory of either your general user name, or your newly created aprs user (whichever you intend to use), you will need a config file.

You’ll also need an Amateur Radio Callsign, and APRS-IS passcode (like I said at the start!)

So imagine your callsign is M7QQQ and your passcode is 12345, your need to make a file in your home directory call sdr.conf that looks like this:

ADEVICE null null
CHANNEL 0
MYCALL M7QQQ-10
IGSERVER euro.aprs2.net
IGLOGIN M7QQQ-10 12345

The -10 suffix to the Callsign is suggested for IGates.

You should now have a working receive only IGate.

6. Running the software

So, here we go. As 144.800 is the APRS frequency used in the UK…

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

If it works, all well and good. Mine didn’t, and I assumed that the SDR was off frequency. It was.

I knew that there were APRS squeaks being broadcast locally, as I had my Baofeng hooked up to my shed antenna, and could hear them on that. Very loudly.

Luckily you can find out how far off-frequncy your SDR tuning is using rtl_test. So…

$ rtl_test -p
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...
real sample rate: 2048104 current PPM: 51 cumulative PPM: 51
real sample rate: 2048045 current PPM: 22 cumulative PPM: 36
real sample rate: 2048069 current PPM: 34 cumulative PPM: 35
real sample rate: 2048044 current PPM: 22 cumulative PPM: 32
real sample rate: 2048069 current PPM: 34 cumulative PPM: 32

Leave it running for a while…

real sample rate: 2048056 current PPM: 28 cumulative PPM: 21
real sample rate: 2048033 current PPM: 16 cumulative PPM: 21
real sample rate: 2048054 current PPM: 27 cumulative PPM: 21
real sample rate: 2048055 current PPM: 27 cumulative PPM: 21
real sample rate: 2048032 current PPM: 16 cumulative PPM: 21
real sample rate: 2048057 current PPM: 28 cumulative PPM: 21
real sample rate: 2048059 current PPM: 29 cumulative PPM: 21
real sample rate: 2048054 current PPM: 27 cumulative PPM: 21
real sample rate: 2048030 current PPM: 15 cumulative PPM: 21
real sample rate: 2048054 current PPM: 27 cumulative PPM: 21
real sample rate: 2048056 current PPM: 28 cumulative PPM: 21
^CSignal caught, exiting!

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

Eventually you’ll get a Cumulative/Average PPM. Mine here is 21.

To make things easy, I created a start up script (startigate) for the IGate, which just contains one line:

rtl_fm -f 144.8M -p 21 - | direwolf -c sdr.conf -r 24000 -D 1 -t 0 -

The changes from the command line, above, are the additions of:

-p 21  - which just tells it how much to adjust for the PPM offset
-t 0 - tells it not to muck about with my terminal colour settings

So now, running it and having it actually work:

$ ./startigate 
Dire Wolf version 1.2
Audio input device for receive: stdin  (channel 0)
Audio out device for transmit: null  (channel 0)
Found 1 device(s):
Channel 0: 1200 baud, AFSK 1200 & 2200 Hz, E+, 24000 sample rate.
Note: PTT not configured for channel 0. (Ignore this if using VOX.)
Use -p command line option to enable KISS pseudo terminal.
Ready to accept KISS client application on port 8001 ...
Ready to accept AGW client application 0 on port 8000 ...
  0:  Realtek, RTL2838UHIDIR, SN: 00000001

Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Tuner gain set to automatic.
Tuner error set to 21 ppm.
Tuned to 145052000 Hz.
Oversampling input by: 42x.
Oversampling output by: 1x.
Buffer size: 8.13ms
Exact sample rate is: 1008000.009613 Hz
Sampling at 1008000 S/s.
Output at 24000 Hz.

Now connected to IGate server euro.aprs2.net (85.90.180.26)
Check server status here http://85.90.180.26:14501

[ig] # aprsc 2.1.4-g408ed49<0x0d><0x0a>
[ig] # logresp M7TXB-10 verified, server T2CSNGRAD<0x0d><0x0a>

M7TXB audio level = 37(17/17)   [NONE]   ||||||___
[0.2] M7TXB>APWW11,WIDE1-1,WIDE2-1:@205809h5247.53N/00207.41W-Total newbie at this!
Position with time, House, APRSISCE win32 version
N 52 47.5300, W 002 07.4100
Total newbie at this!

M7TXB audio level = 37(17/17)   [NONE]   ||||||___
[0.2] M7TXB>APWW11,WIDE1-1,WIDE2-1:@205902h5247.53N/00207.41W-Total newbie at this!
Position with time, House, APRSISCE win32 version
N 52 47.5300, W 002 07.4100
Total newbie at this!

^C
QRT
Signal caught, exiting!

User cancel, exiting...

End of file on stdin.  Exiting.
 ]0;aprs@blackfin: ~ aprs@blackfin:~$

So, it is up and running and receiving!

I broadcast this from my laptop running Direwolf/APRSIS32 through my Baofeng as a test:

M7TXB audio level = 37(17/17)   [NONE]   ||||||___
[0.2] M7TXB>APWW11,WIDE1-1,WIDE2-1:@205809h5247.53N/00207.41W-Total newbie at this!
Position with time, House, APRSISCE win32 version
N 52 47.5300, W 002 07.4100
Total newbie at this!

And it was received on the SDR (ok, they are only about 20 feet apart, but still its a valid test. And to proove that it updates APRS.FI:

I’m not picking up other squeaks that the main radio does, but that is because I’m still running on the crap stick that came with the SDR. Building an antenna for the SDR is my next project.

Still you can see the status and logs of the IGate here!

2 thoughts on “Linux SDR APRS IGate setup”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.