I came across an interesting project on GitHub called MeshTasticator GitHub - GUVWAF/Meshtasticator: Discrete-event and interactive simulator for Meshtastic. , which aims to simulate a mesh network. This inspired me to build a similar simulation as an interactive web app using p5.js: (this link is to the running version, not the editor)
The Simulation
In this web app, you can click on the large gray area to add nodes to the mesh network. Try to keep the nodes less than 100 pixels apart. Clicking on âNode 0 Sendâ will initiate a message transmission from the first node. You will then see the message propagate from node to node. Nodes that are currently transmitting are highlighted with a red circle. Stops once reach the Hop Limit (which can be changed globally)
The number displayed on each node represents the number of messages it has received. This helps visualize how far messages travel within the network.
(the animation is perhaps a bit fast to really see what going on, in reality can go much slower)
Limitations and Simplifications
This is a simplified simulation and doesnât attempt to replicate real-world radio characteristics. Here are some key simplifications:
Perfect transmissions: All transmissions are guaranteed to be received within the set radius (default 100px) by any node within that perfect circle. There is no external interference considered, or that links could be sub-optimal.
Simulated cross-talk: However, the simulation attempts to model cross-talk. When two nodes that are outside of each otherâs transmission range transmit simultaneously; a node in the middle that can hear both transmissions, experience reception failure due to the overlapping signals. This is represented by a red node. (this cross talk was not something I really thought about with meshtastic before building this!)
In reality, messages affected by cross-talk could potentially be retried (donât know if normal firmware does this). This simulation doesnât implement message retries, so each message is only transmitted once from each node.
Message queuing: Each node maintains a perfect queue where all messages are stored and retransmitted once thereâs a gap in transmissions (duty cycle permitting). A second red number on a node indicates the number of messages queued waiting for transmission, if duty cycle is blocking transmission. Queue will clear, when duty cycle allows.
No automated replies are implemented. It just sends out a message from a node (although can have multiple senders at once!), and see it get retransmitted. Also all nodes re-transmit, no different roles (eg some repeaters that donât generate their own messages)
The units are approximate. Theyâve been kinda tuned, but the units might be off, the key thing is can just vary them to see relative effect.
Settings
You can adjust various settings in the simulation. Nodes can be configured to transmit automatically at set intervals instead of relying on manual button clicks. Thereâs also an option to have all nodes transmit simultaneously (which can get visually overwhelming). Play around with the sliders to see how these settings impact the network.
Can also add/remove nodes while simulation running. just click to add a new node. Click a node to remove it.
Metrics
The overall success rate displayed represents the proportion of nodes that have received all transmitted messages. This metric will naturally be lower if you have isolated groups of nodes outside of each otherâs transmission range, as some nodes will never be able to receive all messages.
Editing the Code
If youâre interested in modifying the code behind this simulation, you can access it through this link: p5.js Web Editor . This online editor requires some familiarity with JavaScript and p5.js. Editing this link will create a copy that you can save if you sign up for an account. No danger of breaking the version above!