Low Powered Mesh Network stack

From Embedded Systems Learning Academy
Revision as of 05:19, 15 September 2013 by Preet (talk | contribs)

Jump to: navigation, search

Intro

This article describes the mesh network design. The examples of using the source code (Sourceforge) are described towards the end of Wireless Nodes Projects.

Features

  • Addressed network with auto-retries, and auto-acknowledge
  • Minimal RAM/ROM footprint, with NO HEAP usage
  • Each node can participate in the mesh network to deliver packets to a destined node.
  • Each packet may dictate maximum hops it can take.
  • Self-Healing Routes.
    Routes are rediscovered and deleted as appropriate.


Acknowledgment

Inspiration was taken from Atmel's lightweight mesh, however, the code was completely rebuilt from the ground up and detailed testing was performed during each development step. In general, simplicity was favored and a clean API was targeted such that integration with projects for the open-source community can benefit.


Detailed Features

  • Each packet sent can use existing route, and if route has changed, a new route is automatically discovered using a special retry packet.
  • Each node's ACK contains some piggy-back data about the node itself.
    This data includes information about its routing table, and other statistics
  • Duplicate packets are absorbed but an ACK is still replied if its a duplicate, but a retry packet.
  • An ACK packet or a response to an ACK all use retries; even the repeating nodes participate to make sure the packet is delivered.

There is no "out-of-the-box" support for sleeping nodes, however, any sleeping node can wake up, transmit a packet and go back to sleep without affecting the rest of the network. This mesh network design doesn't rely on any node to be a medium as routes can change dynamically. With this said, there are a few improvements that could be made :

  • Use RSSI to dictate if a route should be changed.
  • Use a counter to prefer a route that sends us data more often.

Payload

The minimum payload is 9 bytes, of which, 8 bytes will be the mesh header overhead. The higher the payload, the higher the efficiency of the network. The eight bytes of payload header contains the network source and destination information, along with packet type and hop count information.

For example, if the payload size is 32 bytes, then 8 bytes are used by the network header and 24 bytes are free to be used. Please take a look at the mesh_packet_t structure to understand the data of the wireless packet. The only relevant fields you need to know about are :

  • data_len : Size of the valid data bytes
  • data[0] - data[23] : Actual data bytes.
Wireless Packet Structure
4 Byte Header 2 Byte Network Address 2 Byte Physical Address 24 Byte User Data
B0 B1 B2 B3 B4 B5 B6 B7 B8 - B31
data_len Do not use data[0] - data[23]

Example Mesh Network

Node Path Discovery

This section shows how a node N1 sends a packet to N4 and discovers the path to N4. There are a few points to note :

  • N1 is essentially sending a "broadcast" message hoping to find N4.
    All nodes in between will repeat this packet once.
    The number of hops the packet can take can be configured though.
  • If N1 doesn't get an ACK back from N4, it will retry a couple of times (default configuration).


N1 trying to send packet to N4, N2 updates its routing table.
N3 (intermediate node) repeating packet, N3 now knows about N1 and N2
N4 receives packet, half routes discovered


ACK Packet Path

Since the ACK packet knows its path (MAC DST is known), intermediate nodes become responsible to deliver the packet to destined node. The same is true when an original packet is sent after this route discovery; if N1 resends a different packet to N4, the next time N2 and N3 will become the responsible nodes to deliver the packet to N4 without N1 having to retry. N1 will only retry if its next destination is not heard repeating the packet, or the ACK is not received back after the timeout.


N4 sending ACK, will ensure N3 repeats it, N3 now knows about N4
N3 sending ACK, will ensure N2 repeats it, N2 now knows about N4
N2 sending ACK, and hoping for the best :)

Route Updates

Path will be healed if N2 disappears