NMEA 0183 sentences: reading the output of a GNSS receiver¶
A GNSS receiver computes a position, velocity and time (PVT) solution internally. It can report parts of that solution to application software in NMEA 0183 sentences. u-blox F20, UBX-NAV-PVT, Trimble GNSS receiver documentation, NMEA 0183 overview.
What NMEA 0183 is¶
The National Marine Electronics Association defines NMEA 0183 as a one-way serial interface with one talker and one or more listeners per bus. The standard bus runs at 4,800 baud. NMEA 0183-HS uses 38,400 baud. The specification also defines the electrical interface. For example, Garmin documents a differential NMEA 0183 port, so check the receiver's electrical interface and baud rate before wiring it. NMEA 0183 and NMEA 0183-HS, Garmin differential port wiring.
Receiver firmware determines which NMEA versions and sentences are available. For example, the u-blox F20 HPG can output both NMEA text and the vendor's UBX binary format. u-blox F20 interface description, chapters 2 and 3.
Sentence structure¶
The standard GNSS sentences covered here use this structure. Proprietary sentences can use a different address format, such as $PUBX. Quectel GNSS protocol, §2.1, u-blox F20, §2.8.
| Field | Meaning |
|---|---|
$ |
Start-of-sentence delimiter |
TT |
Two-character talker identifier |
SSS |
Three-character sentence formatter |
,field,... |
Comma-separated data fields; empty fields are represented by consecutive commas |
*HH |
Checksum delimiter followed by two uppercase hex digits |
<CR><LF> |
Carriage return + line feed terminating every sentence |
The standard sentence length limit is 82 characters, including the start delimiter and CRLF. Some receivers can output longer sentences when configured for extra precision. Trimble port configuration, u-blox F9T, Limit82 and High Precision modes.
Talker identifiers¶
For these GNSS sentences, the two-character talker identifier normally indicates a constellation or a combination of constellations. u-blox F20, NMEA Talker IDs.
| Talker | System |
|---|---|
GP |
GPS (United States) |
GL |
GLONASS (Russia) |
GA |
Galileo (European Union) |
GB |
BeiDou (China) |
GQ |
QZSS (Japan) |
GI |
NavIC / IRNSS (India) |
GN |
Combined solution using multiple constellations |
In multi-GNSS mode, the u-blox F20 uses GN as the main talker and constellation-specific talkers for GSV. Some receivers can override the main talker for compatibility. Trimble, for example, can configure GGA and RMC to use GP as a legacy identifier. u-blox F20, multi-GNSS considerations, Trimble port configuration.
Key sentence types¶
The sentences below are illustrative examples. Field numbering starts at 1, after the talker and formatter.
GGA — Global Positioning System Fix Data¶
GGA reports the UTC time, coordinates and quality of a position fix. Trimble GGA field reference.
| Index | Field | Example | Notes |
|---|---|---|---|
| 1 | UTC time | 120000.00 |
hhmmss.ss |
| 2–3 | Latitude | 4807.038,N |
Degrees and decimal minutes, N/S |
| 4–5 | Longitude | 01131.000,E |
Degrees and decimal minutes, E/W |
| 6 | Fix quality | 1 |
0=no fix, 1=autonomous, 2=differential, 4=RTK fixed, 5=RTK float |
| 7 | Satellites used | 08 |
|
| 8 | HDOP | 0.9 |
Horizontal dilution of precision |
| 9–10 | Altitude | 545.4,M |
Above mean sea level, metres |
| 11–12 | Geoid separation | 46.9,M |
Signed geoid height relative to the reference ellipsoid |
| 13 | Age of differential corrections | Empty | Seconds, when reported |
| 14 | Differential reference station ID | Empty | When reported |
GGA reports orthometric height in field 9. To obtain the ellipsoidal height, add the signed geoid separation in field 11. The example gives 545.4 + 46.9 = 592.3 m. Trimble GGA field reference, NOAA National Geodetic Survey, height conversion.
RMC — Recommended Minimum Specific GNSS Data¶
RMC combines UTC time, position, ground speed, course over ground and date in a single sentence. Trimble RMC field reference.
Field 2 gives the data status (A = valid, V = void). Check it before using the position. Fields 7–9 give speed over ground in knots, course over ground in degrees true, and the date in DDMMYY. NMEA 4.10 and later can also include a trailing navigation status field. Trimble RMC field reference, u-blox F20, §§2.5.2 and 2.7.17.
GSA — GNSS DOP and Active Satellites¶
GSA reports the satellites used in the current fix and the associated dilution-of-precision values. u-blox F20, §2.7.13.
Field 1 gives the selection mode (A = automatic, M = manual). Field 2 gives the fix type (1 = no fix, 2 = 2D, 3 = 3D). Fields 3–14 hold up to twelve satellite IDs. Fields 15–17 carry PDOP, HDOP and VDOP. A multi-constellation receiver may emit one GSA per constellation with the same GN talker. When present, field 18 identifies the system in NMEA 4.10 and later. Here, 1 identifies GPS. u-blox F20, §§2.5–2.7.
GSV — GNSS Satellites in View¶
GSV reports satellites in view, which can include satellites outside the current fix. u-blox F20, §2.7.15.
Fields 1–3 give the sequence length, the index of this sentence and the number of satellites in view. Each sentence holds up to four satellite records, each with an ID, elevation, azimuth and carrier-to-noise density (C/N₀) in whole dB-Hz. The C/N₀ field can be empty for a satellite the receiver is not tracking. A trailing signal ID can appear in NMEA 4.10 and later. u-blox F20, §§2.5.2 and 2.7.15.
VTG — Track Made Good and Ground Speed¶
VTG reports course and speed over ground and omits position fields. Trimble VTG field reference.
Fields carry course in degrees true (field 1) and magnetic (field 3), speed in knots (field 5) and km/h (field 7). When present, field 9 gives the mode indicator. Check it before using the values. For example, N indicates invalid data. Trimble VTG field reference, u-blox F20, §§2.5.5 and 2.7.20.
ZDA — Time and Date¶
ZDA gives UTC time, day, month and a four-digit year. The final two fields represent the local time zone offset in hours and minutes. The u-blox F20 fills both with 00. Trimble ZDA field reference, u-blox F20, §2.7.21.
Checksum verification¶
For the sentences shown here, the two hexadecimal digits encode the XOR of the ASCII bytes between $ and *. Commas are included in the calculation. NovAtel, NMEA checksum.
import re
def nmea_checksum_valid(sentence: str) -> bool:
"""Check the checksum of a GNSS sentence, optionally ending in CRLF."""
if not sentence.startswith('$'):
return False
body, _, checksum = sentence[1:].removesuffix('\r\n').partition('*')
if '$' in body or not re.fullmatch(r'[ -~]+', body):
return False
if not re.fullmatch(r'[0-9A-F]{2}', checksum):
return False
value = 0
for byte in body.encode('ascii'):
value ^= byte
return value == int(checksum, 16)
Check the checksum before parsing the fields. This example also rejects incomplete checksums and malformed delimiters. Check fix status separately before using the decoded position. NovAtel, NMEA checksum, Trimble RMC status field.
Coordinate encoding¶
NMEA coordinates use two degree digits for latitude and three for longitude, followed by two minute digits and a decimal fraction of a minute. For a populated coordinate field in that format, add the minutes divided by 60 to the degrees and apply the sign from the hemisphere field. u-blox F20, §2.5.3.
def nmea_to_decimal(raw: str, hemisphere: str) -> float:
"""Convert NMEA ddmm.mmmm (or dddmm.mmmm) to decimal degrees."""
dot = raw.index('.')
degrees = int(raw[:dot - 2])
minutes = float(raw[dot - 2:])
result = degrees + minutes / 60.0
if hemisphere in ('S', 'W'):
result = -result
return result
The GGA example converts to approximately 48.117300° latitude and 11.516667° longitude. South and west use negative signs.
Multi-constellation parsing considerations¶
A receiver tracking GPS, Galileo and GLONASS simultaneously may emit messages like these. u-blox F20, multi-GNSS considerations.
$GNGGA— combined fix$GNGSA— DOP and satellites used, potentially one sentence per constellation with a distinct system ID$GPGSV— GPS satellites in view$GAGSV— Galileo satellites in view$GLGSV— GLONASS satellites in view$GNRMC— combined recommended minimum
To assemble a GSV sequence for a sky plot, group by talker and, when present, signal ID. Use the total sentence count and the message index to check completeness. Store the constellation alongside each satellite ID because numbering ranges can overlap across constellations. For example, satellite ID 04 can identify a GPS or Galileo satellite. u-blox F20, §§2.4–2.5 and 2.7.15.
NMEA 2000¶
NMEA 2000 is a separate, CAN-based network standard for marine electronics. Devices exchange network messages identified by Parameter Group Numbers (PGNs), including messages for GNSS and navigation. The two interfaces use different wiring and message formats. NMEA 2000 standard, NMEA 2000 training, Parameter Group Numbers, NMEA 0183 standard.
Where to go next¶
The GNSS fundamentals article covers the receiver chain that produces the fix reported in these sentences. The PRN codes article explains the role of spreading codes in satellite signal acquisition.