CircuitPython & Python Setup

You can easily use a GPS module with Python or CircuitPython code in addition to Arduino.  Python code is well suited for parsing and processing the text output from GPS modules, and this Adafruit CircuitPython GPS module handles most of the work for you!

CircuitPython MicroController Wiring

First make sure to wire up the GPS module to your CircuitPython board so that the hardware UART pins are used.  Here's an example with the Metro M0 Express:

  • Board 5V or 3.3V to GPS module VIN.
  • Board GND to GPS module GND.
  • Board serial TX to GPS module RX.
  • Board serial RX to GPS module TX.

Python Computer Wiring

Since there's dozens of Linux computers/boards you can use we will show wiring for Raspberry Pi. For other platforms, please visit the guide for CircuitPython on Linux to see whether your platform is supported.

Here you have two options: An external USB-to-serial converter, or the built-in UART on the Pi's TX/RX pins. Here's an example of wiring up the USB-to-serial converter:

  • GPS Vin  to USB 5V or 3V (red wire on USB console cable)
  • GPS Ground to USB Ground (black wire)
  • GPS RX to USB TX (green wire)
  • GPS TX to USB RX (white wire)
For single board computers other than the Raspberry Pi, the serial port may be tied to the console or not be available to the user. Please see the board documentation to see how the serial port may be used

You can also skip the USB console cable, and just plug a Micro B cable directly from your computer to the Ultimate GPS USB

Here's an example using the Pi's built-in UART:

  • GPS Vin  to 3.3V (red wire)
  • GPS Ground to Ground (black wire)
  • GPS RX to TX (green wire)
  • GPS TX to RX (white wire)

If you want to use the built-in UART, you'll need to disable the serial console and enable the serial port hardware in raspi-config. See the UART/Serial section of the CircuitPython on Raspberry Pi guide for detailed instructions on how to do this.

CircuitPython Installation of GPS Library

Next you'll need to install the Adafruit CircuitPython GPS library on your CircuitPython board.  Remember this module is for Adafruit CircuitPython firmware and not MicroPython.org firmware!

First make sure you are running the latest version of Adafruit CircuitPython for your board.

Next you'll need to install the necessary libraries to use the hardware. Carefully follow the steps to find and install these libraries from Adafruit's CircuitPython library bundle.  For example, the Circuit Playground Express guide has a great page on how to install the library bundle for both Express and non-Express boards.

Remember for non-Express boards like the Trinket M0, Gemma M0, and Feather/Metro M0 basic, you'll need to manually install the necessary libraries from the bundle:

  • adafruit_gps.mpy

You can also download the adafruit_gps.mpy file from the Adafruit CircuitPython GPS releases page.

Before continuing make sure your board's lib folder has the adafruit_gps.mpy file copied over.

Python Installation of GPS Library

You'll need to install the Adafruit_Blinka library that provides the CircuitPython support in Python. This may require verifying you are running Python 3. Since each platform is a little different, and Linux changes often, please visit the CircuitPython on Linux guide to get your computer ready!

Once that's done, from your command line run the following command:

Download: file
sudo pip3 install adafruit-circuitpython-gps
This guide was first published on Aug 23, 2012. It was last updated on Aug 23, 2012. This page (CircuitPython & Python Setup) was last updated on Jan 17, 2020.