conjunction with its laptop-based drivers — forms a virtual
COM port. An LED on the PmodGPS blinks at 1 Hz to signal
that a fix is yet to occur. A fix has been established when
the LED extinguishes.
The PmodGPS’s 3DF pin drives the fix LED. The 3DF pin
can also be used by a host microcontroller to determine fix
status. Once a fix occurs, the NMEA strings flow from the
PmodGPS into the PmodUSBUART which is displayed in a
Tera Term session running on the laptop. According to the
Electronics Explorer, the PmodGPS drew about 32 mA
following a power-up cold start. Once a fix was acquired,
the PmodGPS current consumption dropped to the level you
see in Screenshot 1. The PmodGPS has no low-power
mode. To conserve power, it must be powered off.
A coin cell holder resides on the opposite side of the
PmodGPS’s circuit board. When the coin cell holder is
populated with a battery, the PmodGPS can be powered
down without losing any recent fix and time information.
Without a coin cell in place, it would have to cold start with
every power-up cycle. Cold starts typically take 35 seconds
compared to one second for hot starts. If the PmodGPS is
powered down for more than a couple of hours, a warm
start is executed at power-up. Warm starts are 33 seconds
in length.
Getting a Fix
The PmodGPS NMEA sentences begin with a dollar sign
($) character, which is followed by five characters of talker
ID and arrival alarm. The letters GP comprise the talker ID.
The remaining three characters identify the sentence output
descriptor. All of the following fields of GPS-related
information are comma delimited. NMEA sentences emitted
from the PmodGPS look like this:
$GPGSA,M, 3,05, 17,04, 10, 12,02,,,,,,,1.60,1.28,0.96*0A
$GPGSV, 2,1,08, 10, 69,062, 29,02, 56,321, 12,05, 47,208, 31,
,,,*4B
$GPRMC,171443.000,A,2821.8352,N,08040.3724,W,0.14,
159.70,231112,,,A*7E
$GPV TG,159.70, T,,M,0.14,N,0.25,K,A* 35
Let’s break down the RMC sentence ($GPRMC). The
RMC sentence contains time, date, position, course, and
speed data. The RMC sentence contents can be described
as the recommended minimum navigation information. The
first data field contains the UTC time formatted as
hhmmss.sss. The A indicates that the data in the sentence
is valid. Latitude information follows the validation character
and is interpreted as ddmm.mmmm. Latitude is measured
North or South of the Equator and the N denotes North.
Longitude data is contained in the next comma-delimited
field and is represented as dddmm.mmmm. Longitude
associates East or West and that’s what the W tells us.
The PmodGPS on the bench is not in motion. So, the
course and speed data really does nothing for us here. The
next piece of valuable information is the date formatted as
ddmmyy (231112). The final A defines the mode, which is
autonomous. The sentence checksum is always preceded
with a ‘*’ character and is always followed by a carriage
return/line feed character sequence. The NMEA sentence
structures are laid out in the PmodGPS reference manual.
Now that you have been introduced to the NMEA
layout of an RMC sentence, you’ll notice that you can get
the same time, latitude, and longitude data from the GGA
(Global Positioning System Fix Data) sentence.
Acquiring the Data
$GPGGA,171443.000,2821.8352,N,08040.3724,W,1, 6,1.28
, 2. 2,M,- 31.1,M,,* 62
Knowledge of the structure of the NMEA sentences
provides a basis for the code to acquire them.
Each of the NMEA sentences contain less than 100
characters. At this point, we have plenty of
microcontroller SRAM to spare. So, we can start
by allocating five 128-character arrays. That’s one
array for each sentence type:
char gpsbuf0[128];
char gpsbuf1[128];
char gpsbuf2[128];
char gpsbuf3[128];
char gpsbuf4[128];
BYTE bufcntr;
SCREENSHOT 1. The PmodGPS is based on the Global Top
Gms-u1LP. The Gms-u1LP is fitted with an internal switch mode
power supply that reduces power consumption by 30%.
40 SERVO 01.2013
The bufcntr byte will point at the buffer to be
used for the next NMEA sentence. The idea is to
constantly capture GPS sentence data and store it
in the sentence buffers. A dollar character ($)
delineates the beginning of every NMEA sentence.
A carriage return/line feed sequence (0x0D, 0x0A)
signals the end of every NMEA sentence.
So, all we have to do is look for a dollar