piGate – an APRS iGate implementation using the Raspberry-Pi

13 Oct
2012

APRS (Automatic Packet Reporting System) is an amateur-radio based system for realtime communication using digital packets sent over radio links. I present here, an implementation of an APRS iGate using the Raspberry-Pi. An APRS iGate is an Internet gateway that gates packets from the radio/RF side to the  APRS-IS on the Internet (and vice-versa). The APRS-IS is an Internet based network that connects APRS networks from all around the world and facilitates APRS applications (like realtime postion reporting of objects overlaid over google maps, see aprs.fi)

piGate - the complete setup (minus the 2m antenna)

piGate – complete setup (minus the 2m antenna)

Hardware

The key components of piGate are depicted in the diagram below. The VHF FM radio receives the APRS packets and outputs them in form of short bursts of audio tones (APRS uses audio frequency shift keying modulation at 1200baud, listen to a AFSK1200 packet here). The audio is sent to a sound card connected to the Raspberry-Pi. The software running on the Raspberry-Pi reads the audio signal coming into the sound-card, demodulates the signal, decodes the packet and then sends it to an APRS-IS server over the WiFi link.

pigate-system-overview

The hardware used for the setup:

1. Yaesu FT-270E VHF FM Handheld 2-metreband Transceiver.
2. A 2m vertical dipole antenna (not visible in the picture above)
3. The piGate in an extruded aluminium enclosure
(a) A Raspberry-Pi
(b) A MicroNEXT MN-WD152B WiF USB Adapter with external antenna
(b) Sony Singstar usb adapter (being used as the sound card)
(c) A dual-color LED connected to the GPIO header (to indicate status).


piGate-inside2

Fitting everything inside a box:

I wanted to fit everything neatly inside a box. The eclosure I choose was this extruded aluminium case bought from Maplin (size 120mm x 78mm x 43mm). The enlosure had slots into which I could slide a standard euro-card size pcb. I decieded to mount the pi on a euro-card sized board and then slide it into place. The problem was how to mount a PCB that doe no have any mounting holes (the newer revision-2 of the pi does have mounting holes). I looked into the possibility of drilling holes into the Pi PCB but I couldn’t find an appropriate location plus I didn’t want to risk damaging the board. So instead, I used these Nylon hex threaded PCB spacers. I used a stanely knife to cut slots into them and then screwed then onto a SRBP (read paper plastic composite) board. I used four of these nylon spacers hold the Pi in place on the SRBP board (the SRBP board slides into the enclosure).

piGate-inside8
The sound-card and the WiFi adapter are mounted on the bottom side of the board. There were no mounting holes on the WiFi adapter PCB as well so I drilled a hole at an appropriate location on the PCB (kids dont try this at home!). Soon I realized that there wasn’t enough space for full size USB connectors so I made custom USB cables for the sound-card and the WiFi adapter.

Some more modification I made:

1. Power is supplied to the box using a regular DC jack. I soldered wires directly from the DC jack to the power supply input filter capacitor on the Pi PCB.
2. The WiFi adapter uses a lot of current and the USB port on the PI are not able to supply that unless you bypass the poly-fuses in the power supply path of the USB port. I used instruction given here to do this mod.
piGate-inside5
3. Half of the SD card was poking out from the SD-card slot. This was bugging me, so I cut the SD card to shorten its length (again kids, dont try this at home !). Actually if you hold a SD card against a bright light you can see that only some part of it is the actual memory package, the rest is just plastic.
4. The composite video socket on the Pi PCB was also coming in the way so I got rid of that as well.

Getting the audio right:

I had to pay particular attention to the audio interface between the VHF radio and the sound card. The first thing was to select a sound card that delivers good audio quality. I started with a cheap Ebay USB sound-card and quickly found out the recorded audio quality was rubbish and hence the software was not able to decode any packets. I settled with the Sony Singstar USB adapter (which is just a plain old USB soundcard, only mic inputs tough), it was quite cheap and the audio quality was good enough for my application. The second thing was to consider the actual interface because the VHF radio audio out is a line-level audio output and the input on the sound-card input is at mic-level. I built a line-level to mic-level adapter based on designs given on this page ( 20 dB PAD for line to electret microphone input ).

Software

On the software side of things I am using Multimon . to decode the audio coming from the sound card and a python script to handle everything else. Multimon reads from the soundcard input, runs a AFSK1200 demodulator on the received data and then prints the decoded packet on the terminal. I wrote a python scripts that launches multimon as a subprocess and redirects the standard output into a pipe so that the script can read what multimon is spitting out.  My python script wasnt able to read anything coming out of Multimon initially. I had to add some stream flushing code and recompile Multimon to get over the problem.

To make the required changes to multimon, I compiled it on the Pi itself. The source code on the link given above is old and doesn’t compile on ARM based machines. I wasn’t able to find the sources for multimon in the debian repository for the Pi, so I downloaded the source package from the main debian repository and it compiled on the Pi without any problems.

The python script does the following:
1. Launches mutimon as a subprocess and redirects the standard output to the a pipe that it can read.
2. Establishes a TCP socket connection with an APRS-IS server
3. Checks incoming packets to see if they meet the criteria for gating and then sends the packet to the APRS-IS by appending its own call to the packet path.
4. Sends its own position reports to APRS-IS every 5 minutes.

[asdil12] has kindly posted his set of scripts for this job which you can grab here: https://github.com/asdil12/pymultimonaprs

Further improvements

1. Reducing audio latency: There is a few seconds of delay between the packet being received and sent to APRS-IS. I think this is because multimon is using the older OSS interface for reading audio from the sound card. Also I have read that the kernel can be tuned to reduce the delay even more.
2. Reporting own postion: The position in the report is hard-coded at the moment but I am working on a script to determine the position of the box based on the MAC addresses of the WiFi APs in range using the skyhook API.
3. Adding a web interface for management.
4. Using a USB DVB-T dongle as a software defined radio (like RTL-SDR) connected to the Pi instead of the VHF radio & audio interface that I have used. The new setup can probably be used for numerous other practical applications. Although the Pi processor might not be good enough for real-time SDR processing, it can possibly instead use the computational resources of another machine connected to the internet for that purpose.

Some more pics of the piGate:


14 Responses to piGate – an APRS iGate implementation using the Raspberry-Pi

Avatar

james

October 19th, 2012 at 8:04 pm

Why did you choose to roll your own igate software? It seems like you would get more functionality (like bi-directional gating) by porting or recompiling one of the existing APRS packages. I used to run an igate on linux using javAPRS and the igate plugin and it seemed to work pretty well though I’m not sure if there’s a JRE for rasberrypi yet.

Avatar

jsingh

October 19th, 2012 at 8:33 pm

I wasn’t able to find any suitable software that I could use. But I didn’t spend much effort on that because I wanted to write my own (just for fun). A JRE optimized for PI should already be there I think. But for javAPRS wont I need to keep a GUI running on a connected monitor ?

Avatar

oh7fqq

October 20th, 2012 at 8:38 am

My RPi RX-iGate is running software called aprx – works like a charm!
http://ham.zmailer.org/oh2mqk/aprx/

I have also been thinking about replacing my current radio with http://www.radiometrix.com/content/nrx1 this – Radiometrix NRX1 receiver.

Avatar

greg

October 20th, 2012 at 10:24 am

This is by far the coolest use of the Raspberry-Pi I have seen yet. Absolutely going to make this myself.

Avatar

jsingh

October 20th, 2012 at 12:04 pm

I will be replacing the HT in the setup with a old VHF radio I picked up from ebay for £15. Just had a look the radiometrix modules, look like a good option as well (small and tidy)

Avatar

K3nD0g

October 21st, 2012 at 11:46 am

Love it i will be tryin it out sometime :) …I’ve made something similar for packet radio using my vx3r and pi.. usb sound card handling the audio, chopped up an modded a usb to serial convert to get PTT.. Work pretty good still pretty much in beta tho.. The Raspberry Pi can do so much for the radio world :D

Avatar

Melita Fest

October 26th, 2012 at 9:39 pm

Excellent read, I just passed this onto a colleague who was doing some research on that. And he actually bought me lunch as I found it for him smile So let me rephrase that: Thank you for lunch!

Avatar

Patrick

October 29th, 2012 at 1:01 am

Ok, sounds and looks great for APRS. So jsingh where is the link to your sorftware you wrote for the R-Pi to work as a igate??
oh7fqq where do I start to load the information as listed on your FTP site?? Any help would be appreciated. Thanks

Avatar

n3tav

November 4th, 2012 at 5:26 am

I was starting to experiment using soundmodem (which is apparently already available on raspi) – but haven’t gotten very far with it. Limited time at the moment.

Would like to get a TCP/IP gateway working on it.

Avatar

HA5DI, Bela

December 3rd, 2012 at 2:38 pm

You can try DIXPRS, the next generation portable digi/gateway too:

https://sites.google.com/site/dixprs/

As reported by HAM’s from the field works fine with the Pi.You can read more about DIXPRS in TAPR’s PSR magizine:

http://www.tapr.org/psr/psr119.pdf

Avatar

james

December 11th, 2012 at 8:39 pm

Sorry… I posted here about javAPRS in October and then forgot to come back to see if you replied! :)

The package I was running was actually javAPRSSrvr which can be found here. http://www.aprs-is.net/javAPRSSrvr/ It’s server software (text based) and works quite well.

I actually wrote a few plugins for it when I was running it to dump call signs out to mysql and a few other things.

Avatar

Eren Türkay

December 18th, 2012 at 11:30 am

Nice hack.

Aprx software would be most suitable for tx igate. It handles decoding aprs packets, checks if they meets criteria for i-gate, and maintains APRS server connection. Its code base is more clean. You would want to look at it.

Avatar

jsingh

December 18th, 2012 at 11:40 am

Aprx looks good. But it will need an external TNC/radio-modem and I wanted to use a cheap USB sound-card to decode the packets.

Avatar

asdil12

January 7th, 2013 at 12:24 pm

As the Author did not provide the most important thing (his python script) and didn’t answer my emails, here is my own implementation:
https://github.com/asdil12/pymultimonaprs

top