Super Simple APRS Position Reporter
December 13, 2015
Barest of bones APRS RF position reporter
Update 7/2019: I highly recommend using Direwolf in place of this solution. Direwolf provides the same result using the same hardware setup but with many more options (smart beaconing, igate, digipeating) and is much less taxing on the Pi's CPU. Most importantly, that project is actively maintained. Detailed set up instructions are also available. As such, I'm no longer providing support for this project.
Updated 8/2017 to point to the master gpsd repo when setting up the web server.
I've been pondering an idea for a super bare-bones APRS position reporter through RF for over a year. This project idea has been in response to the more hardware heavy Raspberry Pi projects that involve extra TNC hardware, additional sound cards, and custom cabling.
My criteria has been a Raspberry Pi and an HT as the two major hardware components. No hardware TNCs and no custom cabling. I'm also not using a traditional APRS software package like Xastir or APRX.
In this project I'm using a Raspberry Pi B+, USB GPS receiver, Baofeng UV-5R, and a mono 3.5mm audio cable between the Pi and HT.
Through the Pi's audio output an APRS message is sent to the VOX enabled HT.
The magic happens in the software. A Python based modem library and a relatively simple PHP script are the main components driving the project.
Let's dig in. This setup uses Raspian.
Setting up GPS
A simple USB GPS receiver will do just fine for this project. I'm using an old Earthmate LT-20. In order for the Pi to read the GPS data we'll install gpsd.
sudo apt-get install gpsd gpsd-clients
Setting up the local web server
The main PHP script will read the gpsd information through a JSON file. We'll need to install apache and PHP to serve the JSON file locally.
sudo apt-get install apache2 -y
sudo apt-get install php5 libapache2-mod-php5 -y
Drop this file from the gpsd project into the web server directory, /var/www/html/ and name it gpsd.php
Execute gpsd.php from the command line to build a needed configuration file.
cd /var/www/html
sudo php gpsd.php
If you open a web browser on your Pi and navigate to http://localhost/gpsd.php?op=json with your GPS connected and a clear shot of the sky, you should see position information appear. This is where the main PHP script will be reading the GPS data.
Install Python modem
I mentioned earlier I'm not using a traditional APRS application to generate messages. Instead I'm using a simple Python library called afsk modem. Install this using pip.
sudo apt-get install python-pip python-dev
sudo pip install afsk
The optional PyAudio libraries are not required.
This library takes a properly formatted APRS message string as input and generates a Bell 202 AFSK audio sample and AFSK encoded APRS/AX.25 packet.
Make sure the Pi's sound output level is turned up. I set mine to 80.
alsamixer
And finally, be sure Raspi Config is set to play audio through the 3.5mm port, not HDMI.
sudo raspi-config
The main script
Download the the main PHP script and place it in your Pi's home folder. You'll want to modify the first two variables entering your callsign and any extra message you want transmitted with your position.
Running this file from the command line will show you what's happening.
php aprs-position-beacon.php
Reading in the GPS data, the script converts that to an APRS message string, runs the message through the modem library, outputs a WAV file and then plays the audio file through the Pi's onboard sound card. That triggers the VOX enabled UV-5R and you're now transmitting your position via APRS over RF.
There are several methods to run this script automatically at startup.
That's it.
My Raspberry Pi lives in my car and I've attached a mag mount antenna to the Baofeng for better reception.
Here are typical results over 7 days of commuting.
In the future I'd love to figure out a way to power the Baofeng from the car. Currently I have to take the HT in the house to charge every few days. I also have to turn it on and off each trip to and from the car.
Another potential upgrade may be a 12 watt amp to help improve packet reception in areas where IGates and Digipeaters are scarce.
As a side note, I highly reccommend the Pi B+ or better for this project. I tried the same setup with two different original Pis, but the stray RF passing through the audio cable was strong enough to override the HT's squelch, preventing the HT form transmitting.
For more content like this, subscribe to Amateur Radio Weekly, a weekly summary of the most relevant content in the world of Ham Radio. ♦