• sales

    +86-0755-88291180

SIMXXX Locates My Location on Gaode Map

Summary

SIM7600X 4G HAT is loved by people all over the world because of its perfect functions and stable performance while some people complain that the Internet access of SIM7600X 4G HAT and SIM7600 positioning and my location are quite different (Send the coordinate system obtained by SIM7600X to Baidu or Gaode map for checking). Here, let's learn about GNSS.

Hardware Connection Diagram


Software Preparation

Principle Analysis

The coordinate system used by SIM7600X is the WGS-84 coordinate system, and the coordinate system used by SIM820X is the Mars coordinate system (gcj_02); while the coordinate system used by our commonly used Baidu or Gaode map is the encrypted Baidu coordinate (bd09) and Mars Coordinate system (gcj_02). Therefore, if you directly put the WGS-84 coordinate system on Baidu or Gaode maps, there will be a big error (you can put it on Google Maps); in addition, the longitude and latitude obtained by SIMXXX are divided into units, and you need to convert the commonly used degree units first:

SIMXXX Obtains Location Information Such as Latitude and Longitude

Due to the instability of GPS indoor search, please put the module or antenna next to the balcony or window, or conduct the experiment directly outdoors. Plug in the GPS antenna and place the receiver tag face down in an open outdoor area. Under normal circumstances (outdoors, good weather, no large building blockage), it takes about 1 minute to receive a positioning signal after powering on; if the weather conditions are Not good, it may take longer to locate or even fail to locate.

  • Send the following commands to open GPS:
AT+CGPS=1
  • Used to command to obtain location information such as latitude and longitude:
AT+CGPSINFO
  • Open NEMA to obtain detailed information.
sudo minicom -D /dev/ttyUSB1
  • Unit conversion.
ddmm.mm--> dd.mm.ss: degree unchanged, fraction *100/60; such as 2232.448620--> 22.(32448620*100/60)= 22.54081033
  • Coordinate system conversion key code.
def wgs84_to_gcj02(lng, lat):
     """
     WGS84 to GCJ02 (Mars coordinate system)
     :param lng: Longitude of WGS84 coordinate system
     :param lat: Latitude of WGS84 coordinate system
     :return:
     """
     dlat = _transformlat(lng - 105.0, lat - 35.0)
     dlng = _transformlng(lng - 105.0, lat - 35.0)
     radlat = lat / 180.0 * pi
     magic = math. sin(radlat)
     magic = 1 - ee * magic * magic
     sqrtmagic = math. sqrt(magic)
     dlat = (dlat * 180.0) / ((a * (1 - ee)) / (magic * sqrtmagic) * pi)
     dlng = (dlng * 180.0) / (a / sqrtmagic * math.cos(radlat) * pi)
     mglat = lat + dlat
     mglng = lng + dlng
     return [mglng, mglat]
def wgs84_to_bd09(lon, lat):
     lon, lat = wgs84_to_gcj02(lon, lat)
     return gcj02_to_bd09(lon, lat)
 
def _transformlng(lng, lat):
     ret = 300.0 + lng + 2.0 * lat + 0.1 * lng * lng + \
           0.1 * lng * lat + 0.1 * math. sqrt(math. fabs(lng))
     ret += (20.0 * math. sin(6.0 * lng * pi) + 20.0 *
             math. sin(2.0 * lng * pi)) * 2.0 / 3.0
     ret += (20.0 * math. sin(lng * pi) + 40.0 *
             math.sin(lng / 3.0 * pi)) * 2.0 / 3.0
     ret += (150.0 * math. sin(lng / 12.0 * pi) + 300.0 *
             math.sin(lng / 30.0 * pi)) * 2.0 / 3.0
     return return
 
def _transformlat(lng, lat):
     ret = -100.0 + 2.0 * lng + 3.0 * lat + 0.2 * lat * lat + \
           0.1 * lng * lat + 0.2 * math. sqrt(math. fabs(lng))
     ret += (20.0 * math. sin(6.0 * lng * pi) + 20.0 *
             math. sin(2.0 * lng * pi)) * 2.0 / 3.0
     ret += (20.0 * math. sin(lat * pi) + 40.0 *
             math.sin(lat / 3.0 * pi)) * 2.0 / 3.0
     ret += (160.0 * math. sin(lat / 12.0 * pi) + 320 *
             math.sin(lat * pi / 30.0)) * 2.0 / 3.0
     return return

Coordinates generated after running the sample program are copied to the Gaode map API.

sudo pip3 install pynmea2
sudo pip3 install pynmeagps
wget https://www.waveshare.com/w/upload/1/17/SIMXXX-GNSS.zip  
sudo python3 SIM7600X-GNSS.py


114.0832857092161,22.53842762954979

My Location

Positioning by the window on the south side of the World Trade Plaza, there is an error of 1-2 meters between the positioning and the editor's location; different test environments and conversion algorithms may have different errors.

TAG: Raspberry Pi 10.1 inch DSI LCD TouchScreen Display 800x1280 Also For RK3576/RK3506/ESP32-P4 Raspberry Pi 5 Aluminium Case CAN Analyzer Bus Servo Adapter A Raspberry Pi Pico DVI Raspberry Pi Pico ESP32 S3 5 inch LCD Development Board 800x480 TouchScreen Display TVBOX LVGL HMI Sensor CAN RS485 ESP32-P4 AI Development Board 7/8/10.1inch HMI Touch Screen All-in-One Compatible with Deepseek ESP32-S3 1.28inch luckfox-pico-ultra-w-gpio Use MPS2.5G Raspberry Pi 5 PCIe to NVME SSD And 2.5G Ethernet RJ45 HAT RTL8125 2280 2242 2230 Raspberry Pi Pico 2 RP2350 1.43 inch AMOLED TouchScreen Development Board 466x466 1.43inch Display QMI8658 6-Axis | PCF85063 RTC | SD | Battery Port Raspberry Pi Pico 2 RP2350-One Mini Board Type-A RP2350A RP204 0.85inch LCD USB TO RS485 Sipeed Lichee Tang Nano 4K FPGA MINI Development Board W1NSR-LV4C GOAI Gowin Raspberry Pi RTC Raspberry Pi Compute Module 4 CM4 IO Board Dual Gigabit Ethernet Mini Router Board English Character Display Principle Raspberry Pi Pico RP2040 1.69 inch TouchScreen Round LCD Display With QMI8658/Buzzer/RTC For Arduino