Electronics project notes/Some GPS notes

From Helpful
(Redirected from GPS)
Jump to: navigation, search
This is for beginners and very much by a beginner.

It's intended to get an intuitive overview for hobbyist needs. It may get you started, but to be able to do anything remotely clever, follow a proper course or read a good book.

Some basics and reference: Volts, amps, energy, power · Ground · batteries · resistors · changing voltage · transistors · fuses · diodes · varistors · capacitors · inductors · transformers · baluns · amplifier notes · frequency generation · skin effect

And some more applied stuff:

IO: Input and output pins · wired local IO wired local-ish IO · · · · Shorter-range wireless (IR, ISM RF, RFID) · bluetooth · 802.15 (including zigbee) · 802.11 (WiFi) · cell phone

Sensors: General sensor notes, voltage and current sensing · Knobs and dials · Pressure sensing · Temperature sensing · humidity sensing · Light sensing · Movement sensing · Capacitive sensing · Touch screen notes

Actuators: General actuator notes, circuit protection · Motors and servos · Solenoids

Some stuff I've messed with: Avrusb500v2 · GPS · Hilo GPRS · JY-MCU · DMX · Thermal printer ·

Audio notes: microphones · device voltage and impedance, audio and otherwise · amps and speakers · basic audio hacks · digital audio ·

Less sorted: Common terms, useful basics, soldering · Arduino and AVR notes · ESP series notes · PLL · signal reflection · pulse modulation · electricity and humans · resource metering · Microcontroller and computer platforms · SDR · Unsorted stuff

See also Category:Electronics.

This article/section is a stub — probably a pile of half-sorted notes, is not well-checked so may have incorrect bits. (Feel free to ignore, fix, or tell me)

There are many more complete documents out there.

This is meant to get a hobbyist started.


GPS units tend to speak NMEA 0183.

They may also speak their own protocol, which you can often switch to via a NMEA-style though brand-specific command.


In the context of GPS, NMEA usually refers to to NMEA 0183, an ASCII-based, line-at-a-time protocol. It has a basic per-line checksum to detect message corruption.

A single-talker, multiple-listener setup.

NMEA 0183 is technically a proprietary protocol that costs a few hundred dollars, but the basic information you'll need to start using it is fairly public information. There have been a number of revisions, including:

  • NMEA 0183   v2.00
  • NMEA 0183   v2.10
  • NMEA 0183   v2.30
  • NMEA 0183   v2.40
  • NMEA 0183   v3.00
  • NMEA 0183   v3.01
  • NMEA 0183   v4.00

There is now a NMEA 2000 which is meant for similar purposes, but is fairly different in setup: a 250kbit/s shared bus (multiple-talker, multiple-listener) with a more compact protocol. It seems to be used in boats and not much elsewhere. (verify)


Typically uses a serial port at 4800bps (often 8bits, no parity, 1 stop bit).

All NMEA 0183 compliant equipment should support and probably default to this.

Newer versions of standards allow devices to use 38400bps, which seems mostly used for AIS, and (other) setups that may need to combine messages from multiple NMEA devices.

It is recommended to make longer-distance wiring wiring conform to RS/EIA-422 (differential signalling) as this is less susceptible to noise than RS/EIA-232 (though RS232 is easier to connect to computer serial ports and perfectly fine for ~1m cables).

Sentence format



The parts:

  • starts with a
  • five characters:
    • the first two of which identify the talker type - which for GPS is GP (or LC for LORAN-C navigation devices, GL for GLONASS devices)
    • the other three are the sentence type. Within the GP prefix there exist about two dozen sentence types, with most basics covered by a few types
  • a bunch of comma-separated fields
the amount and meaning depends on sentence type
later standard versions sometimes add fields to some sentences -- at the end
  • is terminated by a
    and a simple two-character checksum
    • ...to be able to reject messages corrupted by noise
    • the checksum value is a XOR of all the bytes between the $ and *, and this byte is shown as hex


  • Some devices may be/have more than one talker type, for example a GPS unit with a magnetic compass
  • The unit chooses which sentence types to send (GGA, GSA, GSV, and RMC seem the most common). You may be able to configure a different set.
  • Most GPS devices have some of their own sentence types in addition to the standard ones, apparently including
    • GLL (apparently LORAN-style)
    • VTG (apparently also LORAN)
    • ZDA (SiRF-specific?(verify)).
  • There is no imposed order, though any given unit may always use the same order.
  • Messages often come in once-per-second bursts.
  • 4800 baud means ~480 characters per second, which means only a handful of sentences per second. This doesn't influence basic use much, but is something to keep in mind (and makes one wonder about all the redundancy between even the default sentences).

See also:

Example GPS sentences

This article/section is a stub — probably a pile of half-sorted notes, is not well-checked so may have incorrect bits. (Feel free to ignore, fix, or tell me)

The following are a few lines from a GPS unit that was just powered on (to soon to have all fields filled) in Delft (the Netherlands).


Examples picked apart:

  • (GP)GGA - "Fix information" [1] [2]
    • All you need for the most basic location (and estimated precision)
    • First example from above, $GPGGA,150051.000,5200.5581,N,00421.9679,E,1,00,50.0,-31.6,M,47.1,M,,0000*7A:
      • 150051.000
        - fix time in UTC (hhmmss, may or may not show fractional seconds (verify))
      • 5200.5581
        - latitude (ddmm.mmmm): 52° 0.5581 minutes
      • N
        - ...north
      • 00421.9679
        - longitude (dddmm.mmmm): 4° 21.9679 minutes
      • E
        - ...east
      • 1
        - fix type SPS (1=SPS, 2=DGPS, 3=PPS, 4=RTK, 5=Float RTK, 6=Estimated, 7=Manual, 8=Simulator)
      • 00
        - satellites in view (0..12)
      • 50.0
        - HDOP, approximating the accuracy of the fix (see DOP notes below). This is a very inaccurate fix (a later one in the example has a HDOP of 6.5, which is decent)
      • -31.6
        - altitude of antenna above mean sea level (negative means below)
      • M
        - ...in meters
      • 47.1
        - difference between mean sea level and the WGS84 ellipsoid. (positive means msl above ellipsoid)
      • M
        - ...in meters
      • - age of DGPS data in seconds (time since last DGPS update), here empty as DGPS is not used
      • 0000
        - DGPS station ID. Can also be empty if not used.
  • (GP)RMC - "Recommended Minimum (sentence C)" [3] [4]
    • First example from above, $GPRMC,150050.000,A,5200.5569,N,00421.9672,E,4.62,20.20,280411,,*39
      • 150050.000
        - fix time
      • A
        - active (could also be V for void, invalid) - you probably want to only use lines with A
      • 5200.5569
        - latitude: 52° 00.5569 minutes
      • N
        - ...north
      • 00421.9672
        - longitude: 004° 21.9672 minutes
      • E
        - ...east
      • 4.62
        - ground speed (in knots)
      • 20.20
        track angle (in degrees true)
      • 280411
        - Date; 28 April 2011 (2-digit year presumably good until 2080)
      • - magnetic variation (amount)
      • - E or W (verify)
  • (GP)GSA - mostly details precision [5] [6]
    • DOP (Dilution Of Precision) information
    • Example from above, $GPGSA,A,2,,,,,,,,,,,,,50.0,50.0,50.0*06
      • A
        - 2D/3D mode selected Automatically (rather than Manually)
      • 2
        - 2D fix (would be 3 for 3D fix, 1 for no fix)
      • - identifier of first satellite in view (in jargon, the PRN of first SV)
      • - PRN of second satellite in view
      • - PRN of third satellite in view
      • - PRN of fourth satellite in view
      • - PRN of fifth satellite in view
      • - PRN of sixth satellite in view
      • - PRN of seventh satellite in view
      • - PRN of eighth satellite in view
      • - PRN of ninth satellite in view
      • - PRN of tenth satellite in view
      • - PRN of eleventh satellite in view
      • - PRN of twelfth satellite in view
      • 50.0
        - PDOP, Positional Dilution of Precision (DOP) - overall 3D accuracy
      • 50.0
        - HDOP, Horizontal DOP - that is, longitude and latitude
      • 50.0
        - VDOP, Vertical DOP - that is, height
      • ...which is a boring example because this seems to be a preliminary report. The later figures in the example above (HDOP of 6.5) is a moderately good fix.
  • (GP)GSV - "Detailed Satellites-in-View data" [7] [8]
    • Details up to four satellites in a single message, so there you'll see a few of these in a row to detail all satellites in view. I've seen sentences where the last of these sentences has fewer fields, and examples where ther have 0,0,0,0 entries.
    • Example from above, $GPGSV,3,1,11,15,67,284,14,26,66,130,12,28,50,066,,27,49,265,21*75
      • 3
        - amount of GSV messages this cycle (three)
      • 1
        - message number (out of the above number; this is one of three)
      • 11
        - number of satellites in view
      • 15
        - First detailed SV's PRN
      • 67
        - First detailed SV's elevation (in degrees)
      • 284
        - First detailed SV's azimuth (in degrees)
      • 14
        - First detailed SV's SNR
      • 26
        - Second detailed SV's PRN
      • 66
        - Second detailed SV's elevation (in degrees)
      • 130
        - Second detailed SV's azimuth (in degrees)
      • 12
        - Second detailed SV's SNR
      • 28
        - Third detailed SV's PRN
      • 50
        - Third detailed SV's elevation (in degrees)
      • 066
        - Third detailed SV's azimuth (in degrees)
      • - Third detailed SV's SNR
      • 27
        - Fourth detailed SV's PRN
      • 49
        - Fourth detailed SV's elevation (in degrees)
      • 265
        - Fourth detailed SV's azimuth (in degrees)
      • 21
        - Third detailed SV's SNR
  • (GP)GLL - lat, long and UTC time. Mostly redundant with GGA.
  • (GP)VTG - heading (true and magnetic), ground speed (knots and km/h)
  • (GP)ZDA - date and time. Specific to SiRF. Tells the time of the most recent 1PPS pulse.


  • DOP (Dilution of Precision) [9]
An estimate of how accurate position determination is with the given signals.
A unitless figure of merit. A DOP of over 20 is bad, 10-20 is poor, 5-10 is moderate, 2-5 is good, 1-2 is very good, 1 is ideal. (the device in the examples above seems to report 50.0 for a bad-quality basic fix)
in relatively ideal conditions, DOP has a roughly linear relation with accuracy in meters.
however, that's an assumption - that can be misleading/false when there's a bunch of signal reflection (verify)
GDOP (Geometric DOP) is used both as a grouping term for the DOP variants, and as a single figure that summarizes PDOP and TDOP (verify)
PDOP (Positional DOP) is 3D DOP, which could be separated into: (verify)
HDOP (Horizontal DOP) - meaning that for longitude and latitude
VDOP (Vertical DOP) - meaning that for altitude

See also:

On 2D/3D fixes

This article/section is a stub — probably a pile of half-sorted notes, is not well-checked so may have incorrect bits. (Feel free to ignore, fix, or tell me)

GPS units can start determining a 2D fix using three satellites, but (approximately speaking) it assumes a regular earth shape, and needs to assume an altitude for this location to be fairly good. Using the last altitude the unit saw is a decent start, but not the most accurate you could do.

With ≥4 satellites you can get a 3D fix, basically meaning you can determine the height -- a point in 3D space.

While modern units can track 12 satellites, few use all of them in calculation. Mathematically, more than four means the solution is overdetermined. More can still reduce the overall error, but it's a quickly-diminishing returns thing.

First fix may be 2D (3 satellites), and therefore have noticeably larger DOP than the 3D fix that often follows soon.

Things like AGPS, DGPS, and WAAS may also take a little time to kick in, depending on the hardware, setup, and situation. For example, a unit may give an initial accuracy of ~15m, and narrow it to ~5m as WAAS kicks in.

See also:

On cold/warm/hot starts

This article/section is a stub — probably a pile of half-sorted notes, is not well-checked so may have incorrect bits. (Feel free to ignore, fix, or tell me)

Cold start

  • starts from new almanac
  • done when receiver cannot predict or verify which satellites are overhead - e.g. when moved more than ~100km, when time is unknown or our estimate is off, or (enough) predicted satellites are not detected
  • TTFF (time to first fix) may be ~13min (almanac download time), though can be 2min(verify)

Warm start

  • valid almanac, outdated ephemeris data
  • done when there is a valid almanac (we can predict and see satellites), you haven't moved much, and the time is known - but the ephemeris data is old
  • TTFF is 20-30 seconds at best

Hot start

  • has a valid almanac and recent ephemeris data for enough satellites, so can acquire satellites quickly
  • TTFF can be 10 or 20 seconds


  • almanac data is considered valid for up 180 days
and apparently updated perhaps every six days(verify)
  • It takes ~12.5 minutes for a complete almanac to receive, which is relevant primarily for the next start to be warm/hot.
(longer if obstructions means we miss some of that data)
  • though it may know enough to get going after ~2 minutes(verify)
  • ephemeris data is valid for ~30 minutes
and apparently updated every two hours(verify)
  • ephemeris data is sent each ~30 seconds (and takes about 20-30 seconds transmit(verify))


This article/section is a stub — probably a pile of half-sorted notes, is not well-checked so may have incorrect bits. (Feel free to ignore, fix, or tell me)
  • almanac - orbit information. Allows a GPS unit to predict what sattelites are overhead, shortening aquisition time. Takes ~15min to receive completely. (there is usually enough useful information within a few minute at most(verify))
  • ephemeris data - precise corrections to the almanac. Takes at least 30 seconds to retrieve this from the GPS signal, becomes outdated in a few hours.
  • AGPS: Assisted GPS (a.k.a. A-GPS, aGPS)
    • communication network (rather than GPS signal) provides ephemeris data (also predictions, to make the data last longer), reducing TTFF (hot start instead of warm start)
    • used in cellular phones. Uses network data (may count as regular charged data access)
  • DGPS (Accuracy related): Differential GPS
    • Receives local-ish corrections from stations at known locations, which allows higher accuracy. Used for marine navigation, coastguard, surveying, and more.
    • Requires an additional channel of communication, and there's more than one type of that.
    • can improve accuracy to less than a meter (~5cm in some systems and under some conditions)
  • PPS
    • when referring to a GPS module output pin (then a.k.a. 1PPS), this is a Pulse Per Second signal meant to tell you there is a high quality fix
    • When not relating to a pin, it tends to mean Precise Positioning Service instead; see below.
  • PPS (Accuracy level): Precise Positioning Service - military
    • ~10m horizontal accuracy (officially; practically often ~4m)
  • PRN - Effectively identifies a GPS satellite. (More technically: The PRN identifies the pseudo-random number sequence - one that looks random but can be exactly reproduced)
  • SPS (Accuracy level): Standard Positioning Service - basic civilian GPS fix
    • The level of accuracy is set by DoD policy. Pre-2000, Selective Availability (SA) lowered SPS accuracy to on the order of ~100m, but in 2000 SA was effectively disabled, making it almost equivalent to PPS
  • SV - "Satellite Vehicle". Seems to be used whenever people are too lazy to type 'satellite'
  • TTFF: Time To First Fix. Usually on the order of 30 or 50 seconds (verify) when starting from no information.
  • GNSS augmentation[10] - some method of augmenting GPS with corrections form stations with known locations, increasing fix accuracy. Can be divided into:
    • GBAS (ground-based augmentation system) / GRAS (ground-based regional augmentation system), which uses local radio transmissions. Example: DGPS
    • SBAS (satellite-based augmentation system), which uses satellites to transmit the corrections. Examples: WAAS, GAGAN, EGNOS, MSAS, and others[11] (Many of which are designed to be cross-compatible(verify))
      • wider-area and more easily used, so will probably make (some of the applications of) GBAS obsolete