Source: https://mokxi.com/libraries/tinygpsplus
Updated: 2026-11-02

Libraries / Communication
Arduino library · Communication

# TinyGPSPlus: GPS location, speed and time

TinyGPSPlus (included as TinyGPS++.h) is Mikal Hart’s second GPS parser and the one most current tutorials use. You feed it the characters your GPS module sends, and it keeps a set of objects up to date: gps.location, gps.date, gps.time, gps.speed, gps.course, gps.altitude, gps.satellites and gps.hdop.

Open the example in the editor See the calls

Built in on Mokxi: #include <TinyGPS++.h> and it builds, with nothing to install. Free, and no account needed.

## What TinyGPSPlus does

Each object can tell you two things before you read it. isValid() says whether the module has ever reported that value, and isUpdated() says whether it changed since you last read it. That makes a sketch simple: feed encode() everything that arrives, then print the location only when gps.location.isUpdated() is true.

For a field the library does not parse, TinyGPSCustom watches any term of any sentence, for example the PDOP in a GPGSA sentence. And TinyGPSPlus::distanceBetween() and courseTo() work out the distance and bearing between two points, which is most of a geocaching or return-to-home sketch.

Library Manager name | TinyGPSPlus

Author | Mikal Hart

Include | #include <TinyGPS++.h>
#include <TinyGPSPlus.h>

Boards | every board Mokxi compiles for but ATtiny85

In the simulator | Simulated: it runs against the part the way it does on the bench.

Parts it drives | GPS module, NEO-6M

## Install it

It builds on every board Mokxi compiles for but ATtiny85.

In Mokxi it is built in: #include <TinyGPS++.h> and the sketch compiles, with no download, no zip and no Library Manager.

On a real board, install "TinyGPSPlus" by Mikal Hart from the Arduino IDE’s Library Manager (Sketch, Include Library, Manage Libraries), or add TinyGPSPlus to lib_deps in PlatformIO. Mokxi follows the calls of release 1.0.3, so a sketch written here builds there too.

ESP32-C3 · Arduino Uno · Arduino Nano · Arduino Mega 2560 · Arduino Leonardo · SparkFun Pro Micro · Arduino Micro · ESP32-C6 · Raspberry Pi Pico · Raspberry Pi Pico W · Seeed XIAO SAMD21 · STM32 · STM32 Nucleo-F411RE · STM32 Blue Pill · micro:bit V2 · Arduino Uno R4 · ESP32 DevKit · ESP32-S3-DevKitC-1 · ESP8266 NodeMCU · Arduino Pro Mini 3.3 V · Seeed XIAO ESP32-C3 · ESP32-C3 SuperMini · Seeed XIAO ESP32-C6 · ESP32-DevKitC V4 · LOLIN32 Lite · Wemos D1 R32 · Cheap Yellow Display · TTGO T-Display · Seeed XIAO ESP32-S3 · Arduino Nano ESP32 · Arduino Nano RP2040 Connect · Seeed XIAO RP2040 · Waveshare RP2040-Zero · Arduino Uno R4 WiFi

## The calls you will use

In the order a sketch meets them.

### TinyGPSPlus gps

Creates the parser.

### gps.encode(c)

Feeds one character. Call it for every byte the module sends.

### gps.location.isValid()

True once the module has reported a position fix.

### gps.location.lat()

Latitude in degrees as a double; gps.location.lng() is longitude.

### gps.time.hour()

The UTC hour, with minute() and second(); gps.date.year(), month() and day() give the date.

### gps.speed.kmph()

Ground speed in kilometers per hour, or mph(), knots() and mps().

### gps.satellites.value()

How many satellites are in use.

### gps.charsProcessed()

How many characters encode() has seen. Under 10 after a few seconds means nothing is reaching the board.

### TinyGPSPlus::distanceBetween(lat1, lng1, lat2, lng2)

The distance in meters between two points.

### TinyGPSCustom pdop(gps, "GPGSA", 15)

Watches the 15th term of GPGSA sentences; pdop.value() is its text.

## Example: GPS position

On the Arduino Uno R3. It runs in the browser exactly as printed.

sketch.ino · Arduino Uno R3

Open it in the editor, wired and ready to run · GPS position: the project page

## Common errors and how to fix them

### No GPS detected: check wiring.

This is the example’s message when charsProcessed() stays under 10. The module’s TX goes to the board’s RX pin; check the baud rate (9600 for a NEO-6M) and that the module has power.

### Characters arrive but location is never valid

The module has no fix yet. Its LED blinks once a second when it has one. Move outdoors, give a cold start a few minutes, and check isValid() before printing.

### Location updates only every few seconds

The loop spends too long in delay() and the serial buffer overflows. Remove long delays and call encode() on every byte as it arrives, then do the slow work less often with millis().

## Projects that use TinyGPSPlus

Built-in projects that include it. Each page has the full sketch and opens in the editor, already wired.

GPS logger A NEO-6M on the Mega’s second serial port and a microSD card: every position goes into TRACK.CSV, which you can watch grow and download.

## Keep going

### Learn

- Arduino NEO-6M GPS: Wiring, TinyGPS++ and Code

### Parts

- GPS module, NEO-6M

### More communication libraries

- OneWire
- TinyGPS
- MFRC522
- SoftwareSerial
- AltSoftSerial
- i2cdetect
- Keyboard
- Mouse

Every built-in library · Open the editor

## Try TinyGPSPlus without installing anything

Open the example, change the sketch, and keep your version in a free account.

Start building free

Open the editor
