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
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.
Configure Pi with raspi-config app
$ sudo raspi-config
Set locale to en us UTF-8.
Keyboard: English (US), generic PC keyboard
Interfacing options menu
P6 Serial -> Login Shell (no) Hardware (yes)
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
Save and Quit Nano.
$ sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
Go to the bottom of the file and add the following:
Update the Pi
$ sudo apt update
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
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
$ sudo ppstest /dev/pps0
Output should be similar to:
trying PPS source "/dev/pps0"
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
$ sudo /etc/init.d/gpsd restart
$ 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
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.
$ sudo nano gpsd.php
On line 100, change the 2000 value to 4000.
Install AFSK software modem
This is a Python librarythat generates Bell 202 AFSK audio samples and AFSK encoded APRS/AX.25 packets.
$ sudo apt install python-pip python-dev
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.
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
Install main APRS script
Download main beacon script from Github
$ cd ~/
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.