L76X GPS HAT

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

UART GPS Module, supports GPS, BDS, and QZSS
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

Introduction

L76X GPS HAT is a HAT with GNSS (Global Navigation Satellite System) function for Raspberry Pi, Jetson Nano, and Sunburst® X3 PI, supports GPS, BD2, and QZSS positioning systems, with the advantages of small size, low power consumption, fast positioning. With this HAT, your board will be able to easily achieve a global positioning program that provides support for the calibration algorithm of the Baidu map with high accuracy.

Specifications

  • Receiving Channel: 33 tracking channels, 99 capture channels, and 210 PRN channels
  • Receiving Signal: GPS, BD2, and QZSS
  • SBAS Support: WAAS, EGNOS, MSAS, GAGAN
  • Signal Frequency: GPS L1(1575.42Mhz) BD2 B1 (1561.098MHz) C/A Code
  • Capturing Time: Cold start: 10s (Max.); Hot start: 1s
  • Capturing Frequency: -148dBm
  • Tracking Frequency: -163dBm
  • Re-capturing Frequency: -160dBm
  • Positioning Accuracy: <2.5mCEP
  • Maximum Altitude: 18000(M)
  • Maximum Velocity: 515m/s
  • Logic Level: 3.3/5V
  • Communication Interface: UART
  • UART Baudrate: 4800~115200 (default 9600)
  • Refreshing Rate: Max. 10Hz (default 1HZ)
  • Communication Protocol: NMEA 0183 /PMTK
  • Operating Voltage: 2.7V~5V (Power input from 5V pin)
  • Operating Current: 13mA
  • Operating Temperature: -40℃ ~ 85℃
  • Dimensions: 65 x 30.5(mm)
More

Hardware Introduction

L76X GPS HAT Hardware01.png
Standby mode: The module can be put into standby mode using the STANDBY switch, which is a low-power mode. In standby mode, the module stops satellite search and navigation and no positioning information (NMEA messages) is output, but it can be accessed via PMTK commands or any other data.
Backup mode: Pressing the key FORCE ON allows the module to exit the backup mode. Compared to standby mode, backup mode consumes less power. In backup mode, the module stops acquiring and tracking satellites. UART1 is not accessible. However, the backup memory in the RTC domain (including all GPS information needed for fast startup and a few user configuration variables) is acquired. The EASYTM self-generated orbit prediction function is supported for fast positioning. In this mode, the module current is about 7uA. The only way to wake up in backup mode is to pull the FORCE_ON pin high.
CAT24C32: The purpose of this chip is to provide an ID EEPROM for the 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 specific reference). To ensure consistency and compatibility with future Raspberry Pi add-on boards, and to provide a better user experience.
Note: We are not using it here, so ignore it!

Windows UART Debug

  • Install CP2102 driver, switch the serial port of the module to A (yellow cap), and then communicate through USB and L76B.
  • As shown below, connect the antenna, USB cable, and PC. After connecting, you can see the PWR indicator is always on.
  • Place the other end of the antenna where you can see the sky.

L76X Windows.png

  • Wait for 1s, the TXD indicator starts to flash meaning the data transmission.
  • Open the PC serial debugging assistant, set the corresponding serial port number (COM5 in my case), baud rate 9600, 8 bits of data, 1 bit of stop bit, no parity bit, and no flow control.

L76K GPS Module win02.png
Note: 1. Since GPS indoor star search is not stable, please put the module or antenna next to the balcony or window, or experiment directly outdoors.
2. The first time the module is positioned (cold start), under normal conditions (outdoor, good weather, no large buildings blocking), it takes 35 seconds to position successfully, please wait patiently. If the weather conditions are not good, it may take a longer time for positioning, or even impossible to position.
Note: Due to the static drift of GPS, there will be errors between the results seen on Google Earth and the actual ones. The error of the Baidu coordinates calculated by using the demo is particularly small.

Working with Raspberry Pi

Provide C and Python demos for Raspberry Pi.

Enable UART Port

Enable the Raspberry Pi terminal and input the following commands to the config interface:

sudo raspi-config
Choose Interfacing Options -> Serial, close shell visit, open the hardware serial port

Alphabot2-pi-user-manual-10.png


Install Library

If you use the bookworm system, you can only use lgpio library, bcm2835 and wiringPi can't be installed and used.

BCM2835

#Open the Raspberry Pi terminal and run the following command
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, you can refer to the official website at: http://www.airspayce.com/mikem/bcm2835/

WiringPi

#Open the Raspberry Pi terminal and run the following command
cd
sudo apt-get install wiringpi
#For Raspberry Pi systems after May 2019 (earlier than that can be executed without), an upgrade may be required:
wget https://project-downloads.drogon.net/wiringpi-latest.deb
sudo dpkg -i wiringpi-latest.deb
gpio -v
# Run gpio -v and version 2.52 will appear, if it doesn't it means there was an installation error

# Bullseye branch system using the following command:
git clone https://github.com/WiringPi/WiringPi
cd WiringPi
. /build
gpio -v
# Run gpio -v and version 2.70 will appear, if it doesn't it means there was an installation error

lgpio

#Open the Raspberry Pi terminal and run the following command
wget https://github.com/joan2937/lg/archive/master.zip
unzip master.zip
cd lg-master
sudo make install

# You can refer to the official website for more: https://github.com/gpiozero/lg

Python

sudo apt-get update
sudo pip install RPi.GPIO
sudo apt-get install python-serial
sudo apt-get install gpsd gpsd-clients python-gps

Hardware Connection

  • Directly insert the module into the Raspberry Pi, and connect the yellow jumper cap to the B position.

L76X GPS HAT PI08.png

Minicom Debug

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

The default baud rate is 115200, and if the setting baud rate is 9600 plus -b 9600, -D represents the port, /dev/ ttySO is similar to the COM1 of the windows. If it is not Raspberry Pi 3, it should be minicom -D /dev/ttyAMA0, and then connect the module to the Raspberry Pi.
L76X GPS HAT X3PI02.png
Exit: Ctrl + A and then independently press X, YES and Enter.

Example Demo

  • Download the demo:
wget  https://files.waveshare.com/upload/f/f4/L76X_GPS_HAT_Code.zip
unzip L76X_GPS_HAT_Code.zip 
sudo chmod 777 -R L76X_GPS_HAT_Code
cd L76X_GPS_HAT_Code/RaspberryPi
  • C demo:
cd wiringPi
make clean
make
sudo ./main
  • Python demo
cd python
sudo pip3 install pynmeagps
sudo pip3 install gps3
sudo python3 main.py
  • Expected Result

It takes 35 seconds for the module to be positioned for the first time. The front is the raw data output by the module. Time is the time output by the L76X GPS Module. Latitude and longitude are the output latitude and longitude and the directions of latitude and longitude. You can go to Baidu Coordinates System for the latitude and longitude position of the program that needs to be replaced, for example, 116.307629, 40.058359 should be changed to: 40.058359, 116.307629 (Baidu Coordinates System puts the longitude first).

L76X GPS HAT PI11.png

Working with Sunrise X3 PI

Hardware Connection

  • Insert the jumper cap in the B area.
  • Plug the L76x GPS HAT directly on the 40PIN of the X3 PI.

L76X GPS HAT X3PI01.jpg

Install Library

  • Using the terminal, install the library with the following command:
sudo pip3 install pynmeagps
sudo pip3 install gps3
sudo apt-get install python3-serial
sudo apt-get install gpsd gpsd-clients python3-gps

Test with Minicom

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

L76X GPS HAT X3PI02.png
Exit: Ctrl+A and then press X, Yes and Enter.

Example Demo

  • Download the demo:
wget  https://files.waveshare.com/upload/f/f4/L76X_GPS_HAT_Code.zip
unzip L76X_GPS_HAT_Code.zip 
sudo chmod 777 -R L76X_GPS_HAT_Code
cd L76X_GPS_HAT_Code/Sunrise
  • Test the program:
sudo python3 main.py
  • Expecting result:

It takes 35 seconds to wait for the module to be positioned for the first time.
The front is the raw data output by the module.
Time is the time output by the L76X.
You can go to Baidu Coordinates System for the latitude and longitude position of the program that needs to be replaced, for example, 116.307629, 40.058359 should be changed to: 40.058359, 116.307629 (Baidu picks the coordinate system is the longitude first).
L76X GPS HAT X3PI03.jpg

Working with Jetson Nano

Hardware Connection

  • Insert the jumper cap in the B area.
  • Plug the L76x GPS HAT directly into the 40PIN of the Jetson Nano.

Install Library

Using the terminal, install the library with the following command:

sudo pip3 install pynmeagps
sudo pip3 install gps3
sudo apt-get install python3-serial
sudo apt-get install gpsd gpsd-clients python3-gps

Test with Minicom

  • Install minicom.
sudo apt-get install minicom
sudo minicom -D /dev/ttyTHS1 -b 9600

L76X GPS HAT X3PI02.png
Exit: Ctrl+A and then press X, Yes, and Enter.

Example Demo

  • Download the demo.
wget  https://files.waveshare.com/upload/f/f4/L76X_GPS_HAT_Code.zip
unzip L76X_GPS_HAT_Code.zip 
sudo chmod 777 -R L76X_GPS_HAT_Code
cd L76X_GPS_HAT_Code/Jetson\ nano/
  • Test the demo.
sudo python3 main.py
  • Expecting result:

It takes 35 seconds to wait for the module to be positioned for the first time.
The front is the raw data output by the module.
Time is the time output by the L76X.
You can go to Baidu Coordinates System for the latitude and longitude position of the program that needs to be replaced, for example, 116.307629, 40.058359 should be changed to: 40.058359, 116.307629 (Baidu Coordinates System puts the longitude first).

Resources

Documentation

Demo Code

Datasheet

Software

FAQ

 Answer:
Please place the antenna in an outdoor open area, with the word on the antenna facing down, and you can receive valid positioning data after 45 seconds of power on.

{{{5}}}


 Answer:

Send the following commands to chafe the baud rate as 115200:

$PMTK251,115200*1F<CR><LF>

Send the following commands to restore the baud rate as 9600:

$PMTK251,9600*17<CR><LF>

{{{5}}}



 Answer:
L76X GPS HAT FAQ01.png

Make sure that the first step on the side is closed because this will also output the login shell information of the Raspberry Pi to the serial port, resulting in a serial port conflict.
L76X GPS HAT FAQ003.png

{{{5}}}


 Answer:
L76X GPS HAT FAQ02.png

If the above phenomenon occurs during use, please check the Raspberry Pi config.txt configuration, sudo nano /boot/config.txt, please block the following statement, this statement is that the temperature sensor occupies the serial communication line;
L76X GPS HAT FAQ03.jpg

{{{5}}}


 Answer:
It is in standby mode, please set it to OFF, otherwise it will stand by when it is turned on, and there is no GPS output.

{{{5}}}


 Answer:
In main.py in the python program, the 12th line is to modify the update rate. The default is 400ms. You can find the corresponding macro definition in L76X.py and replace it.

L76X GPS HAT FAQ004.png
L76X GPS HAT FAQ005.png

{{{5}}}


 Answer:
Check whether the STANDBY switch is in the OFF position, and then press the FORCE_ON button for about 1 second to observe whether the serial port has data output. If there is still no data output, check if the TXD and RXD pins are connected correctly.
{{{3}}}
{{{4}}}

{{{5}}}


 Answer:
The positioning accuracy is related to the environment in which it is located. First, it is rainy due to weather and there is a lot of moisture in the air, which affects the transmission of signals. This is also the reason why the mobile phone signal is weaker in summer. It is rainy and humid in summer, coupled with high-temperature evaporation, which increases the moisture in the air, thus affecting the transmission of satellite signals. Due to the factor of two high-rise buildings, it is easy to cause poor satellite signals or signal offset problems next to some high-rise buildings. In low-rise buildings or underground buildings, such as underground parking lots, underground shopping malls, subways, tunnels, etc., due to the occlusion of walls, indoor signal attenuation is very large, which forms a weak signal coverage, so the positioning is inaccurate, the error is large, etc., and it is also easy to cause the positioning to be inaccurate under the obstruction of some mountains. The third is the number of satellites. The number of satellites placed over rural and remote areas is small, resulting in large position deviations. Four satellite signals will be affected by factors such as atmospheric ionosphere, ground buildings, forests, water surfaces, etc., resulting in deviations in calculations.

{{{5}}}


 Answer:
Please check whether the antenna is connected well, and the side with words should face down, and the receiving side of the antenna is on the side without words.
{{{3}}}
{{{4}}}

{{{5}}}


 Answer:
This module positioning only relies on satellite positioning alone, and mobile phone positioning not only relies on satellite positioning but also relies on the combination of various positioning systems such as AGPS (Assisted Global Satellite Positioning System), and LBS base station positioning, Wifi positioning, Bluetooth positioning, etc. The positioning has a faster positioning speed, and the accuracy is different in different environments, and the multiple satellite systems supported by the GPS signal of the mobile phone are inconsistent with the multiple satellite systems supported by the module. Therefore, there is a certain difference between the data of the module and the mobile phone positioning.

{{{5}}}


 Answer:
First, ensure that the baud rate of the command sent is the same as the baud rate output by the serial port. When the module searches for a large number of satellites, the baud rate setting from high to low may not be able to be modified, because the baud rate is too low. To send all data, consider using the SET_NMEA_OUTPUT command to reduce the output data field, and then modify the baud rate.

{{{5}}}


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

{{{5}}}


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

{{{5}}}


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

{{{5}}}


 Answer:
The raw GPS data obtained are unprocessed geographic coordinates, generally called lunar coordinates, which need to be added to a certain algorithm to be accurate. Different maps use different algorithms. The same coordinates are on Google and Baidu. processing is different. The program provides a Baidu map algorithm by default, which can be used as a reference.

{{{5}}}


 Answer:
Place it in the open air, with the antenna facing down, to ensure that there will be positioning data within 45 seconds after the device is turned on.

{{{5}}}


 Answer:
Tested in an open environment with clear weather, the error is within 2.5m.

{{{5}}}


 Answer:
The following takes GNRMC as an example to parse the obtained positioning information, as shown below:

L76X GPS HAT FAQ 006.png
L76X GPS HAT FAQ 007.png

{{{5}}}


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 AM GMT+8 (Monday to Friday)