APRS with an RTL-SDR & Xastir

Special Thanks go out to the authors of the following two blog posts without whom I would have had to have done most of this work by myself:

This post is mostly taking details from the above two sites, and merging them into a single, easy for me to find set of notes on how to get Xastir working with the RTL-SDR on a Debian/Ubuntu based Linux system. This will serve as the foundation of a future version that will be deployed on a Raspberry Pi3-B, configured with a 7″ screen, and installed in my truck for mobile APRS tracking.

Here’s a good screen capture of my Xastir map after running for about an hour.
Xastir Map

Blacklist Drivers:

cat << _EOF_ > /etc/modprobe.d/blacklist-rtlsdr.conf
blacklist dvb_usb_rtl28xxu
blacklist dvb_usb_v2
blacklist rtl_2830
blacklist rtl_2832
blacklist r820t
_EOF_

Install DVB-T dongle:

cd ~/src
sudo apt-get install git build-essential cmake libusb-1.0-0-dev
git clone git://git.osmocom.org/rtl-sdr.git
cd rtl-sdr
mkdir build
cd build
cmake ../ -DDETACH_KERNEL_DRIVER=ON -DEINSTALL_UDEV_RULES=ON
make
sudo make install
sudo ldconfig

Install MultiMon-ng Encoder/Decoder:
While your system is likely to have “multimon” in the software repo, you will need multimon-ng

cd ~/src
sudo apt-get install qt4-qmake libpulse-dev libx11-dev patch pulseaudio
git clone https://github.com/EliasOenal/multimonNG.git
cd multimonNG
mkdir build
cd build
qmake-qt4 ../multimon-ng.pro
make
sudo make install

Install RTL-SDR Kalibrate tool:

cd ~/src
sudo apt-get install libtool autoconf automake libfftw3-dev
git clone https://github.com/asdil12/kalibrate-rtl.git
cd kalibrate-rtl
./bootstrap
./configure
make
sudo make install

Run the Kalibrate tool (Take note of the PPM)
For me Channel 1 was the strongest. (In step 2, use the strongest channel)

kal -s GSM900
kal -c 1

Test APRS Reception:
The PPM value from the above step was about 50, so that’s the value I’m using

rtl_fm -f 144390000 -s 22050 -p 50 -g 42.0 - |multimon-ng -a AFSK1200 -A -t raw -

If everything is working, you should see output similar to the following:

w9zeb@aprsstation:~/$ sudo rtl_fm -f 144390000 -s 22050 -p 50 -g 42.0 - |multimon-ng -a AFSK1200 -A -t raw -
multimon-ng (C) 1996/1997 by Tom Sailer HB9JNX/AE4WA
(C) 2012-2014 by Elias Oenal
available demodulators: POCSAG512 POCSAG1200 POCSAG2400 FLEX EAS UFSK1200 CLIPFSK FMSFSK AFSK1200 AFSK2400 AFSK2400_2 AFSK2400_3 HAPN4800 FSK9600 DTMF ZVEI1 ZVEI2 ZVEI3 DZVEI PZVEI EEA EIA CCIR MORSE_CW DUMPCSV SCOPE
Enabled demodulators: AFSK1200
Found 1 device(s):
0: Generic, RTL2832U, SN: 77771111153705700

Using device 0: Generic RTL2832U
Found Rafael Micro R820T tuner
Tuner gain set to 42.10 dB.
Tuner error set to 50 ppm.
Tuned to 144643575 Hz.
Oversampling input by: 46x.
Oversampling output by: 1x.
Buffer size: 8.08ms
Exact sample rate is: 1014300.020041 Hz
Sampling at 1014300 S/s.
Output at 22050 Hz.
APRS: KF5JZT-2>S0QX8V,K5GJ*,WIDE1*,LAGRNG*,WIDE2*:`}Fl"vR/'"6!}|*A%,'s|!wnz!|3
APRS: W5ROX-3>APOT30,AUSWST*,WIDE1*,WIDE2-1:!3034.44N/09724.99W_009/000g000t079p000h70b10169T2WX
APRS: W5ROX-3>APOT30,AUSWST*,WIDE1*,LAGRNG*,WIDE2*:!3034.44N/09724.99W_009/000g000t079p000h70b10169T2WX
APRS: W5MF-7>S0PQ8Q,N5LUY-2*,LAGRNG*,WIDE2*:'{;il ;[/>"48}146.760MHz T103 -060Marty from Houston=
APRS: W5MF-7>S0PQ8Q,N5LUY-2*,AUSWST*,WIDE2*:'{;il ;[/>"48}146.760MHz T103 -060Marty from Houston=
APRS: NK5P-9>RYUQ2T,WA5GC*,WIDE1*,AUSWST*,WIDE2*:`~&xp!,k/`"6v}147.220MHz_%
APRS: KG5DWX-13>APN391,AUSWST*,WIDE2-1:@271617z3025.30N/09740.88W_000/000g000t084r000p000P000h76b10164.DsVP
APRS: KG5DWX-13>APN391,AUSWST*,LAGRNG*,WIDE2*:@271617z3025.30N/09740.88W_000/000g000t084r000p000P000h76b10164.DsVP
APRS: W5OEM-9>APRS,AUSWST*,WIDE1*:> Ver. 02SEP2006 - TCARES ARCHES System Online: www.tcares.org
APRS: KF5DMO>APTT4,AUSWST*,WIDE1*,WIDE2-1:>/TinyTrak4 Alpha

In order to feed the output from multimon-ng into xastir, you will also need the socat command:

sudo apt-get install socat

Now we’re ready to fire up the RTL-SDR, with multimon-ng. We will redirect the output to the network on localhost:14580
Which is where we’ll then point xastir to look for it’s data.

w9zeb@aprsstation:~/$ sudo rtl_fm -f 144390000 -s 22050 -p 50 -g 42.0 - |multimon-ng -a AFSK1200 -A -t raw - | sed -u -r 's/.{6}//' | socat STDIN TCP-LISTEN:14580,reuseaddr,fork

Finally we need to launch xastir, and tell it how to find our APRS data. Launch xastir, and after the intial setup click: Interface –> Interface Control –> Add –> Internet Server Then select “Activate on Startup”
Deselect “Allow Transmitting (Your RTL-SDR is only a receiver afterall)” Set the host to “Localhost” Then click OK.
Finally you will need to select your new Internet server from the list, and click Start, or just click Start All.

Here’s a “Potato Quality” photo of my Thinkpad X201i running Xastir, with a few stations plotted on the map.

Xastir-Thinkpad

There are several Weather stations in the area I can receive directly as well.
Weather Stations

If everything went well, you should start seeing stations appear on your map. Happy APRSing.

APRS with an RTL-SDR – Part 2

In part 2 of my RTL-SDR powered APRS series I’m going to discuss how I configured an IGate using aprx. The first order of business however is getting the RTL-SDR to receive, and decode APRS traffic. The software I used is called multimonNG the installation of this package is pretty straight forward.

# git clone https://github.com/EliasOenal/multimon-ng.git
# cd multimon-ng
# mkdir build
# cd build
# qmake ../multimon-ng.pro
# make
# sudo make install

Once this is complete, we can fire up rtl_fm which we built in the part 1 and by using the Unix Pipe we are going to send the output of the receiver through multimon-ng and then onto the network. The command I’m using to start the receiver is as follows:

# rtl_fm -g 80 -f 144.390M -s 22050|multimon-ng -t raw -a AFSK1200 -f alpha -A /dev/stdin| netcat -l 6666

This opens the receiver and sets the gain to 80, on the North America APRS calling frequency of 144.390mhz, with a sample rate of 22050hz. The output of the reciever is then sent into multimon-ng which uses the AFSK1200 decoder and the -A flag tells it specifically to use the APRS format. Due to some limitations in how multimon-ng works getting the output into something usable requires interacgint with /dev/stdin. If we ended the command there, the decoded APRS packets would be displayed on the terminal for you like the following entries:

lars@bmc ~ $ rtl_fm -g 80 -f 144.390M -s 22050|multimon-ng -t raw -a AFSK1200 -f alpha -A /dev/stdin
multimon-ng  (C) 1996/1997 by Tom Sailer HB9JNX/AE4WA
             (C) 2012-2014 by Elias Oenal
available demodulators: POCSAG512 POCSAG1200 POCSAG2400Found 1 device(s):
 EAS UFSK1200 CLIPFSK FMSFSK AFSK1200 AFSK2400 AFSK2400_2 AFSK2400_3 HAPN4800 FSK9600 DTMF ZVEI1 ZVEI2 ZVEI3 DZVEI PZVEI EEA EIA CCIR MORSE_CW DUMPCSV SCOPE
Enabled demodulators: AFSK1200
  0:  Generic, RTL2832U, SN: 77771111153705700

Using device 0: Generic RTL2832U
Found Rafael Micro R820T tuner
Tuner gain set to 49.60 dB.
Tuned to 144643575 Hz.
Oversampling input by: 46x.
Oversampling output by: 1x.
Buffer size: 8.08ms
Exact sample rate is: 1014300.020041 Hz
Sampling at 1014300 S/s.
Output at 22050 Hz.
APRS: W2MN-9>S0RY7V,W5OEM-12*,WD5IYT-2*,WIDE2-1:`}Nbl7'v/"77}
APRS: WD5IYT-2>APNU19:!3019.41NS09748.12W#PHG9550 APRS DIGI UIDIGI 1.9b3 Austin b1
APRS: KF5DMO>SPQU6V,WD5IYT-2*,WIDE1*,WIDE2-1:`}JWl //"5]}/TinyTrak4 Alpha

The last three lines in the above block are actual APRS packets received by the RTL-SDR, decoded by multimon-ng, and displayed on the terminal. This is fun but ultimately I want to push those messages into the APRS network. For this I need to add an IGate like aprx. Installing aprx is much like everything else we’ve done so far.

# git clone https://github.com/PhirePhly/aprx.git
# cd aprx
# ./configure
# make clean
# make
# sudo make install

Next we need to configure aprx. For this edit /etc/aprx.conf. The file is well commented, and should be pretty straight forward. In my case, I set the following fields:

  • mycall
  • myloc
  • passcode
  • server
  • filter

Then in the section I set aprx up to use a TCP socket.

<interface>
tcp-device      localhost 6666 TNC2
</interface>

From this point we need to adjust the line we used to start the receiver, as aprx is listening to a network socket, and not looking at a terminal for packets. So we go back to our initial command and pipe the output from /dev/stdin into netcat and are left with the following:

# rtl_fm -g 80 -f 144.390M -s 22050|multimon-ng -t raw -a AFSK1200 -f alpha -A /dev/stdin| netcat -l 6666

Finally we start aprx

# aprx

And if we want to see the packets as they come in we can tail the aprx-rf.log

lars@bmc ~ $ tail -f /var/log/aprx/aprx-rf.log
2014-12-11 03:59:48.152 APRSIS    R W5ROX-3>APOT30,WIDE1-1,WIDE2-1,qAR,W5ROX:!3034.44N/09724.99W_081/001g002t060p000h78b10196T2WX
2014-12-11 04:00:04.576 APRSIS    R KF5RLL-2>APRX28,TCPIP*,qAC,T2TAS:!3032.53N/09735.37WxPHG0000 Hutto,TX - TX/RX-IGate - Linux/Aprx-2.08 - Uptime 108(hrs)
2014-12-11 04:00:05.848 APRSIS    R kc5wxt>APRS,TCPIP*,qAC,THIRD:@110400z3006.00N/09718.00W_163/001g006t061r000P002h87b10202
2014-12-11 04:00:20.635 APRSIS    R KC5AFM-1>APZAFM,TCPIP*,qAC,FIRST:!3031.57NI09747.27W#Cedar Park Digi Tx-iGate
2014-12-11 04:00:23.406 APRSIS    R KC5AFM-9>APOTU0,WIDE1-1,WIDE2-1,qAR,AE5UM:!3032.07N/09749.74W>070/029/A=000966 13.6V
2014-12-11 04:00:23.624 APRSIS    R KC5AFM-9>APOTU0,WIDE1-1,WIDE2-1,qAR,KF5RLL-2:!3032.07N/09749.74W>070/029/A=000966 13.6V
2014-12-11 04:00:26.710 APRSIS    R KE5RCS-A>APJI23,TCPIP*,qAC,KE5RCS-AS:!3044.65ND09736.13W&RNG0010 1.2 Voice 1293.2000 -20 MHz
2014-12-11 04:00:26.824 APRSIS    R KE5RCS-C>APJI23,TCPIP*,qAC,KE5RCS-CS:!3044.65ND09736.13W&RNG0035 2m Voice 145.130 -0.600 MHz
2014-12-11 04:00:26.824 APRSIS    R KE5RCS-B>APJI23,TCPIP*,qAC,KE5RCS-BS:!3044.65ND09736.13W&RNG0035 440 Voice 440.575 +5.00 MHz
2014-12-11 04:00:30.812 APRSIS    R WB5FMZ-1>APRS,WIDE2-2,qAR,KC5AFM-1:@000001z3032.06N/09745.43W_110/000g000t056r000P001h93b10212/ 15171,12.1V73F45%,F=0,V053105 LOC

That’s it for now.

73!

APRS with an RTL-SDR – Part1

Recently I purchased a RTL-SDR to play with. These are dirt cheap on Amazon or Ebay usually to the tune of $10 or less shipped to your door. I had a few different ideas of how I would use this, but first on my list was to build an APRS receiver & decoder.

First I had to figure out how to get my RTL-SDR working on Linux. First we need to install a bunch of pre-requisite packages on our Debian/Ubuntu system.

# sudo apt-get install doxygen doxygen-gui doxygen-latex doxygen-dbg doxygen-doc gnuradio-dev gnuradio libgnuradio* libboost-all-dev libusb-1.0-0-dev libusb-1.0-0 gnuradio build-essential cmake mono-complete monodevelop libportaudio2 fftw3-dev

Next we need to download and install the rtl-sdr drivers. Please follow This Link for more information.

After installing the drivers, we need to patch gnu-radio. Please follow This Link for more information.

Next we need to blacklist the standard dvb_usb_rtl28xxu kernel module. Run the following command:

# sudo echo "blacklist dvb_usb_rtl28xxu" >> /etc/modprobe.d/blacklist.conf

Next we need to install kalibrate. Kalibrate is a tool used to calibrate the RTL-SDR using GSM towers in the 900mhz band.

# git clone https://github.com/steve-m/kalibrate-rtl cd kalibrate-rtl
# ./bootstrap && CXXFLAGS='-W -Wall -O3'
# ./configure
# make
# sudo make install

Finally, I installed SDR # which isn’t technically necessary for APRS decoding, but it is a fun way to play with the RTL-SDR that doesn’t requiring doing a lot of hacking in Gnu-Radio.

I’m going to wrap up Part 1 here. This should get you to a working state with your RTL-SDR. In Part 2 I’ll go into getting the Ham Radio side of the software configured.

That’s all for now.

73!