L76K GPS HAT

From Waveshare Wiki
Jump to: navigation, search
L76K-GPS-HAT
L76X GPS HAT

RPi, USB TO UART
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

{{{name6}}}

Introduction

This item is a GNSS (Global Navigation Satellite System) module that supports multiple satellite systems including GPS, BeiDou (BDS), GLONASS, and QZSS, offering both multi-system joint positioning and single-system independent positioning. It supports A-GNSS functionality, features an internal low-noise amplifier and surface acoustic wave filter, and provides users with a fast, accurate, and high-performance positioning experience as a Raspberry Pi GNSS expansion board.

Specifications

GNSS module specifications
Specification Item Specification
GNSS System Supported systems GPS / GLONASS / BDS / QZSS
Chip platform AT6558R
L1 receiver Channels 32 tracking / 72 capturing
SBAS Not supported
A-GNSS Supported
Sensitivity Auto-aquisition -148dBm
Re-acquisition -160dBm
Tracking -162dBm
TTFF
(Time to First Fix)
Cold start 30s (Autonomous)
5.5s (With A-GNSS)
Warm start 2s
Accuracy metrics Position accuracy 2.0m CEP
Velocity accuracy 0.1m/s
Acceleration accuracy 0.1m/s²
Timing accuracy 30ns
Other items Communication interface UART
Serial baud rate 4800bps~115200bps
(Default 9600bps)
Data update frequency 1Hz (default)
5Hz (max)
Supply voltage 5V
Total current <55mA @5V
(Continue mode)
Communication protocol NMEA 0183
CASIC proprietary protocol
Operating temperature -40℃ ~ 85℃
Product dimensions 65.00mm×30.50mm

Onboard Resources

L76K-HAT-hard.png

Item Description
① L76K module Main chip, supports GPS, Beidou (BDS), GLONASS, and QZSS multiple satellite systems
② CP2102 USB to UART chip
③ CAT24C32 EEPROM storage chip
Provides ID EEPROM for Raspberry Pi (including vendor information, GPIO mapping, and valid device tree information). This was added because of the micro-HAT (uHAT) specification introduced by the Raspberry Pi (see for details). This is to ensure consistency and compatibility with future Raspberry Pi add-on boards and provide a better user experience.
Note: We did not use this, so you can ignore it.
④ RT9193-33 Power chip
⑤ Galaxy configuration button Defaults to GPS + GLONASS combination;
Press Force ON button and restart the module with a GPS + BDS combination
⑥ Standby mode switch Standby mode: Setting the STANDBY switch to ON allows the module to enter Standby mode, which is a low-power mode. In this mode, the module stops satellite search and navigation, and no positioning information (NMEA messages) is output, but it can still be accessed via commands or any other data.
⑦ Status indicator RXD/TXD: Serial port receive/transmit indicator; PPS: GPS status indicator; PWR: Power indicator
⑧ Raspberry Pi GPIO interface Convenient for connecting to Raspberry Pi
⑨ USB TO UART interface Convenient for connecting to PC and other hosts
⑩ GNSS antenna interface Connect GNSS antenna to be placed under visible sky
⑪ ML1220 battery holder Can connect to ML1220 rechargeable battery for power failure data preservation and warm start
⑫ UART selection jumper cap A: USB to serial port control L76K
B: Raspberry Pi control L76K
C: USB to serial port access Raspberry Pi

Windows Serial Port Debugging

  • Install the CP2102 driver; set the serial port of the module to A (yellow jumper), and communicate with the L76K via the USB port.
  • Connect the antenna, plug in the USB cable, and then connect to the computer. As shown in the figure, after the connection, the power indicator (PWR) stays on.
  • Place the other end of the antenna where you can see the sky.

L76X GPS HAT TEST.png

  • Wait for about 1 second, the TXD indicator starts flashing, indicating data transmission
  • Open the computer serial port debugging assistant, set the corresponding COM port (here it is COM5), baud rate 9600, 8 data bits, 1 stop bit, no parity bits, no flow control.
  • Download the Serial Port Debugging Assistant

L76X GPS Module sscom.png
Note: 1. Due to unstable GPS signal acquisition indoors, please place the module or antenna on the balcony or next to the window, or conduct the experiment directly outdoors.
2. For the first module positioning (cold start), under normal conditions (outdoors, good weather, no large building obstruction), it takes 35 seconds to successfully locate. Please be patient. If the weather conditions are poor, it may require a longer positioning time, or even fail to position.
Note: Due to GPS static drift, the results seen in Google Earth may differ from actual conditions. The Baidu coordinate error calculated using the demo is particularly small.

Working with Raspberry Pi

Raspberry Pi provides control through C and Python demos

Enable UART Interface

Open the Raspberry Pi terminal and enter the following command to enter the configuration interface

sudo raspi-config
Select Interfacing Options -> Serial, disable shell access, and enable the hardware serial port
L76X GPS Module rpi serial.png

Install Relevant Function Libraries

Not all libraries need to be installed; install only what is actually required. If you only use Python demo, you can also install only the Python library.

Python Library

pip3 install pyserial
pip3 install pynmea2
pip3 install pynmeagps

BCM2835

#Open the Raspberry Pi terminal and run the following commands:
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.71.tar.gz
tar zxvf bcm2835-1.71.tar.gz 
cd bcm2835-1.71/
sudo ./configure && sudo make && sudo make check && sudo make install
# For more information, please refer to the official website: http://www.airspayce.com/mikem/bcm2835/

wiringPi

#Open the Raspberry Pi terminal and run the following commands:
cd
sudo apt-get install wiringpi
#For Raspberry Pi systems after May 2019 (those earlier may not require execution), an upgrade may be necessary:
wget https://files.waveshare.com/wiki/common/wiringpi-latest.deb
sudo dpkg -i wiringpi-latest.deb
gpio -v
# Run gpio -v and version 2.52 will appear. If it does not appear, there is an installation error

#Bullseye branch system uses the following command:
sudo git clone https://github.com/WiringPi/WiringPi
cd WiringPi
sudo ./build
gpio -v
# Run gpio -v and version 2.70 will appear. If it does not appear, there is an installation error

lgpio

sudo su
wget https://github.com/joan2937/lg/archive/master.zip
unzip master.zip
cd lg-master
sudo make install 
# For more information, please refer to the official website: https://github.com/gpiozero/lg

Hardware Connection

  • Insert the module directly onto the Raspberry Pi, connect the yellow jumper to position B, place it under the visible sky to allow the module to receive satellite signals:

L76K-Visible-sky.png

minicom Debugging

  • Install minicom debugging assistant
sudo apt-get install minicom
# For Raspberry Pi 5\ZERO\2B
sudo minicom -D /dev/ttyAMA0 -b 9600
# For Raspberry Pi 4B\3B+\3B
sudo minicom -D /dev/ttyS0 -b 9600

The default baud rate is 115200. To set the baud rate to 9600, add the parameter -b 9600. -D represents the port, /dev/ttyS0 is similar to COM1 in Windows. The following image is a test using the serial port ttyS0 on Raspberry Pi 4B:
L76X GPS Module rpi minicom1.png
Exit: Ctrl+A then press X, YES, Enter

cutecom Testing

  • Install cutecom debugging assistant
sudo apt-get install cutecom
  • Run cutecom, a graphical serial port assistant interface appears, similar to sscom for Windows:
cutecom
  • The following figure was tested using Raspberry Pi 5 with a baud rate of 9600 and a serial port ttyAMA0

Cutecom-l76.png

Demo

  • Download the demo:
wget https://files.waveshare.com/wiki/L76K-GPS-HAT/Demo/L76K_GPS_HAT_Code.zip
unzip L76K_GPS_HAT_Code.zip 
sudo chmod 777 -R L76K_GPS_HAT_Code
cd L76K_GPS_HAT_Code/RaspberryPi
  • C demo
cd c/
sudo make clean && sudo make
sudo ./main
  • Python demo
cd python
python3 main.py
  • Expected effect

The initial positioning of the module requires a waiting time of 35 seconds.
The first part is the raw data output by the module.
Time is the time output by L76X.
Latitude and longitude are the output latitude and longitude directions.
The converted map coordinates can be entered into Bing Map to search for the location, for example:

22.53857879961489,114.08331567625963

Gaode-l76K.png

  • Obtain the original NMEA data demo
python3 nmea.py

Nmea-l76k.png


Working with RDK

Hardware Connection

  • Insert the jumper cap into area B
  • Insert the L76x GPS HAT directly into the 40PIN on the X3 PI
750px-X3 PI Connect L76x HAT.jpg

Install Libraries

Use the terminal and run the following commands to install the libraries:

pip3 install pyserial
pip3 install pynmea2
pip3 install pynmeagps

Test with minicom

  • Install minicom debugging assistant
sudo apt-get install minicom
sudo minicom -D /dev/ttyS3 -b 9600

Exit: Ctrl+A then press X, YES, Enter

Working with Jetson Orin Nano

Install Libraries

Use the terminal and run the following commands to install the libraries:

pip3 install pyserial
pip3 install pynmea2
pip3 install pynmeagps

minicom Test

  • Install minicom debugging assistant
sudo apt-get install minicom

Connect via UART Serial Port

Orin-uart-l76K.png

  • Insert the jump cap in area B, and connect the L76K GPS HAT to the Jetson Orin Nano via the 40PIN header
  • Use minicom to control the UART serial port
sudo minicom -D /dev/ttyTHS1 -b 9600

L76K-orin-nano.png

Connect via USB Cable

L76k-usb-orin.png

  • Insert the jumper cap into area B
  • Place the L76K GPS HAT jumper cap in A and connect it to the USB port on the Jetson Nano via a USB cable
 sudo minicom -D /dev/ttyUSB0 -b 9600

L76K-usb-orin (1).png
Exit: Ctrl+A then press X, YES, Enter

Demo

  • Download the demo:
wget https://files.waveshare.com/wiki/L76K-GPS-HAT/Demo/L76K_GPS_HAT_Code.zip
unzip L76K_GPS_HAT_Code.zip 
sudo chmod 777 -R L76K_GPS_HAT_Code
cd L76K_GPS_HAT_Code/Jetson
  • Obtain the original NMEA data demo
sudo python3 nmea.py

Nmea-l76k.png

FAQ

 Answer:

Place the antenna in an open outdoor area with the text side down. Effective positioning data will be received 45 seconds after turning it on


 Answer:
  • Send the following command to change the baud rate to 115200
$PMTK251,115200*1F<CR><LF>
  • Send the following command to restore the baud rate to the default 9600:
$PMTK251,9600*17<CR><LF>


 Answer:

L76 GPS HAT ERR1.png
As shown in the figure below, make sure to choose No in the first step to avoid outputting the login shell information of the Raspberry Pi to the serial port, which could cause a serial port conflict. Then choose Yes in the second step.

L76X GPS Module rpi serial.png


 Answer:

L76 GPS HAT useerr2.png
If the above phenomenon occurs when in use, please check the Raspberry Pi config.txt configuration by running `sudo nano /boot/config.txt`. Please comment out the following statement, as it is the temperature sensor occupying the serial communication line; L76 GPS HAT useerr3.jpg


 Answer:

It is standby mode, please put it to OFF, otherwise it will be standby when it is turned on, and there is no GPS output


 Answer:

In the main.py of the Python program, the update rate is modified on line 12, which defaults to 400ms. You can find the corresponding macro definition in L76X.py and replace it as needed
L76X GPS HAT python0.png
L76X GPS HAT python1.png


 Answer:

Check if the STANDBY switch is in the OFF position, then press the FORCE_ON button for about 1 second and observe if there is any data output on the serial port. If there is still no data output, check if the TXD and RXD pins are connected correctly


 Answer:
The positioning accuracy is related to the environment, the first factor is the weather, there is a lot of moisture in the air on rainy days, which affects the transmission of signals. This is also why mobile phone signals are slightly weaker in summer. Summer has more rain and higher humidity, coupled with the high temperature evaporation, there is more moisture in the air, which affects the transmission of satellite signals. The second factor is the high-rise building effect. If located near some high-rise buildings, it can easily cause issues with poor satellite signal or signal deviation. In lower floors of buildings or underground structures such as underground parking lots, underground malls, subways, tunnels, etc., due to the obstruction by walls, the indoor signal attenuation is very significant, forming signal coverage weaknesses. This results in inaccurate positioning and large errors. Similarly, in areas obstructed by high mountains, it can also lead to inaccurate positioning. The third factor is the number of satellites. Fewer satellites are placed above rural and remote areas, leading to larger position deviations. In shopping malls, underground metro stations, tunnels, and other areas, signals are heavily attenuated by walls, creating signal coverage weaknesses. This results in imprecise positioning and large errors. Similarly, positioning can also become imprecise under mountainous obstacles. The fourth factor is that satellite signals can be affected by atmospheric ionosphere, ground buildings, forests, water surfaces, and other factors, leading to calculation errors


 Answer:
Please check if the antenna is connected properly, and make sure the side with text is facing down, as the antenna reception is on the side without text


 Answer:
This module positioning only relies on satellite positioning, while mobile phone positioning not only relies on satellite positioning but also depends on AGPS (Assisted Global Positioning System), LBS base station positioning, Wi-Fi positioning, Bluetooth positioning, and various other positioning systems combined. Therefore, mobile phone positioning has faster positioning speeds. In terms of accuracy, it varies in different environments. Additionally, the GPS signals supported by mobile phones and the multiple satellite systems supported by modules are inconsistent. Therefore, there is a certain difference between the data of the module and the mobile phone.


 Answer:
First, ensure that the baud rate for sending commands matches the baud rate for serial output. When the module detects a large number of satellites, setting the baud rate from high to low may not work because the baud rate is too low for the module to send all the data at once. Consider using the SET_NMEA_OUTPUT command to reduce the number of output data fields, and then modify the baud rate.


 Answer:

The function of the jumper cap is to switch the serial port device. When the jumper cap is connected to A, L76B will connect to the USB interface; when connected to B, L76B connects to the Raspberry Pi; when connected to C, the Raspberry Pi connects to the USB (at this time, the module can can be used as a USB to TTL module)


 Answer:
The CAT24C32 is used to provide an ID EEPROM for the Raspberry Pi, which includes vendor information, GPIO mapping, and valid device tree information, which is the Micro HAT (uHAT) specification introduced by Raspberry Pi. This is to ensure consistency and compatibility with future Raspberry Pi add-on boards and provide a better user experience.


 Answer:
If a rechargeable button battery is used, the module supports charging the button battery on the back under normal power supply. Rechargeable battery ML1220 is recommended


 Answer:
The raw GPS data obtained is unprocessed geographic coordinates, generally referred to as lunar coordinates, and needs to be processed with certain algorithms to achieve accurate positioning. Different maps use different algorithms, so the same coordinate is processed differently on Google and Baidu. The demo provides a Baidu Map algorithm by default for reference.


 Answer:
Place it in an open outdoor area with the antenna text side down, ensuring that there will be location data after it powers on within 45 seconds.


 Answer:

Testing in an open and clear weather environment, the error is within 2.5 meters.


 Answer:

The following takes GNRMC as an example to parse the obtained positioning information, as follows:
L76 print.png
1200px-L76X GNSS Date.png


Support




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)