Introduction
GPS parsing module. Can send commands to, and parse simple NMEA data sentences from serial and I2C GPS modules to read latitude, longitude, and more.
Dependencies
This driver depends on:
Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle.
Installing from PyPI
On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally from PyPI. To install for current user:
pip3 install adafruit-circuitpython-gps
To install system-wide (this may be required in some cases):
sudo pip3 install adafruit-circuitpython-gps
To install in a virtual environment in your current project:
mkdir project-name && cd project-name
python3 -m venv .venv
source .venv/bin/activate
pip3 install adafruit-circuitpython-gps
Usage Example
See examples/gps_simpletest.py for a demonstration of parsing and printing GPS location.
Important: Feather boards and many other circuitpython boards will round to two decimal places like this:
>>> float('1234.5678')
1234.57
This isn’t ideal for GPS data as this lowers the accuracy from 0.1m to 11m.
This can be fixed by using string formatting when the GPS data is output.
An implementation of this can be found in examples/gps_simpletest.py
import time
import board
import busio
import adafruit_gps
RX = board.RX
TX = board.TX
uart = busio.UART(TX, RX, baudrate=9600, timeout=30)
gps = adafruit_gps.GPS(uart, debug=False)
gps.send_command(b'PMTK314,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0')
gps.send_command(b'PMTK220,1000')
last_print = time.monotonic()
while True:
gps.update()
current = time.monotonic()
if current - last_print >= 1.0:
last_print = current
if not gps.has_fix:
print('Waiting for fix...')
continue
print('=' * 40) # Print a separator line.
print('Latitude: {0:.6f} degrees'.format(gps.latitude))
print('Longitude: {0:.6f} degrees'.format(gps.longitude))
These two lines are the lines that actually solve the issue:
print('Latitude: {0:.6f} degrees'.format(gps.latitude))
print('Longitude: {0:.6f} degrees'.format(gps.longitude))
Note: Sending multiple PMTK314 packets with gps.send_command() will not work unless there is a substantial amount of time in-between each time gps.send_command() is called. A time.sleep() of 1 second or more should fix this.
Documentation
API documentation for this library can be found on Read the Docs.
For information on building library documentation, please check out this guide.
Contributing
Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.
Metadata
Release files for adafruit-circuitpython-gps 4.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| adafruit_circuitpython_gps-4.0.0.tar.gz | 43.0 kB | Without provenance | Details for adafruit_circuitpython_gps-4.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| adafruit_circuitpython_gps-4.0.0-py3-none-any.whl | Python 3 | none | any | Details for adafruit_circuitpython_gps-4.0.0-py3-none-any.whl |
Total release size: 56.0 kB
Release files / adafruit_circuitpython_gps-4.0.0.tar.gz
| Download URL | adafruit_circuitpython_gps-4.0.0.tar.gz |
|---|---|
| Size | 43.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
51419d7117ece5db3e335206dab577a3e806122e37b9704e2d4c3d18a52bde10
|
|
BLAKE2b-256 checksum How to use checksums |
d4266c8d56a17d5d2df0cf602cd2e689df2fd545f04062e7971d8f48ab77e85e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.16
|
Release files / adafruit_circuitpython_gps-4.0.0-py3-none-any.whl
| Download URL | adafruit_circuitpython_gps-4.0.0-py3-none-any.whl |
|---|---|
| Size | 13.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
04a39b098c5abf767bb23d5f69e92f80e7b9833efd15e6c80928e9d3a1075c6e
|
|
BLAKE2b-256 checksum How to use checksums |
7c4f51405858f18616785a2ab108b96c9f47c679b4ab4a658725fc2692c18c72
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.16
|
Security for adafruit-circuitpython-gps 4.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.