APRS beacon with Uputronics GPS Board and a Raspberry Pi 3

February 10, 2018

For more content like this, subscribe to Amateur Radio Weekly, a weekly summary of the most relevant content in the world of Ham Radio. ♦

This is a detailed, step-by-step guide to using an Uputronics GPS board as the main component of a Pi based APRS position beacon. This project is very similar to my previous APRS beacon project using a USB GPS module. I worked very closely with Chris, K7AZ who was very gracious to lend out the GPS board for this project.

The Uputronics GPS board is typically used as a timing device/NTP server for the Pi in absence of a real time clock (using date and time info via GPS). For this project I'm more interested in the positional data coming from the board.

The board itself is a great piece of hardware. The GPS signal locks in almost instantly. Even in the house. It performs much better than the USB GPS modules I've used in the past. On to the guide.

Download Raspian Stretch Lite, write to SD card

https://www.raspberrypi.org/downloads/raspbian/

I'm using the CLI only version to keep the system load low, but this should work just the same with the desktop environment version.

I used the Ubuntu Startup Disk Creator app that comes with Ubuntu to create my SD card.

Attach GPS board, antenna, SD card to Pi.

Boot Pi

Configure Pi with raspi-config app

$ sudo raspi-config

Set locale to en us UTF-8.

Timezone
Keyboard: English (US), generic PC keyboard
Wi-fi US

Interfacing options menu
Enable SSH
P6 Serial -> Login Shell (no) Hardware (yes)

Board setup

I borrowed most of the GPS board setup from Anthony Stirk (M0UPU).

$ sudo nano /boot/config.txt

Add at the bottom:

# Allow the normal UART pins to work
dtoverlay=pi3-miniuart-bt
dtoverlay=pps-gpio,gpiopin=18

Save and Quit Nano.

Enable wi-fi

$ sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Go to the bottom of the file and add the following:

network={
 ssid="wifi-name"
 psk="wifi-password"
}

Wifi reference.

Update the Pi

$ sudo apt update $ sudo apt upgrade

Disable bluetooth serial support (I'm guessing the GPS serial connection conflicts with the Bluetooth serial interface)

$ sudo systemctl disable hciuart

Not sure what this one does

$ sudo systemctl mask serial-getty@ttyAMA0.service

PPS tools (pulse per second) reads the GPS board which sends GPS/time info every second

$ sudo apt install pps-tools $ sudo apt install libcap-dev $ sudo reboot

Verifying PPS is working

Ensure the GPS has a signal lock and the green PPS LED on the Uputronics Pi+ GPS Expansion Board is blinking once per second.

$ dmesg | grep pps

Output should be similar to:

[ 2.443494] pps_core: LinuxPPS API ver. 1 registered
[ 2.446699] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[ 2.471796] pps pps0: new PPS source pps.-1
[ 2.471886] pps pps0: Registered IRQ 498 as PPS source
[ 6.965166] pps_ldisc: PPS line discipline registered
$ sudo ppstest /dev/pps0

Output should be similar to:

trying PPS source "/dev/pps0"
found PPS source "/dev/pps0"
ok, found 1 source(s), now start fetching data...
source 0 - assert 1418933982.998042450, sequence: 970 - clear 0.000000000, sequence: 0
source 0 - assert 1418933983.998045441, sequence: 971 - clear 0.000000000, sequence: 0

If you see “Connection timed out,” the GPS may not have a solid signal or the board may not be properly set on the Pi. This tripped me up for a while.

Set up GPSD

Edit gpsd config
This took a while to figure out. The pi version assumes a USB GPS device will be attached, so we have to disable USB auto config and define the serial device in the config file.

$ sudo nano /etc/default/gpsd Change USBAUTO="false" Change DEVICES="/dev/ttyAMA0" $ sudo /etc/init.d/gpsd restart

Test gpsd

$ cgps -s

You should see GPS info populated: Time, lat, lon, grid square, etc.

Reboot for good measure and run cgps -s again.

Setting up the local web server and gpsd script

Install apache web server which will read GPS info and feed the APRS script

$ sudo apt install apache2 -y

Install PHP which will run our APRS script

$ sudo apt install php libapache2-mod-php -y

Install gpsd script that feeds GPS info to APRS script

$ cd /var/www/html $ sudo wget http://git.savannah.gnu.org/cgit/gpsd.git/plain/gpsd.php.in

Rename gpsd script

$ sudo mv gpsd.php.in gpsd.php

Execute gpsd script

$ sudo php gpsd.php

If successful, you should see a bunch of HTML in the console and navigating to http://localhost/gpsd.php?op=json in your Pi's web browser should produce a bunch of plaintext looking GPS information.

Edit gpsd.php

$ sudo nano gpsd.php

On line 100, change the 2000 value to 4000.

Install AFSK software modem

This is a Python library that generates Bell 202 AFSK audio samples and AFSK encoded APRS/AX.25 packets.

$ sudo apt install python-pip python-dev $ sudo pip install afsk

If you get a "TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'", try rebooting and run sudo pip install afsk one more time.

Set your Pi's output audio to 60.

$ alsamixer

Press the 'up' key on your keyboard until you get to 60. Press 'esc.'

Force audio output through 3.5mm jack, not HDMI

$ sudo raspi-config

Choose "Advanced Options"
Choose "A4 Audio"
Choose option 1
Exit

Install main APRS script

Download main beacon script from Github

$ cd ~/ $ wget https://gist.githubusercontent.com/Cale/699979c3f597378dfaca/raw/538f95b73efbf808004e785bff3d407e2da2ce36/aprs-position-beacon.php

Edit the script and add your callsign to line 13

$ nano aprs-position-beacon.php

Test run the script

$ php aprs-position-beacon.php

You can ignore any "PHP Notice" messages. You'll see lat lon info on the screen. If the GPS board is unable to pick up a signal, you'll see "No GPS data is available."

When a GPS signal is acquired, you should see "Transmitting beacon" and "Playing WAV."

At that point you should see a "packet.wav" file show up in your home directory. That's another confirmation the script is working.

$ ls ~/

If you plug the Pi's audio into a speaker, you should hear the APRS/AFSK modem sounds.

For the HT, I plug the audio cable into the mic port and turn on VOX. Your HT should then transmit your position!

Next steps: Starting the beacon script on boot.