Send GPS fixes from a USB GPS module to a Meshtastic radio over USB without any additional command-line flags. The script detects the configured Meshtastic device, reads NMEA sentences from the GPS module, formats the latest coordinates, and sends them as a direct message to a configured target radio.
-
Install dependencies (inside the workspace or a virtual environment):
python -m pip install -r requirements.txt
-
Create a
meshtastic_pinger.jsonfile in the project root or in themeshtastic_pinger/directory. The file should at least definetarget_node. Example:{ "target_node": "ABCDEFG12345", "send_interval_seconds": 60, "gps_timeout_seconds": 15, "message_template": "GPS {lat:.5f},{lon:.5f} sats {satellites} hdop {hdop:.1f} {time}", "radio_mode": "longfast" }Only
target_nodeis required; all other values honor sensible defaults or can be provided through environment variables. -
Plug in both devices. The radio port is now fully auto-detected (it looks for keywords like “Meshtastic”/“T-Beam” and assumes the other COM port is your GPS), while the GPS reader still allows overriding
gps_portwhen needed. -
Run the pinger with:
python -m meshtastic_pinger
The script will continuously read the GPS device and DM the formatted coordinates to the configured target node. It handles reconnecting to the radio automatically after each message and prints helpful logs to the console.
You can override defaults via environment variables:
MESHTASTIC_PINGER_CONFIG– path to a JSON file (defaults tomeshtastic_pinger.json).MESHTASTIC_PINGER_TARGET_NODE– radio ID or alias to DM.MESHTASTIC_PINGER_RADIO_PORT– serial port for the Meshtastic radio.MESHTASTIC_PINGER_GPS_PORT– serial port for the GPS module.MESHTASTIC_PINGER_INTERVAL– seconds between transmissions.MESHTASTIC_PINGER_GPS_TIMEOUT– seconds to wait for a GPS fix.MESHTASTIC_PINGER_TEMPLATE– message template (can refer tolat,lon,hdop,satellites,fix_quality,time,date,timestamp,snr, orradio_snr).MESHTASTIC_PINGER_RADIO_MODE– Meshtastic modem preset (e.g.,longfast,mediumslow,shortturbo). Defaults tolongfast.
Default template: GPS {lat:.6f},{lon:.6f} sats {satellites} hdop {hdop:.1f} {time}.
Install pytest if it's not already available, then run the unit tests with:
python -m pip install pytest
python -m pytestTo log incoming Meshtastic messages from a USB-connected radio, run:
python -m meshtastic_listenerOr directly:
python -m meshtastic_listener.listenerBy default, it will auto-detect the radio port and log messages to meshtastic_messages.log.
You can override defaults via environment variables:
MESHTASTIC_LISTENER_CONFIG– path to a JSON file (defaults tomeshtastic_listener.json).MESHTASTIC_LISTENER_RADIO_PORT– serial port for the Meshtastic radio.MESHTASTIC_LISTENER_OUTPUT– path to the output log file (defaults tomeshtastic_messages.txt).MESHTASTIC_LISTENER_RADIO_MODE– Meshtastic modem preset. Defaults tolongfast.
To visualize GPS coordinates from logged messages, run:
python -m meshtastic_mapperThis will parse meshtastic_messages.txt and generate an interactive HTML map (meshtastic_map.html) showing:
- All GPS coordinates as markers
- A polyline connecting the points in order
- Clickable markers with detailed information (coordinates, satellites, HDOP, timestamps, delay)
You can specify custom input and output files:
python -m meshtastic_mapper input_file.txt output_map.html