GPS V2.0 Module
GPS v2.0 模块是一款高性能 GNSS 全球定位模块,集成高性能 AT6668 芯片,可提供精准、可靠的卫星定位服务。该模块支持多频、多模式 GNSS 信号接收,兼容多种卫星导航系统,包括 GPS、BD2、BD3、GLONASS、GALILEO 和 QZSS,可实现高精度的多系统联合定位或单系统独立定位,并具备出色的抗干扰能力。在弱信号区域,也能快速获取更高精度的定位信息。模块配备外置 SMA 天线,并带有拨码开关,便于用户灵活切换 TX/RX 通信引脚,同时提供 PPS 信号输出,用于精确定时校准。支持多堆叠使用,提供更多定制与灵活性,适用于车载导航、IoT 定位设备、远程监控、智慧城市以及家庭与工业自动化等高精度定位应用场景。
支持以下产品:
MicroPython 应用示例:
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 应用示例
class GPSV2Module
Constructors
Methods
- GPSV2Module.get_work_mode()
获取 GPS 模块当前的工作模式。
- 返回:
GPS 模块的当前工作模式。
UiFlow2

- GPSV2Module.get_antenna_state()
获取天线的状态。
- 返回:
天线状态。
UiFlow2

- GPSV2Module.get_gps_time()
获取当前 GPS 时间。
- 返回:
GPS 时间,以字符串列表形式表示 [hour, minute, second]。
UiFlow2

- GPSV2Module.get_gps_date()
获取当前 GPS 日期。
- 返回:
GPS 日期,以字符串列表形式表示 [day, month, year]。
UiFlow2

- GPSV2Module.get_gps_date_time()
获取当前 GPS 日期和时间(组合)。
- 返回:
GPS 日期和时间,以字符串列表形式表示 [year, month, day, hour, minute, second]。
UiFlow2

- GPSV2Module.get_timestamp()
获取当前 GPS 时间的时间戳。
- 返回:
表示当前 GPS 时间的时间戳。
UiFlow2

- GPSV2Module.get_latitude()
获取当前纬度。
- 返回:
当前纬度的字符串格式。
UiFlow2

- GPSV2Module.get_longitude()
获取当前经度。
- 返回:
当前经度的字符串格式。
UiFlow2

- GPSV2Module.get_altitude()
获取当前海拔高度。
- 返回:
当前海拔的字符串格式。
UiFlow2

- GPSV2Module.get_satellite_num()
获取用于定位的卫星数量。
- 返回:
卫星数量。
UiFlow2

- GPSV2Module.get_pos_quality()
获取 GPS 位置的质量。
- 返回:
位置质量指示器。
UiFlow2

- GPSV2Module.get_corse_over_ground()
获取地面航向(COG)。
- 返回:
地面航向,单位为度。
UiFlow2

- GPSV2Module.get_speed_over_ground()
获取对地速度(SOG)。
- 返回:
地面速度,单位为节。
UiFlow2

- GPSV2Module.set_time_zone(value)
设置 GPS 时间的时区偏移量。
- 参数:
value – 要设置的时区偏移值。
UiFlow2

- GPSV2Module.get_time_zone()
获取当前时区偏移量。
- 返回:
当前时区偏移量。
UiFlow2

- GPSV2Module.deinit()
反初始化 GPS 单元,停止任何正在运行的任务并释放资源。
UiFlow2

- GPSV2Module._add_checksum(message)
为与 GPS 模块通信的消息添加校验和。
- 参数:
message (str) – 将要添加校验和的消息。
- 返回:
添加了校验和的消息。
- GPSV2Module._monitor()
监控 GPS 数据并解码传入的语句。



