FREE Shipping on All Orders.

ZOON- LoRa Mesh

Mesh network architecture is a crucial part of IOT and swarm applications. All Zoon models come with built-in mesh functionality that enables you to broadcast the message to all receivers or send to certain Zoon modules.

MESH DATA FORMAT

0x7E , 2 BYTES DESTINATION ID (MSB ORDER), 2 BYTES LENGTH (MSB ORDER), DATA BYTES

 

 

Send DESTINATION ID as 0 to Broadcast data to all ZOON receivers  

 You will need to configure 2 settings parameter from depending on your need:

isMesh4Bytes : Whether id used to send to ZOON is 4bytes (isMesh4Bytes = true) 
or is 2bytes (isMesh4Bytes = false).This parameter is implemented
to be compatible with ipv4.
isEmitMeshSourceId: Will emit the source id of the received
message packet in the format above, if it is set to true.
Will only print the received message without the sourceId
of the node if it is set to false.

EXAMPLE C++ Code to convert data bytes to ZOON acceptable mesh format

static uint8_t mesh_buffer[MAX_BUFFER_SIZE+5];
int to_lora_buffer(uint16_t destinationId,uint8_t* data_buffer,int length,uint8_t* mesh_buffer) {
        
    const int start = 5;
    mesh_buffer[0] = 0x7E;  // MESH MARK
    mesh_buffer[1] = destinationId >> 8;  // DESTINATION ID
    mesh_buffer[2] = destinationId & 0xFF;
    mesh_buffer[3] = length >> 8;       // LENGTH
    mesh_buffer[4] = length & 0xFF;

    for (int i = 0; i < length; i++) {
            mesh_buffer[i+start] = data_buffer[i];
        }
    return start + length;
}
 

Easy c++(Linux/Unix) send,receive and mesh parsing codes are implemented at this git repository
https://github.com/maksimpiriyev/TestZoon

 

    meshParser.isMesh4Bytes = false; // 2bytes for the id
    meshParser.isEmitMeshSourceId = true; // received data is structured mesh data

    char *data = "1234567890abcdefghijklmnopqrstuvwxyz";
    char mesh_buffer[10*1024];
    unsigned int sourceId = 0;

    // adding data for destinationId: 5
    int ml = meshParser.addMesh((uint8_t *)data,strlen(data),35005,(uint8_t *)mesh_buffer);
    meshParser.addToBuffer((uint8_t *)mesh_buffer,ml);

    // adding data for destinationId: 7
    ml = meshParser.addMesh((uint8_t *)data,strlen(data),7,(uint8_t *)mesh_buffer);
    meshParser.addToBuffer((uint8_t *)mesh_buffer,ml);

    // Receiving and parsing
    while(ml = meshParser.receivedMessage((uint8_t *)mesh_buffer,1024,sourceId)){
        printf("source %d : ",sourceId);
        for(int i=0;i<ml;i++){
            printf("%c",mesh_buffer[i]);
        }
        printf("\n");
    }

Leave a comment

Please note, comments must be approved before they are published