GPS V2.0 Module

Module GPS v2.0 is a high-performance GNSS global positioning module, integrated with the high-performance AT6668 chip to provide precise and reliable satellite positioning services. This module supports multi-frequency, multi-mode GNSS signal reception and is compatible with various satellite navigation systems, including GPS, BD2, BD3, GLONASS, GALILEO, and QZSS, enabling high-precision, multi-system joint positioning or single-system independent positioning, and offering excellent anti-jamming capabilities. In weak signal areas, it can quickly acquire higher precision positioning information. The module comes equipped with an external SMA antenna, and also features a dip switch to allow users to flexibly switch TX/RX communication pins, with PPS signal output for precise timing adjustments. It supports multi-stack usage, offering more customization and flexibility, making it suitable for high-precision positioning applications such as in-vehicle navigation, IoT positioning devices, remote monitoring, smart cities, and home and industrial automation.

Support the following products:

GPSV2Module

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 module import GPSV2Module
 9import time
10
11
12label0 = None
13title0 = None
14label1 = None
15label2 = None
16label3 = None
17label4 = None
18label5 = None
19label6 = None
20module_gpsv2_0 = None
21
22
23power_on_time = None
24
25
26def setup():
27    global \
28        label0, \
29        title0, \
30        label1, \
31        label2, \
32        label3, \
33        label4, \
34        label5, \
35        label6, \
36        module_gpsv2_0, \
37        power_on_time
38
39    M5.begin()
40    Widgets.fillScreen(0x222222)
41    label0 = Widgets.Label("Power On:", 1, 33, 1.0, 0xFFFFFF, 0x222222, Widgets.FONTS.DejaVu18)
42    title0 = Widgets.Title(
43        "GPSV2Module Core2 Example", 3, 0xFFFFFF, 0x0000FF, Widgets.FONTS.DejaVu18
44    )
45    label1 = Widgets.Label(
46        "Satellite Num:", 1, 66, 1.0, 0xFFFFFF, 0x222222, Widgets.FONTS.DejaVu18
47    )
48    label2 = Widgets.Label("Timestamp:", 1, 202, 1.0, 0xFFFFFF, 0x222222, Widgets.FONTS.DejaVu18)
49    label3 = Widgets.Label("GPS Data:", -6, 526, 1.0, 0xFFFFFF, 0x222222, Widgets.FONTS.DejaVu18)
50    label4 = Widgets.Label("Latitude:", 1, 104, 1.0, 0xFFFFFF, 0x222222, Widgets.FONTS.DejaVu18)
51    label5 = Widgets.Label("Longitude:", 1, 140, 1.0, 0xFFFFFF, 0x222222, Widgets.FONTS.DejaVu18)
52    label6 = Widgets.Label("Altitude:", 1, 170, 1.0, 0xFFFFFF, 0x222222, Widgets.FONTS.DejaVu18)
53
54    module_gpsv2_0 = GPSV2Module(2, 13, 14, 25)
55    power_on_time = time.time()
56    module_gpsv2_0.set_work_mode(7)
57
58
59def loop():
60    global \
61        label0, \
62        title0, \
63        label1, \
64        label2, \
65        label3, \
66        label4, \
67        label5, \
68        label6, \
69        module_gpsv2_0, \
70        power_on_time
71    M5.update()
72    label0.setText(str((str("Power On:") + str(((time.time()) - power_on_time)))))
73    label1.setText(str((str("Satellite Num:") + str((module_gpsv2_0.get_satellite_num())))))
74    label2.setText(str((str("Timestamp:") + str((module_gpsv2_0.get_timestamp())))))
75    label4.setText(str((str("Latitude:") + str((module_gpsv2_0.get_latitude())))))
76    label5.setText(str((str("Longitude:") + str((module_gpsv2_0.get_longitude())))))
77    label6.setText(str((str("Altitude:") + str((module_gpsv2_0.get_altitude())))))
78    time.sleep(1)
79
80
81if __name__ == "__main__":
82    try:
83        setup()
84        while True:
85            loop()
86    except (Exception, KeyboardInterrupt) as e:
87        try:
88            from utility import print_error_msg
89
90            print_error_msg(e)
91        except ImportError:
92            print("please update to latest firmware")

UIFLOW2 Example:

example.png

gpsv2_core2_example.m5f2

class GPSV2Module

Constructors

class GPSV2Module(id, rx, tx)

Initialize the GPSV2Module 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.

  • rx – The RX pin of the UART.

  • tx – The TX pin of the UART.

UIFLOW2:

init.png

Methods

GPSV2Module.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

GPSV2Module.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

GPSV2Module.get_antenna_state()

Get the state of the antenna.

Returns:

The antenna state.

UIFLOW2:

get_antenna_state.png

GPSV2Module.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

GPSV2Module.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

GPSV2Module.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

GPSV2Module.get_timestamp()

Get the timestamp of the current GPS time.

Returns:

The timestamp representing the current GPS time.

UIFLOW2:

get_timestamp.png

GPSV2Module.get_latitude()

Get the current latitude.

Returns:

The current latitude in string format.

UIFLOW2:

get_latitude.png

GPSV2Module.get_longitude()

Get the current longitude.

Returns:

The current longitude in string format.

UIFLOW2:

get_longitude.png

GPSV2Module.get_altitude()

Get the current altitude.

Returns:

The current altitude in string format.

UIFLOW2:

get_altitude.png

GPSV2Module.get_satellite_num()

Get the number of satellites used for positioning.

Returns:

The number of satellites.

UIFLOW2:

get_satellite_num.png

GPSV2Module.get_pos_quality()

Get the quality of the GPS position.

Returns:

The position quality indicator.

UIFLOW2:

get_pos_quality.png

GPSV2Module.get_corse_over_ground()

Get the course over ground (COG).

Returns:

The course over ground in degrees.

UIFLOW2:

get_corse_over_ground.png

GPSV2Module.get_speed_over_ground()

Get the speed over ground (SOG).

Returns:

The speed over ground in knots.

UIFLOW2:

get_speed_over_ground.png

GPSV2Module.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

GPSV2Module.get_time_zone()

Get the current time zone offset.

Returns:

The current time zone offset.

UIFLOW2:

get_time_zone.png

GPSV2Module.deinit()

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

UIFLOW2:

deinit.png

GPSV2Module._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.

GPSV2Module._decode_gga(data)

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

Parameters:

data (str) – The GGA sentence to decode.

GPSV2Module._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.

GPSV2Module._decode_txt(data)

Decode the TXT sentence to extract antenna state.

Parameters:

data (str) – The TXT sentence to decode.

GPSV2Module._monitor()

Monitor the GPS data and decode incoming sentences.