This Rust project serves as a bridge between GPS hardware and MQTT-based systems, enabling real-time GPS data integration into IoT and telemetry applications. It reads NMEA-0183 format data from USB GPS dongles, processes the various sentence types, and publishes parsed information to configurable MQTT topics.
- GPS Data Processing: Reads and parses standard NMEA-0183 sentences including position, speed, course, and satellite information
- Real-time MQTT Publishing: Converts GPS data into structured MQTT messages with configurable topics and QoS levels
- High-Frequency Updates: Optional support for 10Hz update rates on compatible u-blox GPS modules
- Flexible Configuration: TOML-based configuration for serial port settings, MQTT broker details, and topic customization
While the software supports standard NMEA-0183 protocols, it has been primarily tested with the TOPGNSS GN800G GPS module (M8030-KT chipset). The 10Hz high-frequency mode specifically targets u-blox compatible devices. Users should exercise caution when using untested GPS hardware. Use it at your own risk!
- Vehicle tracking systems
- Fleet management solutions
- IoT data collection
- Navigation applications
- Telemetry systems integration
Note: This is an ongoing development project. While functional, it may require adjustments for specific use cases or hardware configurations. Contributions and feedback are welcome to improve compatibility and features.
- 📡 Reads NMEA-0183 GPS data from USB GPS dongles
- 🔄 Support for 10Hz GPS update rate (u-blox devices only)
- 🛰️ Parses multiple NMEA sentence types:
- GSV (Satellites in View)
- GGA (Fix Information)
- RMC (Recommended Minimum Data)
- VTG (Track & Speed)
- GSA (Overall Satellite Data)
- GLL (Geographic Position)
- TXT (Text Transmission)
- 📊 Publishes parsed data to MQTT topics
There is a toggle that switches the dongle to 10Hz mode, which might be dangerous on other devices. Use this feature at your own risk. Binary commands with u-blox undocumented commands are pushed to the device for this operation.
To build the project, follow these steps:
-
Ensure you have Rust installed on your system. If not, you can install it from https://www.rust-lang.org/tools/install.
-
Clone the repository:
git clone https://github.com/your-username/gps-to-mqtt.git
-
Change into the project directory:
cd gps-to-mqtt
-
Copy the [example.settings.toml] file to [settings.toml] in the same directory as the executable. Modify [settings.toml] as needed for your configuration:
cp example.settings.toml settings.toml
-
Build the project in release mode:
cargo build --release
-
Run the executable:
./target/release/gps-to-mqtt
src/config.rs
: Module for loading project configuration.src/gps_data_parser.rs
: Module containing the main logic for parsing GPS data.src/mqtt_handler.rs
: Module for setting up MQTT and publishing messages.src/serial_port_handler.rs
: Module for setting up and reading from the serial port.src/main.rs
: Entry point for the application.
MQTT data is stored under the configured base topic (default: /GOLF86/GPS/
) using 3-letter codes as subtopics.
CRS
- Course/heading in degrees (0-359°)TME
- GMT time in HH:MM:SS formatDTE
- Date in dd.mm.YYYY formatLAT
- Latitude in decimal degrees (±90°)LNG
- Longitude in decimal degrees (±180°)SPD
- Ground speed in km/hALT
- Altitude in meters above sea levelQTY
- GPS fix quality (0=invalid, 1=GPS fix, 2=DGPS fix)
SPD_KTS
- Speed in knotsSPD_KPH
- Speed in kilometers per hour
SAT/GLOBAL/NUM
- Total number of satellites in viewSAT/GLOBAL/ANTSTATUS
- Antenna statusSAT/GLOBAL/PF
- Position fix statusSAT/GLOBAL/GNSS_OTP
- GNSS chip configuration
Under SAT/VEHICLES/{PRN}/
where PRN is the satellite ID:
FIX_TYPE
- Fix type (Not Available, 2D, 3D)- Full satellite info string containing:
- PRN number
- Satellite type (GPS/GLONASS/Galileo/BeiDou)
- Elevation angle
- Azimuth angle
- SNR (Signal-to-Noise Ratio)
- In View status
GLL_TME
- Time from GLL sentenceGLL_LAT
- Latitude from GLL sentenceGLL_LNG
- Longitude from GLL sentence
There are also pre build packages (outdated), that combines three individual components: Speeduino-to-MQTT, GPS-to-MQTT, and G86 Web Dashboard in one system with predefined services.
You can quickly get started by using pre-built packages available for both x64 and Raspberry Pi 4 (ARM) architectures:
- DEB Packages for x64: Download here
- DEB Packages for Raspberry Pi 4 (ARM): Download here
- RPM Packages for x64: Download here
- RPM Packages for Raspberry Pi 4 (ARM): Download here
- All packages install the three services in the directory
/opt/g86-car-telemetry
(or/usr/opt/g86-car-telemetry
). - Configuration files for GPS and ECU processors can be found under
/etc/g86-car-telemetry
(or/usr/etc/g86-car-telemetry
). - Web project configurations are located in
/var/www/g86-car-telemetry/config
(or/usr/var/www/g86-car-telemetry/config
). - Ensure to add relevant configurations for MQTT server, TTY ports, and any extra settings.
The packages automatically install and manage the following services:
g86-car-telemetry-gps
g86-car-telemetry-speeduino
g86-car-telemetry-web
These packages have been tested on both Raspberry Pi 4 (ARM) with DEB packages and x86 systems with RPM packages. However, please note that this project is a work in progress, and more tests are needed, especially with real ECUs. Exercise caution when using, and stay tuned for updates as development continues to enhance and stabilize the functionality.
Feel free to reach out if you have any questions or encounter issues. Happy telemetry monitoring! 📊🛠️
This project is licensed under the MIT License. Feel free to use, modify, and distribute the code as per the license terms.