Friday, 23 May 2014 12:15

Raspberry Pi + SDR dongle = APRS iGate

Written by 
Rate this item
(2 votes)

Building a receive only iGate using MultimonNG, RTL SDR dongle and a Raspberry Pi

I noticed multimonNG can use an inexpensive RTL SDR dongle (which I have) and decode APRS packets and send them off to the APRS-IS network.

I've been wanting to build some sort of iGate for APRS for some time, and eventually I'd like to include transmit capabilities possibly using a cheap Baofung UV-5R, but doing some research the multimonNG software caught my eye.

 

Here's what hardware you'll need

  • Raspberry Pi
  • SD Card (for the pi) I'm using 8GB but 4GB will do
  • RTL SDR dongle
  • Powered USB hub
  • USB WiFi adapter (optional)

I will probably end up building something with a hardware TNC (possibly a tinytrak), APRX/Dire Wolf software, Openwrt capable device (small Alfa routers I have) and a radio capable of transmitting as well (Baofung), but I figured this SDR receive only version won't take too long to put together.  Plus in using this SDR dongle I'll be able to set it up as a satGate at the same time as well (awesome!).  See comments below, I was unable to use my dongle for both 144.39 and 145.825 for satellites, but it does work fine on 144.39!  I'm not sure why because it appears other people have got it working (or so they say on their website)

It has been several years since I have used a soundcard to decode data (POSCAG, MDT, ESN data) and back then it was not as reliable as a hardware 4 layer data slicer), but I believe it is more robust now, well robust enough at least for 1200bps APRS packets.  We'll see once I get this decoding to how well it does.

Most of the info here I referenced from http://www.kubonweb.de/?p=130 but added/removed/edited items as I went along and built this.

 

Setting up the Raspberry Pi

Download the Rasbian Debian Wheezy image http://www.raspberrypi.org/downloads/

Write the image to your SD card (Instructions can be found here http://algissalys.com/how-to/how-to-write-a-raspberry-pi-image-to-an-sd-card-in-windows)

Bootup the Pi with the new SD Card image

First time you boot you will come to a setup screen

Select Expand File system then Finish, the pi will reboot

Login to your Pi

Login:  pi

Password: raspberry

Setup your USB wifi adapter (optional), detailed instructions can be found here http://www.algissalys.com/how-to/how-to-raspberry-pi-multiple-wifi-setup-through-the-command-line

Be sure you have internet connectivity, then update the pi

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo rpi-update
sudo reboot

remove Pulse audio

sudo apt-get remove --purge pulseaudio
sudo apt-get autoremove
rm -rf /home/pi/.asoundrc /home/pi/.pulse
sudo reboot

 

 

Installing the RTL software

Edit /etc/modprobe.d/raspi-blacklist.conf

sudo nano /etc/modprobe.d/raspi-blacklist.conf

Add the following lines to the end of the file so the OS does not load the default drivers for the dongle

blacklist dvb_usb_rtl28xxu
blacklist rtl_2832
blacklist rtl_2830

Reboot

sudo reboot

Create a directory for the new RTL software

mkdir ~/rtl

Install new rtl driver and software

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

Install Sox (this will help further test and troubleshoot the SDR RTL dongle)

sudo apt-get install sox

 

 

Test the RTL Dongle

Connect the SDR RTL dongle to the powered USB hub (the Raspberry Pi may not put out enough current for the dongle to operate correctly).  I have tested two different dongles

  • Terratec TStick

I don't recall where I bought this, F connector PAL connector so the antenna can easily be added.  Shows up as Realtek, RTL2838UHIDIR, SN: 00000001 Elonics E4000 tuner

  • Nooelec Newsky TV28T v2 USB DVB-T & RTL-SDR Receiver

Bought from ebay a while ago, antenna connection is an MCX so it will be difficult to add better antenna without mod.  Shows up as Realtek, RTL2838UHIDIR, SN: 00000008 Rafael Micro R820T tuner

Randomly tuning around, I could not tell if one is more sensitive than the other, if I had to guess I would say the Terratec is a little more sensitive, but it may be the slightly larger antenna.

After setting up the decoding process below, I was not able to reliably decode using the Nooelec dongle, maybe I overloaded it, maybe it's a lemon, Terratec is the winner for data.

 

Test the dongle (you should get everything is OK and start sampling)

rtl_test

You should be able to tune the dongle and hear audio (the stock antenna is horrible on these dongles, you may not hear many frequencies with the stock antenna)

FM radio (change the 93.1M frequency to a strong local frequency in your area)

rtl_fm -M wbfm -f 93.1M | play -r 32k -t raw -e s -b 16 -c 1 -V1 -

US APRS frequency (with the stock antenna, I was not able to hear local beacons, but I did hear my HT 5' away :) )

rtl_fm -M fm -f 144.390M | play -r 24k -t raw -e s -b 16 -c 1 -V1 -

NOAA Weather (again find a frequency in your area)

rtl_fm -M fm -f 162.500M | play -r 24k -t raw -e s -b 16 -c 1 -V1 -

 

 

Install Kalibrate-RTL

This will allow you to fine tune your SDR RTL dongle.  These cheap dongles all have a little bit of frequency offset and by using kalibrate it will allow you to adjust that offset when using rtl_fm and other software.

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

Scan GSM base stations to find a strong channel (frequency) - GSM900 worked in my area, yu may have to try other bands depending on your location, run kal without and parameters to see whats available.

kal -s GSM900

 

Kal located channel 7 in my area.  Now we use this channel to calculate the ppm offset of the dongle.

kal -c 7 -v

My result was 2.306 ppm (round to 2 for usage below).  Remember this number as you will need it when running rtl_fm later.  Some documents suggest using the -e flag along with a guessed error correction when running kal, I was not able to get this to work and without appeared to work correctly.  This may depend on the dongle.

 

 

Install multimonNG decoder

 

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

 

***Update 20170424

I received an email from someone who had issues using "qmake" and he was kind enough to provide the following instructions: 

I followed your instructions to the
letter using a rpi 3 and on Raspbian Jessie 2017-04-10
build. I found that multimon-NG.pro would not install via
qmake ../multimon-ng.pro command. It would return the
error:
'qmake: could not find a Qt
installation of ''  '

I fixed this by going to the
~/rtl/multimonNG folder and running
'$ cmake ./'

Followed by
'make'

***

 

You can now test and decode APRS packets, with the stock antenna I was not able to pick up any remote beacons, I only saw what I sent out using my APRS enabled HT at close range

rtl_fm -f 144.390M -s 22050 - | multimon-ng -a AFSK1200 -A -t raw -

 

 

Install the python APRS igate software

cd ~/rtl
sudo apt-get install python-pkg-resources
git clone https://github.com/asdil12/pymultimonaprs.git
cd pymultimonaprs

Enable to receive ASTARS satellite traffic as well on 145.825

Copy and Edit pymultimonaprs/multimon.py

cp ~/rtl/pymultimonaprs/pymultimonaprs/multimon.py ~/rtl/pymultimonaprs/pymultimonaprs/multimon.old
nano ~/rtl/pymultimonaprs/pymultimonaprs/multimon.py

and change line 32-35 to

proc_src = subprocess.Popen(
    ['rtl_fm', '-f', str(int(self.config['rtl']['freq'] * 1e6)), '-f', '145825000', '-s', '22050',
    '-p', str(self.config['rtl']['ppm']), '-g', str(self.config['rtl']['gain']), '-l', '10', '-'],
    stdout=subprocess.PIPE, stderr=open('/dev/null')

I was unable to scan both 144.39 and 145.825 and decode the packets reliably.  I was first testing by

rtl_fm -f 144.390M -f 145.825M -s 22050 -p 2 -g 42 -l 10 - | multimon-ng -a AFSK1200 -A -t raw -

and when I didn't see it decoding properly, I tried

rtl_fm -M fm -f 144.390M -f 145.825M -s 24k -p 2 -g 42 -l 10 | play -r 24k -t raw -e s -b 16 -c 1 -V1 -

I heard some data in 144.39 but almost none at all on 145.825, I messed with -l setting as well as -g, and I was not able to get it to work.  Maybe varies per dongle?  I will experiment some more at a later date.

 

Build the APRS software

sudo python setup.py build
sudo python setup.py install

Generate an APRS password needed to send traffic to the APRS-IS network (replace yourcallsign with your real callsign)

cd ~/rtl/pymultimonaprs
./keygen.py yourcallsignKey for yourcallsign: xxxxxx

Make a copy and then Edit /etc/pymultimonaprs.json (Callsign, Passcode, Gateway, Lat/Lng)

You can find your Tier2 gateway here http://www.aprs2.net/.  You can get your Lat/Lng from http://www.latlong.net/convert-address-to-lat-long.html

**Make sure to edit the proper frequency in pymultimonaprs.json

sudo cp /etc/pymultimonaprs.json /etc/pymultimonaprs.old
sudo nano /etc/pymultimonaprs.json

Testing multimonNG and rtl_fm with the new ppm -p setting you found using kal and manual gain -g (run rtl_test to see what gain settings are available with your dongle, gain settings may needs to be tweaked)

rtl_fm -f 144.390M -s 22050 -p 2 -g 42.0 - | multimon-ng -a AFSK1200 -A -t raw -

Testing the APRS iGate software

sudo pymultimonaprs

If everything is running correctly you should be able to goto http://aprs.fi and search for your callsign and see your igate on the map!

Create startup script

sudo nano /etc/init.d/pymultimonaprs

and paste in

#!/bin/sh
### BEGIN INIT INFO
# Provides: pymultimonaprs
# Required-Start: $all
# Required-Stop: $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start/stop of pymultimonaprs
### END INIT INFO
case "$1" in
 start)
   sudo pymultimonaprs --syslog &
   ;;
 stop)
   sudo killall pymultimonaprs
   ;;
 *)
   echo "Usage: /etc/init.d/pymultimonaprs {start|stop}"
   exit 1
   ;;
esac
exit 0

Enable script

sudo chmod +x /etc/init.d/pymultimonaprs
sudo update-rc.d pymultimonaprs defaults

Start

sudo /etc/init.d/pymultimonaprs start

Done!

 

References:

http://home.comcast.net/~wb2osz/site/

http://www.kubonweb.de/?p=130

http://kmkeen.com/rtl-demod-guide/index.html

 

Read 64055 times Last modified on Monday, 24 April 2017 14:36
Algis Salys

Creator and owner of algissalys.com.  Linux enthusiast, electronics tinkerer, and likes to spend time in the workshop building and creating new projects.