|
|
# PainlessMesh Technical Documentation
|
|
|
|
|
|
PainlessMesh creates a self organizing and repairing network where all nodes are connected. The network uses a star topology, avoiding any circular paths. Messages between different nodes are sent in JSON format, making them easy to understand and produce. Information on the JSON schema used for the various messages can be found [here](https://gitlab.com/BlackEdder/painlessMesh/wikis/mesh-protocol).
|
|
|
PainlessMesh creates a self organizing and repairing network where all nodes are connected. All nodes in the mesh are equal. The network uses a star topology, avoiding any circular paths. Messages between different nodes are sent in JSON format, making them easy to understand and produce. Information on the JSON schema used for the various messages can be found [here](https://gitlab.com/BlackEdder/painlessMesh/wikis/mesh-protocol).
|
|
|
|
|
|
## Network layout
|
|
|
|
|
|
Every node acts as an accesspoint (AP) for other nodes to connect to and as a client to connect to one AP of another node. There is a limit of 4 station nodes per AP. This limit is fixed by ESP8266 SDK.
|
|
|
|
|
|
Each node which is not already/anymore connected to an AP, scans for AP's from other nodes periodically.
|
|
|
|
|
|
From all AP's found while scanning, which are not already present in the list of connections or sub-connections, the AP with the strongest signal is connected to. By only connecting to unknown APs the mesh avoids the creation of network loops, such that there is a single route between each pair of nodes in the mesh.
|
|
|
|
|
|
All nodes in the mesh are equal, such that there is no central node.
|
|
|
Each node which is not already/anymore connected to an AP, scans for AP's from other nodes periodically. It will connect to the AP with the strongest signal, which is not already present in the list of connections or sub-connections, i.e. which is not known yet to the node. By only connecting to unknown APs the mesh avoids the creation of network loops, such that there is a single route between each pair of nodes in the mesh.
|
|
|
|
|
|
![sample](/uploads/eb0fa85b72a506dc2b49d5d7711df6cb/sample.png)
|
|
|
The direction of the arrow represents the direction in which the connection is made.
|
|
|
The direction of the arrow represents the direction in which connections are made.
|
|
|
|
|
|
## Node Sync
|
|
|
|
|
|
A list of connections of a node is stored and for each connection a list of sub-connections is also stored. (Note: the list of connections contains the connections which are received by the node, but also the connection (max 1) that are initiated by the node.). Every node knows the complete network topology.
|
|
|
A list of connections of the node is stored and for each connection a list of sub-connections is also stored. (Note: the list of connections contains the connections which are received by the node and the connection (max 1) that are initiated by the node.). Every node knows the complete network topology.
|
|
|
|
|
|
The list of sub-connections per node is obtained by a request/response message. The request contains the sub-connections of the requesting node, and the response contains the sub-connections of the responding node. The collection of sub-connections returned, always excludes the requesting connection and its sub-connections.
|
|
|
The list of sub-connections per node is obtained by a request/response message. The request contains the sub-connections of the requesting node, and the response contains the sub-connections of the responding node. The collection of sub-connections returned, always excludes the requesting connection and its sub-connections. For more information see the [protocol information](https://gitlab.com/BlackEdder/painlessMesh/wikis/mesh-protocol#routing-information)
|
|
|
|
|
|
Cases in which a new node sync is done
|
|
|
|
... | ... | |