Saturday, March 20, 2021

The Olapap GPS


 This is a geeky post about making a GPS. I think it might be of interest to about five windsurfers in the world. If you're not one of them, I suggest you find something else to read. If you are not curious about what the picture shows, you are definitely not one of them!

Why make another GPS?

That's a good question. The short answer is that it is very hard to get a good GPS for speedsurfing competition - specifically, for the GPS Team Challenge (GPSTC). There are currently two GPS devices you can buy that are approved for the GPSTC. The first one is a watch: the Locosys GW60. Unfortunately, it has a few annoying habits, like wrist bands that just fall apart without any warning; buttons that you should NEVER press when the watch or your fingers are wet; and batteries that die if you don't use the watch for a while, and that require advanced soldering skills of you want to replace them. 

The second one is the "Motion Mini" logger. It's a fantastic little device, but very hard to get. Some people have waited many months to get their order, which is hand-assembled by one guy who can't keep up with the demand. He's also loosing money on his quest to provide a great GPS, so we don't know how long he'll be able to keep making the Mini Motions.

The question about alternatives comes up on a very regular basis on the Australian speedsurfing forum. Unfortunately, many GPS watches out there work well enough most of the time, but don't provide any accuracy estimates that allow software to automatically identify artifacts. Within the context of a competition where about 500 results determine the ranking every month, that's not good enough.

I have written about making a simple little GPS logger with a u-blox GPS chip, an Openlog datalogger, and a couple of other bits and pieces in the past. While this thing was easy enough to build, and is at least as accurate as "approved" devices, it requires some soldering - which means most windsurfers won't even consider making one. But what if we can make a good GPS buy just buying parts and putting them together with a cable or two? That seems to be possible now!

Olapap GPS? Really?

Well, I had to give the thing a name, right? After many hours of searching copyright databases (just kidding!), I based the name on a critical component and the basic idea behind it. "Ola" stands for "OpenLog Artemis", the data logger part of the device. "PAP" stands for "Plug And Play" - no soldering! 

Parts needed

The Olapap GPS logger requires exactly three parts and one cable.

1. The Openlog Artemis from Sparkfun ($50). This is a nifty little data logger, nicknamed "OLA",  that can write to a micro SD card. It's similar to the Openlog I have used in my previous prototypes, but with two major difference: a much more powerful processor, and a "Quiic" connector to hook up a GPS chip. The Artemis processor on the chip is much faster than the one used by the old Openlog, and has several hundred times more memory. No more trying to optimize every single byte of memory and every CPU cycle! Sparkfun show the device on backorder right now, but you can probably find one on Amazon or your favorite electronics supplier.

2. A u-blox GPS chip with a Quiic connector from Sparkfun ($40 - $70). The u-blox chips are the only generally available GPS chips that (a) use Doppler for speed calculations, and (b) provide estimates of the speed accuracy based on the quality of the GPS signals received. We need one with the Quiic connector so that we can hook it up to the OLA, and Sparkfun offers a bunch of different types. So far, I've used two of them:

- The SAM-M8Q board ($40). This is an older (8th) generation GPS chip with a ceramic antenna that seems adequate. It is what I am currently using.

- The NEO-M9N board with a chip antenna ($70). This is a newer (9th) generation GPS chip that offers a higher data rate and use of the Chinese BeiDou satellite system, two functions that could lead to more accurate speed data. However, the chip antenna on this board is very small and inferior to the ceramic antennas that are typically used. In my tests, the reception quality of the antenna was so poor that the speed data were inaccurate. If you want to use an M9 chip, I strongly suggest that you get a NEO-M9 board with an antenna connector instead - either the Sparkfun board with the U.FL connector (which is a bit tricky to use!) or the Sparkfun board with the larger SMA connector

3. A battery. I am using a 1 Ah Lithium Ion battery from Sparkfun, but a smaller or larger battery should also work. If you order a battery from a different supplier, make sure that is has the correct polarity - some have the cables connected the other way around, which will kill your electronics!

4. A Quiic cable to connect the OLA and the GPS chip. I got a set of cables from Amazon.

5. A micro SD card (32 GB or less). Make sure to get a class 10 or better card!

6. A USB type C cable.

Getting started

Connect the pieces together (check the hookup guide at the Sparkfun site), press the reset button on the OLA - and voila, you start logging GPS data! But we're quite there yet, since the data will be logged as text files, with some of the essential data points missing. We need binary data (".ubx" files)!

Fortunately, the Sparkfun tutorial provides a link to a firmware specifically for GPS logging. Updating the firmware is pretty easy with the Sparkfun firmware update application. If you are using an M9 logger, you're all set to create .ubx files with the required "NAV-PVT" sentences. You just need to edit a settings file on the micro SD card that the OLA creates the first time it starts after installing the GNSS firmware to increase the logging rate to 5 Hz (or higher).

If you're using an M8 chip, though, you are a bit out of luck. The GNSS firmware only works with the newer M9 chips, not with the SAM-M8 chip I listed above. But the firmware is open source, so modifying it is straightforward. Well, at least if you know how to program in C/C++ and know your way around Arduinos. I've done both in the past, but rarely and reluctantly, so it took me quite a few hours to get things to work properly. The current version of my modified GNSS firmware is not pretty, but at least is works with the SAM-M8 chip. 

The next steps will be some more on-the-water testing of the prototype to see if the accuracy is adequate, and perhaps some testing with an M9-based GPS chip and an external antenna. If the results are positive, I'll clean up the modifications I made a bit and post the firmware so that anyone else interested can download and use it.