JP GNSS HAT
Driver library for Jimmy Paputto GNSS HATs on Raspberry Pi. Handles the full u-blox UBX protocol and provides a high-level API in C++, C, and Python.
Buy our HATs at jimmypaputto.com — if you have custom u-blox hardware, most of the code will still be useful.
Supported Hardware
The library auto-detects the HAT variant via /proc/device-tree/hat/product.
| HAT | u-blox Module | Interface | USB | RTK | Time Base | Time Mark | Geofencing |
|---|---|---|---|---|---|---|---|
| L1 GNSS HAT | NEO-M9N | SPI | Yes | — | — | — | Up to 4 zones |
| L1/L5 GNSS TIME HAT | NEO-F10T | UART | — | — | Survey-In / Fixed Position | EXTINT GPIO 17 | — |
| L1/L5 GNSS RTK HAT | NEO-F9P | SPI + UART | Yes | Base & Rover | — | — | Up to 4 zones |
Key Features
- Multi-language API — C++ (IGnssHat interface), C (jp_gnss_hat_* functions), Python (CPython extension)
- Full UBX protocol — NAV-PVT, NAV-SAT, NAV-DOP, MON-RF, NAV-GEOFENCE, TIM-TM2
- RTK support — centimeter-level positioning with RTCM3 base/rover corrections
- Time base — nanosecond-accurate timing with Survey-In or Fixed Position
- Time mark — precise EXTINT event timestamping via UBX-TIM-TM2
- Geofencing — up to 4 circular zones with PIO pin output
- Jamming detection — per-band RF interference monitoring
- GPSD integration — NMEA forwarding to virtual serial port
- Thread-safe — event-driven, mutex-protected, no busy-wait loops
- 1–25 Hz measurement rate
Quick Links
- Installation — build and install the library
- Quick Start — get your first position fix in minutes
- C++ API · C API · Python API — full API reference
- Examples — annotated code for every feature
- Troubleshooting — common issues and fixes
Project Structure
GnssHat/
├── src/
│ ├── GnssHat.hpp / .cpp C++ API and implementation
│ ├── GnssHat.h / GnssHat_C.cpp C API wrapper
│ ├── ublox/ UBX protocol, drivers, parsers, data structures
│ └── common/ GPIO, synchronization, utilities
├── python/ Python CPython extension module
├── examples/ C, C++, Python examples + Visualization + GPSD + TimeServer
│ └── BinariesSymlinks/ Symlinks to C++ binaries (created by BUILD_EXAMPLES)
└── scripts/ Build and dependency scripts