Since Piaware v3x is gpsd aware, figured I’d share an inexpensive (<$10) method to add a small GPS module to any existing Raspberry Pi for auto-location and Stratum-1 time keeping. I’m sorry if this was hit on before, I honestly didn’t search through the forums.
While there are several GPS hats available, most are over $40 and they wont fit inside most existing cases, so wanted to find something that would handle the duties that was small, cheap and accurate. Low and behold, after some testing of various modules and hats, I found a very small unit from AliExpress that fits the bill: GPS Module && Spec Sheet-ATGM332D
The link is an example, I suggest you shop around as I got mine for a buck cheaper through another reseller. At either rate, it’s basically a uBlox NEO-M8N clone for lack of better terms. Specs are nearly identical and it also handles BDS / GPS / GLONASS systems, so it picks up Chinese birds as well.
After searching seemingly forever around the internet and testing different and frankly terrible methods, I finally came across this link which explains in great detail how to set things up on the software front correctly: https://www.ntpsec.org/white-papers/stratum-1-microserver-howto/
If you don’t feel like reading everything, I created a small script for my own use that will do the install from a fresh Raspbian Lite image: {reboot is required after installation}
wget -O Nitr0.GPS.sh http://puush.hopto.me/iNx5
chmod 755 Nitr0.GPS.sh
./Nitr0.GPS.sh
I have a few modifications in the script that deviate slightly from the ntpsec outline. I do not recommend running the script, but use it as an outline instead as I have some things in there as it concerns my preferences like timezone locale, password changes for both Pi user and root, etc (Sorry for lack of comments, it wasn’t meant for public consumption). The script also completely bypasses wifi, bluetooth and HDMI, so if you need any of those things, it would need to be adjusted accordingly. That said, I do not advise keeping those things active if you want the most precise timing available. Though I have not tested an install on top of the existing piaware images, there is no reason it should not work - but please note the changes I just described so you are aware. Again - I do not recommend running the script as-is without understanding what it’s doing, you have been warned. (twice)
Here is a rather crappy picture of the wiring on my test platform for reference. The thing behind it hanging off pin1 of the GPIO is an RTC board DS3231 which plays nicely with the GPS module:
http://puush.hopto.me/69vH
It can easily be tucked to another portion of the Raspberry and fit inside of any existing case if/as needed - again this is just the test setup and I wanted to show how easy it is to wire up.
No changes are required on the PiAware front and when rebooted, PiAware will automatically pickup your location for MLAT purposes, and your Raspberry will be very accurately clocked from GPS.
Here are timing results while running PiAware, dump1090, dump978:
http://puush.hopto.me/nlwa
There is a little bit of jitter due to the processor load, but it calms itself the longer it’s running. I hope someone finds this to be of use.
Cheers~