Tip
tl;dr With these programs you can monitor meshtastic nodes via mqtt and visualize the message sources, neighbours, or interactions between nodes. Tested under linux.
Set of tools for processing, storing, and visualizing data from Meshtastic mesh networks. It includes scripts for collecting data from an MQTT broker, exporting data to JSON format for visualization, and an HTML/JavaScript-based visualization tool.
Note
Please note this is a very early version of the program under development.
- Copy
config.json.txt
toconfig.json
and change according to your needs - Run
python mesh-collectd.py
somewhere in a background to collect data - After some time, run
python sqlite2json.py
to generate json files for visualization. They should be copied towebpage/data/
- Open
webpage/index.html
in the browser, and you should see the graphs- If it doesn't work you may need to upload
webpage/
to a web server soindex.html
can access json files via ajax.
- If it doesn't work you may need to upload
┌──────────────────────┐
│ │
┌─────┤ sqlite2json.py │
│ │ │ ┌────────────┐
┌──────────────────┐ │ └──────────────────────┘ ┌───│ index.html │
│ │ │ Tool for dumping data │ └────────────┘
│ mesh-collectd.py │ │ │
│ │ │ ┌───────────────┐│
└──────────────────┘ │ │json files ││ data
Daemon for collecting └─────────────────────►│with node data │└─────────────────► display
mqtt data └───────────────┘
- To be run in a background
- Connects to an MQTT broker to receive messages from Meshtastic devices.
- Stores message data, node information, and neighbor relationships in an SQLite database
mqtt_messages.db
.- the initial
mqtt_messages.db
file with some nodes is provided as a hot start
- the initial
- Supports reconnection in case of disconnection.
- Multi-threaded database operations for efficiency.
- To be called periodically as a cron task etc. (see: 4 below)
- Exports message and neighbor data from the SQLite database to JSON files compatible with Cytoscape.js.
- Supports time-window-based filtering for flexible data analysis.
- Generates separate JSON files for physical senders and logical senders.
- To be put on a webserver
- An interactive web interface to visualize mesh network connections using Cytoscape.js.
- Three modes of visualization:
- Messages - showing
from
andto
of messages passed through the network - Traceroute - showing nodes from traceroute requests 🆕
- Physical sender - showing
sender
andto
of messages passed through the network (prototype) - Neighbors - showing connections reported by nodes as
neighbors
(early prototype)
- Messages - showing
- Three layouts: Cose-Bilkent, Circle, and Concentric
- statistics for the messages collected in past 1 and 7 days.
- to be run from cron
- updates hourly database (
mqtt_messages_distilled.db
) - dump json data, copy to web directory, generates timestamp
- as the name suggests, removes old messages and traceroute info from the main database
- Linux machine with Python 3.7 or later (to run
mesh-collectd.py
) - Access to MQTT broker (may be a public one)
- Web server for hosting the HTML visualization (one may try to run in a localhost)
-
Clone the repository:
git clone https://github.com/yourusername/meshtastic-tools.git cd meshtastic-tools
-
Install dependencies:
pip install paho-mqtt
- Configure the MQTT connection:
- Create a
config.json
file in the root directory with the following structure:{ "MQTT_BROKER": "broker_address", "MQTT_PORT": 1883, "MQTT_TOPIC": "meshtastic/+", "CLIENT_ID": "meshtastic-client", "MQTT_USERNAME": "username", "MQTT_PASSWORD": "password", "USE_SSL": false }
- Create a
-
Start the daemon to collect data (in screen etc):
python mesh-collectd.py
-
Export data to JSON (from time to time, as a cron task):
python sqlite2json.py
Open index.html
in a web browser (you may need to run it in a web server to access json files via ajax call). Ensure the JSON files are available in the data/
directory relative to the HTML file.
Message flow | Node interactions | Neighbours |
---|---|---|
![]() |
![]() |
![]() |
Traceroute | Message histogram | Unique nodes seen |
![]() |
![]() |
![]() |
This project is licensed under the MIT License. See the LICENSE
file for details.
- Cytoscape.js: a graph theory library for visualisation and analysis, Franz M, Lopes CT, Huck G, Dong Y, Sumer O, Bader GD Bioinformatics (2016) 32 (2): 309-311