Skip to content

the-Drunken-coder/Meshtastic-pinger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Meshtastic Pinger

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.

Quick start

  1. Install dependencies (inside the workspace or a virtual environment):

    python -m pip install -r requirements.txt
  2. Create a meshtastic_pinger.json file in the project root or in the meshtastic_pinger/ directory. The file should at least define target_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_node is required; all other values honor sensible defaults or can be provided through environment variables.

  3. 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_port when needed.

  4. 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.

Configuration

You can override defaults via environment variables:

  • MESHTASTIC_PINGER_CONFIG – path to a JSON file (defaults to meshtastic_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 to lat, lon, hdop, satellites, fix_quality, time, date, timestamp, snr, or radio_snr).
  • MESHTASTIC_PINGER_RADIO_MODE – Meshtastic modem preset (e.g., longfast, mediumslow, shortturbo). Defaults to longfast.

Default template: GPS {lat:.6f},{lon:.6f} sats {satellites} hdop {hdop:.1f} {time}.

Testing

Install pytest if it's not already available, then run the unit tests with:

python -m pip install pytest
python -m pytest

Meshtastic Listener

To log incoming Meshtastic messages from a USB-connected radio, run:

python -m meshtastic_listener

Or directly:

python -m meshtastic_listener.listener

By default, it will auto-detect the radio port and log messages to meshtastic_messages.log.

Configuration

You can override defaults via environment variables:

  • MESHTASTIC_LISTENER_CONFIG – path to a JSON file (defaults to meshtastic_listener.json).
  • MESHTASTIC_LISTENER_RADIO_PORT – serial port for the Meshtastic radio.
  • MESHTASTIC_LISTENER_OUTPUT – path to the output log file (defaults to meshtastic_messages.txt).
  • MESHTASTIC_LISTENER_RADIO_MODE – Meshtastic modem preset. Defaults to longfast.

Meshtastic Mapper

To visualize GPS coordinates from logged messages, run:

python -m meshtastic_mapper

This 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

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages