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 | # Allow the normal UART pins to work |
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 | network={ |
Update the Pi
1 | $ sudo apt update |
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 | $ 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.
1 | $ dmesg | grep pps |
Output should be similar to:
1 | [ 2.443494] pps_core: LinuxPPS API ver. 1 registered |
1 | $ sudo ppstest /dev/pps0 |
Output should be similar to:
1 | 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.
1 | $ sudo nano /etc/default/gpsd |
1 | Change USBAUTO="false" |
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 | $ cd /var/www/html |
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 | $ 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.
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 | $ cd ~/ |
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.