

A mesh network is essentially characterized by a typology in which all nodes in network infrastructure communicate directly between them, dynamically, without taking into account any hierarchically. Thus, the nodes cooperate with each other, in order to rout the data efficiently. This lack of dependence between us allows each one to participate in the transmission and reception of information between them. Mesh networks can be organized dynamically through their ability to self-configuration, allowing the dynamic distribution of information flows, especially in situations of failure in one of these knots.

Clone this repository: $ git clone https://github.com/daeynasvistas/LoRa-Mesh/
Using VisualStudio Code (Platformio):
2.1. You can open ESP32 paste and Arduino paste in separate projects.
// Este node e servidor
// 0 = Servidor internet
// 1 = Vizinho de servidor internet
// 2 = Vizinho com um Vizinho de um servidor internet
byte isServer = getIsServer();
String nodeFunction[ 4 ] = { " SINK " , " ESTRADA " , " CAMINHO " , " SOLTEIRO " }; if (msgCount> 10 )
{
message = sendTable ();
sendMessage (message, 255 ); if (msgCount> 10 )
{
message = sendTable ();
sendMessage (message, 255 );String nodeFunction[ 4 ] = { " SINK " , " ESTRADA " , " CAMINHO " , " SOLTEIRO " }; // Posicionamento dos servidores na mesh
switch (incomingMsgHand) {
case 0 :
// statements
if (! arrayIncludeElement (myServers,sender,maxTableArrayServers)){
Serial. println ( " Encontrei um SINK! " +sender);
arrayAddElement (myServers,sender,maxTableArrayServers);
display. drawString ( 0 , 32 , " NOVO: " + String (sender));
}
destination = sender;
break ;
case 1 :
// statements
if (! arrayIncludeElement (myNeighbours,sender,maxTableArrayVizinhos)){
Serial. println ( " Encontrei AUTOESTRADA para SINK! " +sender);
arrayAddElement (myNeighbours,sender,maxTableArrayVizinhos);
display. drawString ( 0 , 32 , " NOVO: " + String (sender));
}
if (isServer!= 0 ){
destination = sender;
}
break ;
case 2 :
// statements
Serial. println ( " Encontrei CAMINHO para SINK! " );
break ;
default :
// statements
break ;
} } else {
// enviar para mais próximo do SINK
destination = myNeighbours[ 0 ];
sendMessage (message, destination);
}To configure you must change main.cpp and include sensors you predict. ESP32 includes pound for BME and Arduino for DHT11
The project uses the #include pound <arduinojson.h> to build JSON that is sent in each node, it included or changing those you want.
void makeData (){
// add some values
array. add (MAC); // <- Lora MAC
array. add ( 1556969160 ); // <-- Timestamp
array. add (bme. readTemperature ());
array. add (bme. readHumidity ());
array. add (bme. readPressure () / 100 . 0F );
array. add ( 0 );
array. add ( 0 );
array. add ( 0 );
array. add ( 0 );
array. add ( 0 );
array. add ( 0 );
// serialize the array and send the result to Serial
// serialize the array and send the result to Serial
serializeJson (doc, Values);
serializeJson (doc, Serial);
Serial. println ( " " );
}32 as maximum in the neighbors table .. or simply change dinamic array
byte const maxTableArrayVizinhos = 32 ; // quantidade de vizinhos pode ser aumentada conform memoria dispo
byte myNeighbours[maxTableArrayVizinhos] = {}; // address of vizinhos directos
byte const maxTableArrayServers = 4 ; // quantidade de servidores ao qual tenho acesso pode ser aumentada
byte myServers[maxTableArrayServers] = {}; // address dos servidores que encontrei This is the result with serial.print in node sink, where all the sensors of all nodes come. Node Sink is responsible for sending JSON ... by Lora (Gateway), by MQTT or the method you prefer










