APRS beacon with Uputronics GPS Board and a Raspberry Pi 3

2018-02-10
APRS beacon with Uputronics GPS Board and a Raspberry Pi 3

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

1
$ 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).

1
$ sudo nano /boot/config.txt

Add at the bottom:

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

Save and Quit Nano.

Enable wi-fi

1
$ sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

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

1
2
3
4
network={
ssid="wifi-name"
psk="wifi-password"
}

Wifi reference.

Update the Pi

1
2
$ sudo apt update
$ sudo apt upgrade

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

1
$ sudo systemctl disable hciuart

Not sure what this one does

1
$ sudo systemctl mask serial-getty@ttyAMA0.service

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

1
2
3
$ 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.

1
$ dmesg | grep pps

Output should be similar to:

1
2
3
4
5
[ 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
1
$ sudo ppstest /dev/pps0

Output should be similar to:

1
2
3
4
5
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.

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

Test gpsd

1
$ 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

1
$ sudo apt install apache2 -y

Install PHP which will run our APRS script

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

Install gpsd script that feeds GPS info to APRS script

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

Rename gpsd script

1
$ sudo mv gpsd.php.in gpsd.php

Execute gpsd script

1
$ 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

1
$ 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.

1
2
$ 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.

1
$ alsamixer

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

Force audio output through 3.5mm jack, not HDMI

1
$ sudo raspi-config

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

Install main APRS script

Download main beacon script from Github

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

Edit the script and add your callsign to line 13

1
$ nano aprs-position-beacon.php

Test run the script

1
$ 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.

1
$ 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.