Difference between revisions of "Template:L76K GPS Module Working with RPI"

From Waveshare Wiki
Jump to: navigation, search
m (Text replacement - "https://www.waveshare.com/w/upload/" to "https://files.waveshare.com/upload/")
 
Line 46: Line 46:
 
cd
 
cd
 
sudo apt-get install unzip -y
 
sudo apt-get install unzip -y
sudo wget https://www.waveshare.com/w/upload/0/05/L76K_GPS_Module_code.zip
+
sudo wget https://files.waveshare.com/upload/0/05/L76K_GPS_Module_code.zip
 
sudo unzip L76K_GPS_Module_code.zip -d ./L76K_GPS_Module_code
 
sudo unzip L76K_GPS_Module_code.zip -d ./L76K_GPS_Module_code
 
sudo chmod 777 -R ./L76K_GPS_Module_code
 
sudo chmod 777 -R ./L76K_GPS_Module_code
 
cd ./L76K_GPS_Module_code
 
cd ./L76K_GPS_Module_code
 
</pre>
 
</pre>
Or click to download the [https://www.waveshare.com/w/upload/0/05/L76K_GPS_Module_code.zip sample demo], unzip it, and put it into the Raspberry Pi.
+
Or click to download the [https://files.waveshare.com/upload/0/05/L76K_GPS_Module_code.zip sample demo], unzip it, and put it into the Raspberry Pi.
  
 
===Environment Config===
 
===Environment Config===

Latest revision as of 06:41, 2 September 2023

Working With Raspberry Pi

Provide C and Python demos for control in Raspberry Pi.

Enable UART Port (Skip if enabled)

Enable the Raspberry Pi terminal and input the following commands to enter the interface.

sudo raspi-config

Choose Interfacing Options -> Serial, close the shell visit, and enable the serial port of the hardware:
L76K GPS Module RPI.png

Hardware Connection

L76K GPS Module RPI02.png

Module Raspberry Pi
VCC 5V
GND GND
TX P15
RX P14
PPS NC

Minicom Debug

Download and install minicom tool:

sudo apt-get install minicom

The corresponding serial port number for the position hardware serial port:

ls -l /dev/serial*

If the system has used the serial port and has been modified, there are two scenarios:
The default state after enabling the UART function:
Raspberry Pi Documentation-GPIO31.png
The state after modifying the UART config.
Raspberry Pi Documentation-GPIO32.png
Need to find the serial port number corresponding to serial0 (that is, the serial port on GPIO), as shown in Figure 1, the serial port number is ttyS0, and Figure 2 is ttyAMA0; use minicom to open the serial port:

sudo minicom -D /dev/ttyS0 -b 9600

-D stands for port. If the serial port number in the previous step is ttyAMA0, then it is:

sudo minicom -D /dev/ttyAMA0 -b 9600

The default baud rate of minicom is 115200, if you need to set the baud rate to 9600, add the parameter -b 9600.
L76X GPS HAT X3PI02.png
Exit: Ctrl+A then press X alone, YES to enter.

Download and Run the Test Demo

Download Demo

cd
sudo apt-get install unzip -y
sudo wget https://files.waveshare.com/upload/0/05/L76K_GPS_Module_code.zip
sudo unzip L76K_GPS_Module_code.zip -d ./L76K_GPS_Module_code
sudo chmod 777 -R ./L76K_GPS_Module_code
cd ./L76K_GPS_Module_code

Or click to download the sample demo, unzip it, and put it into the Raspberry Pi.

Environment Config

Install the related function library of the demo.

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 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 (earlier ones do not need to be executed), 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 there is no installation error
The #Bullseye branch system uses the following commands:
git clone https://github.com/WiringPi/WiringPi
cd WiringPi
./build
gpio -v
# Run gpio -v and version 2.70 will appear if there is no installation error

Python

The new version of the Raspberry Pi system needs to install the GPS data analysis library to run the python3 demo.

cd L76K_GPS_Module_code/RaspberryPi/python3/micropyGPS-master
sudo python setup.py install
#Wait for the library installation to complete

If the old system only supports Python2, the function library is required.

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

C Demo

cd C
make clean
make
sudo ./main

Baidu Coordinates is the converted Baidu map coordinates, copy the coordinates to http://www.gpsspg.com/maps.htm, select Baidu map on the left, and you can see your location (if you go directly to "Baidu Pickup Coordinate System" you need Swap the positions of the two latitude and longitude numbers).
L76K GPS Module07.png

Python 3 Demo

cd python
sudo python main.py

Expected Result
It takes about 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 L76X GPS Module.
Latitude and longitude are the output latitude and longitude and latitude and longitude direction.
Baidu Coordinates is the converted Baidu nao coordinates, copy the coordinates to http://www.gpsspg.com/maps.htm, select Baidu map on the left, and you can see your location (if you go directly to "Baidu Pickup Coordinate System" you need to "Swap" the positions of the two latitude and longitude numbers).
L76K GPS Module08.png

Python 2 Demo

cd python
sudo python 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 L76X GPS Module.
Latitude and longitude are the output latitude and longitude and the directions of latitude and longitude.
Baidu Coordinates is the converted Baidu map coordinates, copy the coordinates to http://www.gpsspg.com/maps.htm, select Baidu map on the left, and you can see your location (if you go directly to "Baidu Pickup Coordinate System" you need Swap the positions of the two latitude and longitude numbers).
L76K GPS Module09.png