Raspberry Pi APRS Digipeater

From philcrump.co.uk
Jump to: navigation, search

I have set up my Raspberry Pi as an APRS digipeater, previously running as M0DNY-1. Ian, M0IJS has also run his Pi using the scripts below.

The only interface that required is a cheap USB soundcard (for Line-In). I use the Sweex SC010, I tried a very cheap unbranded chinese one from ebay, but had no luck in getting anything sounding like AX.25 out of it! A rig with VOX capability is also needed if you wish to transmit.

The Linux Kernel soundmodem drivers are used to provide an AX.25 interface, and I use the Aprx digipeater/igate software to handle the packets. You will need a Ham Radio license to set this up, as even packets you just send to the internet can be re-transmitted back over RF through a TX-igate.

The Python scripts at the bottom of the page handle interfacing to gpsd or directly to a USB/UART GPS module, and can output to an aprx beacon file or send a direct UDP APRS-IS beacon packet over the internet. Feel free to adapt them and send back any improvements!

Software

OS

I use the Archlinux ARM OS on Pi, but all the software should be installable on Raspbian with the debian package manager.

To make the setup easier on Arch, it's a good idea to install yaourt (pacman -S yaourt). This will then make the installation of the unsupported packages from the AUR (Arch User Repository) easier, by 'yaourt -AS package'.

For some of the packages, the PKGBUILD may need alteration. Yaourt will prompt you to edit the PKGBUILD during the install. Change the line:

arch=('i686' 'x86_64') ==> arch=('i686' 'x86_64' 'armv6h')

TNC

The Raspberry Pi Kernel comes with an AX.25 soundcard modem built in. A userspace program, soundmodem, is used to configure the interface. The Line-In and Line-Out of a USB soundcard are then connected to the Rig to provide the data interface.

In order to troubleshoot the AX.25 connection I installed libax25, ax25-utils, ax25-tools as well as soundmodem. All of these can be installed from the AUR with yaourt.

Digipeater

For the Digipeater itself I use the aprx software. This is a very resource-minimal piece of software and I have found it to be very stable (running >9 weeks at a time). It can even perform as a bi-directional igate and/or viscous digipeater.

The software will need to be compiled, you can download the latest version from here. (As of Sep 2012 this should be aprx-2.05.svn485.tar.gz)

Download the .tar.gz, unpack it with tar xzf filename and enter the directory. You can then build the software with ./configure && make clean && make && sudo make install.

Configuration

Soundmodem

You can find my configuration files for the AX.25 ports and soundmodem in my github repository. Please edit these to remove my callsign and replace it with yours.

aprx

The Official Aprx Manual is very useful and easy to understand, with many example configs. I suggest you use this as a starting point.

If you are interested, you can find my config files for aprx also in my github repository. Again please edit these for your callsign and position.

Troubleshooting

If when you start soundmodem you see:

sm[1756]: audio: snd_pcm_writei: File descriptor in bad state
sm[1756]: audio: snd_pcm_writei: File descriptor in bad state
...
sm[1756]: audio: snd_pcm_writei: File descriptor in bad state
sm[1756]: snd_pcm_drain in iotxend: No such device

Check dmesg for: usb 1-1.2: reset full speed USB device number 6 using dwc_otg

This is due to a lack of Power available on the USB, even though the soundcard does not consume much power, it starts up an inverting-voltage-regulator to produce the audio when it is initialised. This pulls enough current to trip the USB fuse on the Pi. I fixed this by using a powered USB hub.

Mobile Positioning

Aprx is primarily designed for static digipeaters and igates. However it provides a way to load the beacon string from a file. This is primarily for Weather Station Telemetry, but we can also use it to provide realtime mobile (GPS) positioning.

In my github repository, I have python scripts that will read data from a GPS and update a /tmp/beacon file with the current GPS position once every second. Aprx will then read this file when it sends the beacon, consequently transmitting the latest GPS position data.

These scripts require python2 to run, each also have unique dependencies. Others have used these scripts with success, but please be aware of minimal error-handling and potential corner-cases I haven't come across yet. I would be delighted if you send me back corrections/improvements!

beacon.py

This script polls a local gpsd socket to grab the latest GPS data. gpsd handles talking to the GPS.

I don't use this script any more as I experienced high (~60%) CPU usage with gpsd on the Pi, although recently others such as M0JIS have used it no such issue.

beacon_uart.py

This script is designed to talk to a uBlox MAX-6 GPS connected to the Pi's 3.3V UART. It also contains a function for doing direct UDP Packet transmissions to the APRS-IS service (bypassing the RF path).

pyserial is also required to poll the GPS directly in this script.

RPi with RFM22b and MAX6.JPG

Raspberry Pi with GPS connected to the UART (board at the top with white chip and black Sarantel antenna)

beacon_usb.py

This is my latest script. It is similar to the UART script, however is written to handle parsing the NMEA strings from a USB GPS Dongle.

This also requires pyserial.