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 / hobbyist.

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 · batteries · resistors · transistors · fuses · diodes · capacitors · inductors · ground

Slightly less basic: amplifier notes · varistors · changing voltage · transformers · baluns · frequency generation · Transmission lines · skin effect


And some more applied stuff:

IO: Input and output pins · wired local IO · wired local-ish IO · ·  Various wireless · 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

Noise stuff: Stray signals and noise · sound-related noise names · electronic non-coupled noise names · electronic coupled noise · ground loop · strategies to avoid coupled noise · Sampling, reproduction, and transmission distortions

Audio notes: See avnotes


Platform specific

Arduino and AVR notes · (Ethernet)
Microcontroller and computer platforms ··· ESP series notes · STM32 series notes


Less sorted: Ground · device voltage and impedance, audio and otherwise · electricity and humans · power supply considerations · Common terms, useful basics, soldering · PLL · pulse modulation · signal reflection · resource metering · SDR · Project boxes · vacuum tubes · Unsorted stuff

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

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, or tell me)


There are many more complete documents out there.

This is meant to get a hobbyist started.


Communication

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.


NMEA

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)

Hardware

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 within somewhat more reasonable time.

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

Example:

$GPGSV,3,1,11,15,67,284,14,26,66,130,12,28,50,066,,27,49,265,21*75

The parts:

  • start with a
    $
  • five characters:
    • the first two of which identify the talker type - which is
    • 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


Notes:

  • 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.
  • 4800 baud means ~480 characters per second, which means only a handful of sentences per second.
This is fine for localization, but is something to keep in mind (and makes one wonder about all the redundancy between even the default sentences).
some devices can speak much faster serial, but for backwards compatibility have to be switched to it.
  • Messages often come in once-per-second bursts
faster reporting exists, but isn't really necessary for most things



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, or tell me)

The following are a few lines from a GPS unit that was just powered on (doesn't have a fix yet, before all fields are filled) in Delft, the Netherlands.

$GPRMC,150050.000,A,5200.5569,N,00421.9672,E,4.62,20.20,280411,,*39
$GPGGA,150051.000,5200.5581,N,00421.9679,E,1,00,50.0,-31.6,M,47.1,M,,0000*7A
$GPGSA,A,2,,,,,,,,,,,,,50.0,50.0,50.0*06
$GPRMC,150051.000,A,5200.5581,N,00421.9679,E,4.62,20.20,280411,,*35
$GPGGA,150052.000,,,,,0,00,50.0,,M,0.0,M,,0000*4E
$GPGSA,A,1,,,,,,,,,,,,,50.0,50.0,50.0*05
$GPRMC,150052.000,V,,,,,,,280411,,*22
$GPGGA,150053.000,,,,,0,00,50.0,,M,0.0,M,,0000*4F
$GPGSA,A,1,,,,,,,,,,,,,50.0,50.0,50.0*05
$GPRMC,150053.000,V,,,,,,,280411,,*23
$GPGGA,150054.000,5200.5465,N,00421.9579,E,1,03,6.5,-32.6,M,47.1,M,,0000*41
$GPGSA,A,2,15,26,27,,,,,,,,,,6.6,6.5,1.0*34
$GPRMC,150054.000,A,5200.5465,N,00421.9579,E,1.41,327.29,280411,,*01
$GPGGA,150055.000,5200.5363,N,00421.9525,E,1,03,6.5,-33.4,M,47.1,M,,0000*4B
$GPGSA,A,2,15,26,27,,,,,,,,,,6.6,6.5,1.0*34
$GPGSV,3,1,11,15,67,284,14,26,66,130,12,28,50,066,,27,49,265,21*75
$GPGSV,3,2,11,09,27,261,,18,23,312,,08,18,071,,17,14,118,17*73
$GPGSV,3,3,11,05,11,186,,22,01,333,,21,00,279,*4E
$GPRMC,150055.000,A,5200.5363,N,00421.9525,E,1.58,212.89,280411,,*0D
$GPGGA,150056.000,5200.5260,N,00421.9469,E,1,04,7.0,-28.9,M,47.1,M,,0000*47


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.



Notes:


See also:

On precision and DOP

DOP, or, "Why does it sometimes show me in the wrong place?"

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, or tell me)

If you have an app that shows you where you went running, you'll notice it shows you off the road, and sometimes teleporting around a bit.

Probably because you're in a city, and things like reflected and blocked signals are messing it up, meaning some fixes in a path are less accurate or just wrong.


DOP (Dilution of Precision) [9] is, in theory, determined by fix accuracy.

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)


DOP can be split into:

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
TDOP (Time DOP)


In practice, you could say it refers to anything that reduces that accuracy.


In relatively ideal conditions, DOP has a roughly linear relation with accuracy in meters.

However, that's an assumption - in less than ideal conditions (reflections from buildings), there will be a difference between DOP and accuracy in meters that you cannot easily quantify.

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, or tell me)


GPS units can start determining a fix using three satellites, but (approximately speaking) but this is a 2D fix that has to assume an earth shape, specifically an altitude for this location to be fairly good.

Using the last altitude the receiver saw is better than nothing, but worse than a 3D fix.


With ≥4 satellites you can get a 3D fix, meaning you can determine the height.


Mathematically, more than four means the solution is over-determined. But because all signals have unknown error, this gives diministing returns, and will never be a point in space.

While receivers can choose to use more satellites's signals (there are usually a dozen in view) for a more accurate fix, the added precision is quickly diminishing returns, a lot of them don't use all of them in calculation because it won't help much.

(There are other, better ways of improve it, though various are external)


Things that augment basic GPS, like DGPS, AGPS, and WAAS, may also take a little time to kick in, depending on the hardware, setup, and situation.


See also:

Can you get more accurate? (Fix types, cleverness, external augmentation)

On startup time

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, or tell me)


For context:

  • almanac data (basic orbit information)
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.
longer (possibly multiples) if obstructions means we miss some of that data
shorter (maybe 2 minutes(verify)) if we're lucky enough to receive enough information to get going
  • ephemeris data (shorter-term corrections to the almanac) (detected from earth and sent to the satellites every so often(verify))
is considered valid for 4 hours(verify) (and apparently updated every two hours?(verify))
repeats every ~30 seconds, takes 20 to 30 seconds to receive(verify)


Cold start

  • starts from scratch - e.g. if you haven't used the receiver half a year
  • done when receiver cannot predict or verify which satellites are overhead - e.g. when the device was unpowered for more than half a year since last powered and/or moved a large distance (over ~100km?(verify)) since last powered, or when for some (other) reason no(t enough) predicted satellites are detected overhead
  • Time To First Fix may be up to ~13min (almanac download time), but is often lower, anything between that and maybe 2min(verify)


Warm start

  • valid almanac, outdated ephemeris data - typical if the receiver is used regularly, but not continuously on
  • 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
  • Time To First Fix could be between 20 and 60 seconds


Hot start

  • valid almanac and recent ephemeris data for enough satellites - powered continuously, or has been powered on for at least ~15 min in the last few hours
  • typical if the receiver is on very frequently
  • Time To First Fix could be 10 or 20 seconds

Glossary

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, or tell me)
  • TTFF: Time To First Fix.
See #On_startup_time on what you can expect
  • 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 to go on within a few minutes(verify), but a full almanac helps faster startup for the next half year or so.
  • 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.
  • 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 (verify) and help timekeeping (because GPS is a great source of precise time, e.g. used by NTP)
When not relating to a pin, it tends to mean Precise Positioning Service instead; see below.


Precision related:

  • PPS (Accuracy level): Precise Positioning Service - military
~10m horizontal accuracy (officially; practically often ~4m)
compare with SPS and others
  • SPS (Accuracy level): Standard Positioning Service - basic civilian GPS fix
    • The level of accuracy is set by DoD policy, by introducing an error in the signal. 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
  • 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)
    • so does not improve accuracy per se, just mainly TTFF (hot start instead of warm start)
    • used in cell phones. Uses network data (may count as regular charged data access)
  • DGPS: Differential GPS
    • roughy: Fixed receivers stations calculate the error between what GPS tells them and they know is true, and transmit that difference; DGPS receivers can then correct by the same amount
      • transmitted on longwave, so correction has (decreasing) use up to a few hundred km (the US coast guard basically made it for their own use when SPS was still artifically crippled)
      • Developed 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 best systems and best best conditions)
  • GNSS augmentation[10] - basically meaning "something DGPS-like". There are various terms with varying specificity around this, e.g.
    • There is a distinction between GBAS (where ground stations transmit the corrections) and SBAS (where satellites transmit corrections)
    • small GBAS systems may be used e.g. near airports
    • ABAS (Aircraft-based augmentation system) seems to refer more to aircraft using some of their own telemetry, e.g. RAIM
    • Specific wider implementations:
        • WAAS in the US (all of it, not just by coast guards (verify))
        • MSAS in Japan
        • GAGAN in India
        • EGNOS in the EU,
        • SDCM in Russia
        • BDSBAS in China
      • Many of which are designed to be cross-compatible(verify)


Lower level:

  • 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)
  • SV - "Satellite Vehicle". Seems to be used whenever people are too lazy to type 'satellite'