From Waveshare Wiki
Jump to: navigation, search




Positioning Principle

What's GNSS

GNSS (Global Navigation Satellite System) is a general term for multiple satellite systems. At present, there are BDS (China), GLONASS (Russia), GPS (United States), Galileo (Europe), QZSS (Japan), and IRNSS (India) navigation satellite systems in the world. The features of GNSS are as follows:

  • GPS is widely used with mature technology, and the frequency band signals such as L1C/A, L2C, and L5, have improved the positioning accuracy.
  • GNSS modules with multi-system and multi-band can capture satellites from different satellite systems, which greatly increases the number of effective satellites and improves positioning accuracy and stability.
  • The signal received by the GNSS module contains reflected and refracted signals, resulting in multi-path effects that affect the positioning accuracy. The multi-band and multi-constellation system technology can effectively lessen errors caused by the atmosphere and improve positioning accuracy.
  • With the development of GNSS, a variety of positioning technologies such as RTK, PPP-RTK and multi-sensor fusion positioning DR (Dead Reckoning) have emerged to meet the needs of differentiated high-precision positioning.

GPS Principle

In this section, the working principle of GPS receiver positioning is shown in the figure below, and the details are described in the following 5 points. For details of the positioning principle, please refer to Fundamentals of gps receivers, Fundamentals of gps.

  • GPS satellites continuously send radio signals with their own time and position information in the air for GPS receivers (GNSS modules such as ZED-F9P)
  • A pseudo-random code will be generated inside the satellite and the receiver. Once the two pseudo-random codes are synchronized, the receiver can measure the difference between the time the radio signal is transmitted and the time it arrives at the receiver (referred to as the time delay), and multiply the time delay by the speed of light to get the distance (pseudorange).
  • The time of the GPS system is maintained by the rubidium atomic frequency standard of the atomic clocks on each satellite. These satellite clocks are generally accurate to within a few nanoseconds of Coordinated Universal Time (UTC), which is maintained by the Naval Observatory's "Master Clock", the stability of each master clock is several 10^(-13) seconds.
  • Computers and navigation information generators on GPS satellites know precisely their orbital positions and system time, while a global network of monitoring stations keeps track of satellites' orbital positions and system time. The main control station at Schriever Air Force Base in Colorado, together with its operation and control section, input the orbital position and onboard clock correction data calculated on the basis of complex models into each GPS satellite at least once a day.
  • To calculate the 3D position of the GPS receiver (GNSS module), the GPS receiver is required to receive signals from at least four satellites, and the 3D position is calculated according to the space triangle Pythagorean theorem and the quadratic linear equation.


What's RTK

RTK (Real Time Kinematic), also known as carrier phase differential technology, is a GNSS positioning technology that supports centimeter-level positioning accuracy (referred to as RTK) and is a differential method for real-time processing of the carrier phase observations of two measuring stations. The working process of RTK is shown in the figure below. The DGPS corrections generated by the base station (GNSS receiver) are transmitted to the mobile station (GNSS receiver) in real-time through the mobile network for calculation and centimeter positioning.


RTK Application

  • Apply in various control surveys such as traditional geodetic surveys and engineering control surveys in triangulation and wire netting methods, and use RTK to measure the positioning accuracy in real-time to ensure observation quality and improve operational efficiency. Compared with non-real-time measurements such as normal GPS static surveys, fast static surveys, and pseudo-dynamic surveys, it must be retested when the accuracy does not meet the requirements. In addition, RTK is used in highway control measurement, electronic circuit control measurement, water conservancy engineering control measurement, and geodetic survey, which can reduce labor intensity, save costs, and complete control point measurement within minutes or even seconds.
  • Topographic mapping: Using RTK only requires one person with the instrument to stay at the detail point for a second or two, and input the feature code at the same time. The accuracy of points and areas can be known in real-time through the handbook. After returning to the room, the professional software interface can output the required topographic map. In this way, RTK only requires one person to operate, and it does not require point-to-point vision, which greatly improves efficiency. With RTK and the electronic handbook, you can measure and design various topographic maps, such as general surveying, railway strip topographic maps, highway pipeline topographical maps, reservoir topographic maps, nautical ocean surveying, and so on with the depth sounder.
  • Setting out is an application branch of measurement. When using RTK to set out, you only need to input the designed point coordinates into the electronic handbook with the GPS receiver on your back, and it will remind you to go to the position. It is not only fast and easy but also is high-accuracy and uniform as GPS is set out by coordinates directly. Hence, the efficiency of setting out in exterior operation is greatly improved, and only one person to operate.


GNSS Principle section.jpg

Working with windows

1. Download and install u-centersoftware, then open the u-center.
2. Set the jumpers in A area, connect the GNSS antenna, Put the receiver of the antenna in an open area outside to receive a GPS signal, and connect the Module to the PC by Micro USB cable.
3. Note that you need to set the side of the antenna without the sticker upward, check the COM port in Device Manager. Use the u-center to connect MAX-M8Q by selecting the COM port and selecting auto baud rate.
4. Enable 3D mode and export the file by selecting File -> Database Export -> Google Map Html.
5. Download Text_Release software and unzip. Open the file by Chrome, then import the HTML file that we saved above to check the position.
6. For detailed information about the u-center software, please refer to User Guide. MAX-M8Q GNSS HAT 002.jpg MAX-M8Q GNSS HAT 003.jpg MAX-M8Q GNSS HAT 005.jpg MAX-M8Q GNSS HAT 004.jpg

Working with Raspberry Pi

Hardware Connection

MAX-M8Q GNSS HAT 007.jpg

PIN Raspberry Pi(BCM) Raspberry Pi(WiringPi) Description
5V - - 5V Power input
GND - - Ground
RXD P14 P15 UART receiving pin
TXD P15 P16 UART transmitting pin
SDA P2 P8 I2C SDA pin
SCL P3 P9 I2C SCL pin
PPS P18 P1 Module PPS pin
INT P27 P2 Wakeup pin, low active

Enable UART interface

Open a terminal and run the following commands:

sudo raspi-config
#Choose Interfacing Options -> Serial -> No -> Yes
sudo reboot

L76X GPS Module rpi serial.png

Libraries Installation

  • Install Python libraries:
sudo apt-get update
sudo apt-get install gpsd gpsd-clients 
sudo pip3 install gps3
  • Modify gpsd:
#Open gpsd file
sudo nano /etc/default/gpsd
#Change the lines below and save
  • Download demo codes:
mkdir ~/Documents/MAX-XXX_GNSS_HAT_Code
cd ~/Documents/MAX-XXX_GNSS_HAT_Code/

Python Examples

Enter the corresponding Python directory and run the following commands:

cd ~/Documents/MAX-XXX_GNSS_HAT_Code/RaspberryPi/python/coordinate_converter
sudo python3

MAX-M8Q GNSS HAT 006.jpg

NTP Server

The system clock of drivers like personal compute or server always has calibration issues as the figure below. In high-frequency trading systems, this issue affects High-precision clock requirement applications like automated production lines, etc. The NEO-M8T's enhanced sensitivity and concurrent constellation reception extend coverage and integrity to challenging signal environments. It uses the atomic clocks of the satellite to get rid of the included network and other factors. Here we use NEO-M8T and Raspberry Pi to build an NTP server and provide a clock for the WLAN network indoors. NEO-M8T GNSS TIMING HAT 002.jpg
1. Connect the antenna to NEO-M8T GNSS TIMING HAT, and set the receiver close to the windows.
2. Connect the NEO-M8T to Raspberry Pi, Power it on, and wait for the PPS signal.
3. Open a terminal and run the following commands.

sudo apt-get install git
cd ~/Documents
sudo git clone
cd RPi-GPS-PPS-StratumOne
sudo chmod 777

4. Reboot Raspberry Pi after installing it.
5. Open and modify /boot/config.txt file, change the gpiopin=4 to gpiopin=18 of the last line and save it.

sudo nano /boot/config.txt
dtoverlay=pps-gpio,gpiopin=18,capture_clear  # /dev/pps0

6. Test pps0 by the following command. And now the Raspberry Pi uses the time of NEO-M8T.

watch -n1 chronyc sourcestats -v

7. To provide time for other devices, you can access it by the IP address of Raspberry Pi like:
8. You can check the time by the following command on a Linux device.

sudo apt install ntpdate
sudo ntpdate

Working with STM32

Hardware connection

MAX-M8Q GNSS HAT 008.jpg

PIN XNUCLEO-F103RB Description
5V - 5V power input
GND GND Ground
RXD P9(TX) Receive pin of UART
TXD P10(RX) Transmit pin of UART

HAL examples

  • Download the demo codes.
  • Unzip and go into the directory of the STM32 example.
  • Open the STM32 project with Keil software.
  • Compile and download the code to the XNUCLEO-F103RB board.
  • Connect the UART2 of the XNUCLEO-F103RB board to PC and check the debug information by Serial Port Utility.

MAX-M8Q GNSS HAT 009.jpg

Working with Jetson Nano

  • Install Python library:
sudo apt-get update
sudo apt-get install python-serial
sudo apt-get install gpsd gpsd-clients python-gps
sudo pip3 install gps3
  • Modify gpsd parameters:

Open the gpsd file on the terminal:

sudo nano /etc/default/gpsd

Modify the following parameters of the gpsd file, then save and exit the file.

  • Download the demo:
mkdir ~/Documents/MAX-XXX_GNSS_HAT_Code
cd ~/Documents/MAX-XXX_GNSS_HAT_Code/
  • Check the port for data:
sudo chmod 777 /dev/ttyTHS1
sudo minicom -D /dev/ttyTHS1 -b 9600
sudo cat /dev/ttyTHS1
sudo gpsd /dev/ttyTHS1 -F /var/run/gpsd.sock
sudo cgps -s
sudo killall gpsd
sudo reboot


Enter the Python directory and run the demo, and you can view the information directly on Google Maps.

cd ~/Documents/MAX-XXX_GNSS_HAT_Code/RaspberryPi/python/coordinate_converter
sudo python3

MAX-M8Q GNSS HAT 016.jpg



Demo codes



You need to enable the Message before exporting data. The following figure is about the output of the RXM-RAWX of NEO-M8T.

Then, please click File->New, enter the name to be saved, choose to save the location, and click Yes; or you can click Yes directly. By now, the u-center started to record the data. After waiting for a while, you can click File-Save to save the GNSS information collected at the interval just now.




To turn on NMEA 4.10, as shown below:
M8Q Beidou.png


Technical Support

If you need technical support or have any feedback/review, please click the Submit Now button to submit a ticket, Our support team will check and reply to you within 1 to 2 working days. Please be patient as we make every effort to help you to resolve the issue.
Working Time: 9 AM - 6 PM GMT+8 (Monday to Friday)