Skip to content

Commit 7fda8fb

Browse files
committed
added usb gps page
1 parent 717a73e commit 7fda8fb

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# USB GPS — VK-162G
2+
3+
## Overview:
4+
5+
**Component Number:** VK-162
6+
7+
* The following documentation is in regard to the following GPS module:
8+
9+
[https://drive.google.com/file/d/1H8cyCdSBa4FFs5ogC8JUG0isAaRp8GWu/view](https://drive.google.com/file/d/1H8cyCdSBa4FFs5ogC8JUG0isAaRp8GWu/view)
10+
* This module works with WindowsOS, MacOS, Linux, Android, and Raspberry pi
11+
12+
### Image:
13+
<img src="VK-162_G-Mouse_USB_GPS.png" width="50%">
14+
15+
## Extracting GPS data:
16+
17+
* The information that the GPS outputs is latitude and longitude data
18+
* The process is very simple, you connect the GPS to your device, then access that data using a python script (shown below) through the serial port displayed in Device Manager (assuming you are using a Windows system)
19+
* Make sure to run this command in the terminal before running the code below:
20+
21+
22+
> pip install pyserial pynmea2
23+
24+
25+
26+
```python
27+
import serial
28+
import pynmea2
29+
30+
\# Replace COMx with your GPS module's COM port (check in Device Manager)
31+
gps\_port \= 'COM7'
32+
baud\_rate \= 9600
33+
34+
ser \= serial.Serial(gps\_port, baud\_rate, timeout\=1)
35+
36+
while True:
37+
try:
38+
line \= ser.readline().decode('utf-8', errors\='ignore')
39+
if line.startswith('$GPGGA') or line.startswith('$GPRMC'):
40+
msg \= pynmea2.parse(line)
41+
print(f"Latitude: {msg.latitude}, Longitude: {msg.longitude}")
42+
except Exception as e:
43+
print("Error:", e)
201 KB
Loading
201 KB
Loading

0 commit comments

Comments
 (0)