--- ---

GPS

03 Jul 2020 - Courtney McBeth

Our current GPS is a Parallax SIM33EAU. This module communicates with the microcontroller using UART protocol. The pinout is shown below:

GPS Microcontroller
3.3-5VIn Power (3.3 or 5V)
GND Ground
TXD RX
RXD Unconnected
PPS Unconnected
FIX Unconnected
EN Unconnected

It takes about one minute for the GPS to get a fix (a connection to one or more satellites). After getting a fix, it will transmit data about once per second. This data comes in the form of NMEA sentences. National Marine Electronics Association (NMEA) sentences contain information like latitude, longitude, and UTC time. They look something like this: $GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47. This is an example of a GGA sentence, which contains the current time (12:35:19 UTC in this example), latitude (48 degrees, 07.038 minutes N), longitude (011 degrees, 31.000 minutes E), and some metadata.

There are several different types of NMEA sentences provided by this GPS model, but the only ones that provide data that is useful to us are RMC, GGA, and GLL. See the code documentation for more specific details regarding NMEA parsing.

The latitude and longitude received by the microcontroller are converted into Cartesian (X,Y) coordinates as described in the sailing algorithm. This makes it easier to calculate the distance between points. The UTC time could be used as the time measurement for calculating velocity or wind speed, but I would caution against this. First, there is the unlikely circumstance that a day break occurs while the boat is sailing and a change of one second is interpreted as 24 hours. More important, however, is the possibility that multiple velocity or wind speed calculations occur before the GPS gives a new UTC value. Then, a divide-by-zero exception is likely. Instead, I would recommend setting a timer interrupt to tick every millisecond if time needs to be measured. You can see an example of this in the PIC32 repository.