Serial / GPS
Read GPS data from serial UART devices. The GPS sensor driver parses NMEA sentences into structured metrics.
Install
pip install plexus-agent[serial]Quick Start
The GPS sensor is auto-detected when plexus start or plexus run scans serial ports:
plexus start --key plx_xxxxxOr use it programmatically:
from plexus.sensors import GPS, SensorHub
from plexus import Plexus
hub = SensorHub()
hub.add(GPS(port="/dev/ttyUSB0", baud=9600))
hub.run(Plexus())GPS Metrics
The driver parses GGA and RMC NMEA sentences and produces:
| Metric | Type | Description |
|---|---|---|
gps_latitude | float | Latitude in decimal degrees |
gps_longitude | float | Longitude in decimal degrees |
gps_altitude | float | Altitude above sea level (meters) |
gps_speed_knots | float | Ground speed in knots |
gps_satellites | int | Number of satellites in use |
gps_hdop | float | Horizontal dilution of precision |
NMEA Protocol
The driver supports the standard NMEA 0183 protocol over serial UART. Most USB GPS receivers (u-blox, GlobalSat, etc.) output NMEA by default.
Supported Sentences
| Sentence | Data |
|---|---|
$GPGGA | Position fix, altitude, satellite count, HDOP |
$GPRMC | Recommended minimum — position, speed, course, date |
Other sentences are silently ignored.
Common Serial Ports
| Device | Port |
|---|---|
| USB GPS receiver (Linux) | /dev/ttyUSB0 or /dev/ttyACM0 |
| Raspberry Pi UART pins | /dev/ttyAMA0 or /dev/serial0 |
| USB GPS receiver (macOS) | /dev/tty.usbserial-* |
Baud Rate
Most GPS modules default to 9600 baud. Some high-update-rate modules (u-blox NEO-M8, M9) can be configured for 38400 or 115200.
Wiring (Raspberry Pi)
For a GPS module connected to the Pi's UART pins:
| GPS Module | Pi Pin |
|---|---|
| TX | GPIO 15 (RXD) |
| RX | GPIO 14 (TXD) |
| VCC | 3.3V |
| GND | GND |
Enable the serial port:
sudo raspi-config
# → Interface Options → Serial Port
# → Login shell: No
# → Serial hardware: YesTroubleshooting
No data received:
- Check the port exists:
ls /dev/tty* - Verify output:
cat /dev/ttyUSB0(you should see NMEA sentences) - Check permissions:
sudo usermod -aG dialout $USER - Ensure baud rate matches your module
Position reads as 0.0:
- GPS needs a clear sky view for initial fix (cold start can take 30-60 seconds)
- Check
gps_satellites— you need at least 4 for a 3D fix
Next Steps
- System Metrics -- Monitor CPU, memory, and disk usage
- Camera -- Stream video from USB and CSI cameras