TinyGPS++ GPS Library
Overview
A library that extracts location, date, time, speed, and other data from NMEA sentences provided by GPS modules. Compatible with all UART-based GPS modules.

Compatible Modules
UART-based GPS modules (e.g., NEO-6M, NEO-7M, NEO-8M…)
Supported GPIO
- Raspberry Pi 0~4
- Raspberry Pi 5
- BeagleBone Black/Green
- Jetson Nano
- FT232H, FT2232H, FT4232H
- MCP2221
- USB-UART converter modules (FT232RL, CP2102, PL2303, CH340…)
Commands
[INIT]
Initializes the module and configures communication parameters.
Item | Type | Description |
---|---|---|
Baud rate (bps) | WRITE | Sets the communication speed of the GPS module. |
Baud rate varies by GPS module. For example, the default baud rate for ublox NEO GPS modules is 9600. If the baud rate doesn’t match, valid data cannot be received from the GPS module.
[READ_DATA]
Reads latitude, longitude, date, time, and other data from the module.
Item | Type | Description |
---|---|---|
Satellites | READ | Number of satellites currently available for reception. |
HDOP | READ | Horizontal Dilution of Precision. Indicates satellite reception quality – lower values mean better reception. (≤2: Excellent, ≤3: Good, ≤5: Fair, ≥6: Poor) |
Latitude(º) | READ | Current position latitude. |
Longitude(º) | READ | Current position longitude. |
Age (ms) | READ | Time elapsed since last position update in milliseconds. Values over 1500ms may indicate reception issues. |
UTC Date | READ | UTC date. |
UTC Time | READ | UTC time. |
Altitude(m) | READ | Current position altitude. |
Course(º) | READ | Current heading direction in degrees relative to true north. |
Course Cardinal | READ | Current heading direction as compass cardinal direction (e.g., NE). |
Speed(km/h) | READ | Current movement speed. |
Satellites Valid | READ | Indicates whether the satellite count is valid. Data is reliable only when True; False indicates unreliable data. |
HDOP Valid | READ | Indicates whether HDOP value is valid. |
Location Valid | READ | Indicates whether location data is valid. |
Date Valid | READ | Indicates whether date is valid. |
Time Valid | READ | Indicates whether time is valid. |
Altitude Valid | READ | Indicates whether altitude is valid. |
Course Valid | READ | Indicates whether course direction is valid. |
Speed Valid | READ | Indicates whether speed is valid. |
[DISTANCE_BETWEEN]
Calculates distance between current position and destination.
Item | Type | Description |
---|---|---|
Latitude(º) | WRITE | Enter destination latitude. |
Longitude(º) | WRITE | Enter destination longitude. |
Distance to Destination(km) | READ | Distance from current position to destination. |
Location Valid | READ | Indicates whether calculated distance is valid. |
[COURSE_TO]
Calculates bearing from current position to destination.
Item | Type | Description |
---|---|---|
Latitude(º) | WRITE | Enter destination latitude. |
Longitude(º) | WRITE | Enter destination longitude. |
Bearing to Destination | READ | Bearing to destination in degrees relative to true north. |
Bearing Cardinal | READ | Bearing to destination as compass cardinal direction (e.g., NE). |
Bearing Valid | READ | Indicates whether bearing is valid. |
Example
Objective
Display current position latitude and longitude on dashboard label widgets.
Parts
Part | Quantity |
---|---|
Raspberry Pi 4 * | 1 |
NEO-6M | 1 |
* Other compatible hardware may be used. See Supported GPIO for details.
Wiring
Connect each NEO-6M pin to the corresponding GPIO pin as listed in each row below.
NEO-6M | GPIO |
---|---|
VCC | 3.3V |
GND | GND |
RX | 14 (UART TX) |
TX | 15 (UART RX) |

Indoor reception is not possible, so the antenna must be placed outdoors or near a window.
The ceramic part of the antenna should face skyward to receive satellite signals.
The ceramic part of the antenna should face skyward to receive satellite signals.