adafruit_gps

GPS parsing module. Can parse simple NMEA data sentences from serial GPS modules to read latitude, longitude, and more.

  • Author(s): Tony DiCola, James Carr

Implementation Notes

Hardware:

Software and Dependencies:

class adafruit_gps.GPS(uart: UART, debug: bool = False)[source]

GPS parsing module. Can parse simple NMEA data sentences from serial GPS modules to read latitude, longitude, and more.

altitude_m

Antenna altitude relative to mean sea level

property datetime: struct_time | None

Return struct_time object to feed rtc.set_time_source() function

debug

Toggles debug mode. When True, prints the incoming data sentence to the console

fix_quality

GPS quality indicator

0 - fix not available
1 - GPS fix
2 - Differential GPS fix (values above 2 are 2.3 features)
3 - PPS fix
4 - Real Time Kinematic
5 - Float RTK
6 - estimated (dead reckoning)
7 - Manual input mode
8 - Simulation mode
fix_quality_3d

The type of fix for a reading

1 - no fix
2 - 2D fix
3 - 3D fix
property has_3d_fix: bool

Returns true if there is a 3d fix available. use has_fix to determine if a 2d fix is available, passing it the same data

property has_fix: bool

True if a current fix for location information is available.

hdop

Horizontal dilution of precision (GSA)

height_geoid

Geoidal separation relative to WGS 84

horizontal_dilution

Horizontal dilution of precision (GGA)

property in_waiting: int

Returns number of bytes available in UART read buffer

isactivedata

Status Valid(A) or Invalid(V)

latitude

Degrees latitude

latitude_degrees

Degrees component of latitude measurement

latitude_minutes

Minutes component of latitude measurement

longitude

Degrees longitude

longitude_degrees

Degrees component of longitude measurement

longitude_minutes

Minutes component of longitude measurement

mess_num

Message number

property nmea_sentence: str | None

Return raw_sentence which is the raw NMEA sentence read from the GPS

pdop

Dilution of precision

read(num_bytes: int | None) bytes | None[source]

Read up to num_bytes of data from the GPS directly, without parsing. Returns a bytestring with up to num_bytes or None if nothing was read

readline() bytes | None[source]

Returns a newline terminated bytestring, must have timeout set for the underlying UART or this will block forever!

sat_prns

Satellite pseudorandom noise code

satellites

The number of satellites in use, 0 - 12

satellites_prev

The number of satellites in use from the previous data point, 0 - 12

sats

Information from GSV messages

sel_mode

Selection mode

‘M’ - manual
‘A’ - automatic
send_command(command: bytes, add_checksum: bool = True) None[source]

Send a command string to the GPS. If add_checksum is True (the default) a NMEA checksum will automatically be computed and added. Note you should NOT add the leading $ and trailing * to the command as they will automatically be added!

speed_knots

Ground speed in knots

timestamp_utc

Timestamp in UTC

total_mess_num

Number of messages

track_angle_deg

Track angle in degrees

update() bool[source]

Check for updated data from the GPS module and process it accordingly. Returns True if new data was processed, and False if nothing new was received.

vdop

Vertical dilution of precision

write(bytestr: array | bytearray | bytes | memoryview | rgbmatrix.RGBMatrix | ulab.numpy.ndarray) int | None[source]

Write a bytestring data to the GPS directly, without parsing or checksums

class adafruit_gps.GPS_GtopI2C(i2c_bus: I2C, *, address: int = 16, debug: bool = False, timeout: float = 5.0)[source]

GTop-compatible I2C GPS parsing module. Can parse simple NMEA data sentences from an I2C-capable GPS module to read latitude, longitude, and more.

property in_waiting: Literal[16]

Returns number of bytes available in UART read buffer, always 16 since I2C does not have the ability to know how much data is available

read(num_bytes: int = 1) bytearray[source]

Read up to num_bytes of data from the GPS directly, without parsing. Returns a bytearray with up to num_bytes or None if nothing was read

readline() bytearray | None[source]

Returns a newline terminated bytearray, must have timeout set for the underlying UART or this will block forever!

write(bytestr: array | bytearray | bytes | memoryview | rgbmatrix.RGBMatrix | ulab.numpy.ndarray) None[source]

Write a bytestring data to the GPS directly, without parsing or checksums