Skip to main content

Introduction

Documentation Status Discord Build Status Code Style: Ruff

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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

adafruit_circuitpython_gps-4.0.0.tar.gz (43.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

adafruit_circuitpython_gps-4.0.0-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file adafruit_circuitpython_gps-4.0.0.tar.gz.

File metadata

File hashes

Hashes for adafruit_circuitpython_gps-4.0.0.tar.gz
Algorithm Hash digest
SHA256 51419d7117ece5db3e335206dab577a3e806122e37b9704e2d4c3d18a52bde10
MD5 71de7e4bfd022ebbb495ffaf81e56a28
BLAKE2b-256 d4266c8d56a17d5d2df0cf602cd2e689df2fd545f04062e7971d8f48ab77e85e

See more details on using hashes here.

File details

Details for the file adafruit_circuitpython_gps-4.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for adafruit_circuitpython_gps-4.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 04a39b098c5abf767bb23d5f69e92f80e7b9833efd15e6c80928e9d3a1075c6e
MD5 7c767c84eb09dd8a3f84e7a3465fba30
BLAKE2b-256 7c4f51405858f18616785a2ab108b96c9f47c679b4ab4a658725fc2692c18c72

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

4.0.0 This release

2 files

3.11.10

2 files

3.11.9

2 files

3.11.8

2 files

3.11.7

2 files

3.11.6

2 files

3.11.5

2 files

3.11.4

2 files

3.11.3

2 files

3.11.2

2 files

3.11.1

2 files

3.11.0

2 files

3.10.16

2 files

3.10.15

2 files

3.10.14

2 files

3.10.13

2 files

3.10.12

2 files

3.10.11

2 files

3.10.10

2 files

3.10.9

2 files

3.10.8

2 files

3.10.7

2 files

3.10.6

2 files

3.10.5

2 files

3.10.4

2 files

3.10.3

2 files

3.10.2

2 files

3.10.1

2 files

3.10.0

1 file

3.9.10

1 file

3.9.9

1 file

3.9.8

1 file

3.9.7

1 file

3.9.6

1 file

3.9.5

1 file

3.9.4

1 file

3.9.3

1 file

3.9.2

1 file

3.9.1

1 file

3.9.0

1 file

3.8.1

1 file

3.8.0

1 file

3.7.1

1 file

3.7.0

1 file

3.6.8

1 file

3.6.7

1 file

3.6.6

1 file

3.6.5

1 file

3.6.4

1 file

3.6.3

1 file

3.6.2

1 file

3.6.1

1 file

3.6.0

1 file

3.5.2

1 file

3.5.1

1 file

3.5.0

1 file

3.4.1

1 file

3.4.0

1 file

3.3.0

1 file

3.2.4

1 file

3.2.3

1 file

3.2.2

1 file

3.2.1

1 file

3.2.0

1 file

3.1.1

1 file

3.1.0

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page