GPS V1.1(SMA) Unit

GPS Unit v1.1 is a GNSS global positioning navigation unit, integrating the high-performance CASIC navigation chip AT6668 and signal amplifier chip MAX2659, with a built-in ceramic antenna, providing more precise and reliable satellite positioning services.

GPS SMA Unit is a GNSS global positioning navigation unit that integrates the high-performance CASIC navigation chip AT6668 and the signal amplifier chip MAX2659. It uses an external antenna to provide more accurate and reliable satellite positioning services.

Support the following products:

GPSV11Unit

Micropython Example:

 1# SPDX-FileCopyrightText: 2024 M5Stack Technology CO LTD
 2#
 3# SPDX-License-Identifier: MIT
 4
 5import os, sys, io
 6import M5
 7from M5 import *
 8from unit import GPSV11Unit
 9import time
10
11
12label0 = None
13title0 = None
14label1 = None
15label2 = None
16label3 = None
17label4 = None
18label5 = None
19label6 = None
20gpsv11_0 = None
21
22
23power_on_time = None
24
25
26def setup():
27    global label0, title0, label1, label2, label3, label4, label5, label6, gpsv11_0, power_on_time
28
29    M5.begin()
30    Widgets.fillScreen(0x222222)
31    label0 = Widgets.Label("Power On:", 1, 33, 1.0, 0xFFFFFF, 0x222222, Widgets.FONTS.DejaVu18)
32    title0 = Widgets.Title(
33        "GPSV11Unit Core2 Example", 3, 0xFFFFFF, 0x0000FF, Widgets.FONTS.DejaVu18
34    )
35    label1 = Widgets.Label(
36        "Satellite Num:", 1, 66, 1.0, 0xFFFFFF, 0x222222, Widgets.FONTS.DejaVu18
37    )
38    label2 = Widgets.Label("Timestamp:", 1, 202, 1.0, 0xFFFFFF, 0x222222, Widgets.FONTS.DejaVu18)
39    label3 = Widgets.Label("GPS Data:", -6, 526, 1.0, 0xFFFFFF, 0x222222, Widgets.FONTS.DejaVu18)
40    label4 = Widgets.Label("Latitude:", 1, 104, 1.0, 0xFFFFFF, 0x222222, Widgets.FONTS.DejaVu18)
41    label5 = Widgets.Label("Longitude:", 1, 140, 1.0, 0xFFFFFF, 0x222222, Widgets.FONTS.DejaVu18)
42    label6 = Widgets.Label("Altitude:", 1, 170, 1.0, 0xFFFFFF, 0x222222, Widgets.FONTS.DejaVu18)
43
44    gpsv11_0 = GPSV11Unit(2, port=(33, 32))
45    gpsv11_0.set_work_mode(7)
46    power_on_time = time.time()
47
48
49def loop():
50    global label0, title0, label1, label2, label3, label4, label5, label6, gpsv11_0, power_on_time
51    M5.update()
52    label0.setText(str((str("Power On:") + str(((time.time()) - power_on_time)))))
53    label1.setText(str((str("Satellite Num:") + str((gpsv11_0.get_satellite_num())))))
54    label2.setText(str((str("Timestamp:") + str((gpsv11_0.get_timestamp())))))
55    label4.setText(str((str("Latitude:") + str((gpsv11_0.get_latitude())))))
56    label5.setText(str((str("Longitude:") + str((gpsv11_0.get_longitude())))))
57    label6.setText(str((str("Altitude:") + str((gpsv11_0.get_altitude())))))
58    time.sleep(1)
59
60
61if __name__ == "__main__":
62    try:
63        setup()
64        while True:
65            loop()
66    except (Exception, KeyboardInterrupt) as e:
67        try:
68            from utility import print_error_msg
69
70            print_error_msg(e)
71        except ImportError:
72            print("please update to latest firmware")

UIFLOW2 Example:

example.png

gpsv11_core2_example.m5f2

class GPSV11Unit

Constructors

class GPSV11Unit(id, port)

Initialize the GPSV11Unit with a specific UART id and port for communication.

Parameters:
  • id (int) – The UART ID for communication with the GPS module. It can be 0, 1, or 2.

  • port – A list or tuple containing the TX and RX pins for UART communication.

UIFLOW2:

init.png

Methods

GPSV11Unit.set_work_mode(mode)

Set the working mode of the GPS module.

Parameters:

mode (int) – The mode to set, defined by the GPS module.

UIFLOW2:

set_work_mode.png

GPSV11Unit.get_work_mode()

Get the current working mode of the GPS module.

Returns:

The current working mode of the GPS module.

UIFLOW2:

get_work_mode.png

GPSV11Unit.get_antenna_state()

Get the state of the antenna.

Returns:

The antenna state.

UIFLOW2:

get_antenna_state.png

GPSV11Unit.get_gps_time()

Get the current GPS time.

Returns:

The GPS time as a list of strings [hour, minute, second].

UIFLOW2:

get_gps_time.png

GPSV11Unit.get_gps_date()

Get the current GPS date.

Returns:

The GPS date as a list of strings [day, month, year].

UIFLOW2:

get_gps_date.png

GPSV11Unit.get_gps_date_time()

Get the current GPS date and time combined.

Returns:

The GPS date and time as a list of strings [year, month, day, hour, minute, second].

UIFLOW2:

get_gps_date_time.png

GPSV11Unit.get_timestamp()

Get the timestamp of the current GPS time.

Returns:

The timestamp representing the current GPS time.

UIFLOW2:

get_timestamp.png

GPSV11Unit.get_latitude()

Get the current latitude.

Returns:

The current latitude in string format.

UIFLOW2:

get_latitude.png

GPSV11Unit.get_longitude()

Get the current longitude.

Returns:

The current longitude in string format.

UIFLOW2:

get_longitude.png

GPSV11Unit.get_altitude()

Get the current altitude.

Returns:

The current altitude in string format.

UIFLOW2:

get_altitude.png

GPSV11Unit.get_satellite_num()

Get the number of satellites used for positioning.

Returns:

The number of satellites.

UIFLOW2:

get_satellite_num.png

GPSV11Unit.get_pos_quality()

Get the quality of the GPS position.

Returns:

The position quality indicator.

UIFLOW2:

get_pos_quality.png

GPSV11Unit.get_corse_over_ground()

Get the course over ground (COG).

Returns:

The course over ground in degrees.

UIFLOW2:

get_corse_over_ground.png

GPSV11Unit.get_speed_over_ground()

Get the speed over ground (SOG).

Returns:

The speed over ground in knots.

UIFLOW2:

get_speed_over_ground.png

GPSV11Unit.set_time_zone(value)

Set the time zone offset for the GPS time.

Parameters:

value – The time zone offset value to set.

UIFLOW2:

set_time_zone.png

GPSV11Unit.get_time_zone()

Get the current time zone offset.

Returns:

The current time zone offset.

UIFLOW2:

get_time_zone.png

GPSV11Unit.deinit()

Deinitialize the GPS unit, stopping any running tasks and releasing resources.

UIFLOW2:

deinit.png

GPSV11Unit._add_checksum(message)

Add checksum to the message for communication with the GPS module.

Parameters:

message (str) – The message to which the checksum will be added.

Returns:

The message with added checksum.

GPSV11Unit._decode_gga(data)

Decode the GGA sentence to extract GPS quality, number of satellites, and altitude.

Parameters:

data (str) – The GGA sentence to decode.

GPSV11Unit._decode_rmc(data)

Decode the RMC sentence to extract GPS time, latitude, longitude, speed, course, and date.

Parameters:

data (str) – The RMC sentence to decode.

GPSV11Unit._decode_txt(data)

Decode the TXT sentence to extract antenna state.

Parameters:

data (str) – The TXT sentence to decode.

GPSV11Unit._monitor()

Monitor the GPS data and decode incoming sentences.