IoT BLE mesh network design: Algorithms for BLE sensor nodes


IoT BLE mesh network design: Algorithms for BLE sensor nodes

Hardik Shah
in Internet of Things
- 9 minutes

IoT BLE mesh networks and why they are so important

In 2015, Cambridge Silicon Radio(CSR) was acquired by Qualcomm – this probably was the biggest indicator of that time how huge impact BLE mesh would make on our world. CSR was one of the few companies at that time to allow BLE devices to form a mesh even though mesh wasn’t yet a part of standard.

It has only been a year since the release of Bluetooth 5 when mesh networks have been formally adopted by Bluetooth SIG.

Future of IoT in mesh networks: Global mesh, sub-mesh, AR, etc

Mesh networks will bring IoT sensors to life in most cases. These mesh networks could be as small as the sub mesh of your home IoT sensors, or, it could be as big as cross continental mesh networks.

BLE mesh networks are not going to be cross continental, but they for sure won’t be small. Indoor localization, asset tracking, etc clearly illustrate how big and dense these mesh networks can become.

When BLE mesh networks are combined with BLE beacons, they bring a technological advantages to asset tracking and high contextuality of AR applications.

BLE Mesh network routing algorithms that we will discuss in this blog

  • Flood based Trickle routing algorithm
  • Bounded Flooding BLEmesh

In Flooding based BLE mesh, IoT node relies on precomputed broadcasting attempts as their asset to transmit messages towards the target node.

Let’s deeply evaluate how these algorithms work, and how your IoT mesh network can be optimized for performance and energy efficiency.

Trickle routing algorithm for BLE mesh networks

In Trickle routing, we define two types of parameters:

  • The design-time parameters: limits of maxim, minimum Trickle interval; and redundancy constant (decides the threshold for whether they should re-broadcast the message or not)
  • And, run-time parameters: Trickle interval, redundancy counter and the transmission time

Let’s say you define the Trickle Interval to be 10s. During this entire interval, the IoT node will only listen for 0-5s, and would broadcast in 5s-10s. The transmission would randomly happen during 5s-10s window.

The redundancy counter that we spoke about before is increased by a fixed unit whenever the IoT node receives the same message again. If the incremented redundancy counter exceeds the redundancy constant, the message won’t be broadcast by this IoT node.

When this 10s Trickle interval expires, it is doubled till it is equal to the maximum defined Trickle interval for IoT mesh network. When that happens, Trickle counter is set to 0. Now, when a new message arrives to the IoT node, the Trickle interval is set to the minimum Trickle interval, and the cycles mentioned before are repeated.

Disadvantages of using nascent form of Trickle mesh routing

This algorithm helps defining time intervals when messages should be sent within the network, but at the same time doesn’t explains how to do so. Trickle routing implies that all IoT nodes within this BLE mesh network should remain on to observe and broadcast states as long as the network lives.

With low power BLE networks having IoT nodes that are always on creates a huge issue – High battery consumption. We look into how we can optimize battery in trickle mesh routing, but let’s first try to understand how Trickle mesh routing works in case of BLE.

Another disadvantage that Trickle mesh routing brings is that total packet delay could reach as high as = Total time nodes are on + total time the IoT nodes are off.

How Trickle mesh decides when to push data?

We assumed the Trickle mesh interval to be 10s. But, you might prefer to customize the Trickle interval to better optimize you network.

Let’s assume that you have a Trickle Internal T.

Now, your IoT node in this Trickle mesh should have a listening interval of [0, T/2). And, your broadcasting interval should be (T/2, T]. The message transmission from your IoT node can randomly happen any time between (T/2, T] interval. There are no predefined times for transmission in the (T/2, T] ranges.

Introducing wake up and sleep patterns using RTC mechanism

This mandate of the Trickle mesh based routing in the sensor network demands that you keep sensor nodes awake all the time.

What we as engineers can do is to optimize Trickle mesh based routing by Introducing a wake up and sleep pattern.

Wake up mechanisms in IoT sensor nodes utilizes an external RTC mechanism that brings device from sleep to wake-up states. There’s an on time, let’s say “tOn”, and there’s and off time “timeOff”.

During, “tOff” IoT sensor nodes would remain sleep, and during “tOn” they would be woken up by the RTC mechanism. This RTC mechanism will wake up an IoT sensor node after each “tOn” + “tOff” seconds.

When there’s still some pending data to be shared post “tOn” seconds, what happens to an IoT node?

In such case where there are data packets from other nodes post “tOn” seconds, pending to be transmitted – The IoT node extends the time it remains on air. This extended time is then matched with “tOff” in a way that still ensures that the  IoT sensor nodes is still in sync with their neighbouring IoT nodes, and their transmission cycles would overlap.

Note: Before creating an IoT mesh network, always measure the maximum distance between two neighbouring nodes. It will help you avoid designing a poor mesh network.

BLE message propagation in Trickle IoT mesh routing

To prevent a messages being lost from a broadcasted BLE IoT node, these messages are sent throughout the entire mesh network. To prevent message loss, we increase observation and broadcasting intervals of the mesh. So, even if the some sensor nodes aren’t synchronized, the message will still be fetched by multiple other nodes that will broadcast it further.

As we stated before, this method is power hungry. So, there’s a need to optimize this mesh routing for power.

Trickle mesh algorithmic tuning for temperature and humidity sensing

Since changes in temperature and humidity vary slowly over time, these information can be collected less frequently.

Trickle mesh algorithmic tuning for vibration sensing

Detection of the motion/vibration is based on accelerometer readings using polling method. Additionally, a threshold based motion algorithm is used during the sleep of accelerometer in order to catch any potential motion/vibration of interest.

Optimizing Trickle mesh routing for performance

To optimize Trickle routing, we had an IoT setup that has BLE mesh nodes that have an off time, tOff = 9.5 seconds, and on time, tOn = 0.5 seconds. The gateway node had a WLAN connection as well.

Battery specs for IoT mesh network:

In our case the battery specs for gateway: 3.7 V and 8000mAh

And, battery specs for BLE sensor nodes: 3.7 V and 6000mAh

Sensor data capture and processing consumes 301.8 uA in a period of 2.5 ms.

Total current drained during active mode = 4 mA.

(Total duration for BLE communication to be initialized)

This introduction of wake up and sleep patterns of IoT sensor nodes optimizes Trickle routing. Under no optimization the battery consumption is extremely high.

How our modification increased the efficiency of our BLE mesh network?

With this optimization on Trickle routing, our calculations shows that it is possible to get IoT sensor node’s battery life of 589 days. The BLE gateway on the other hand can have a battery life of 511 days. If we optimize the gateway module further, we can increase the battery life by 10-20 days, but that won’t be a part of Trickle routing optimization.

BLEmesh and opportunistic routing

How BLEmesh benefits from opportunistic routing

BLEmesh benefits from opportunistic routing. That being said, if any of the intermediate nodes receives the packet sent by the source, it will suffice. The probability of at least one node receiving the packet is 0.79, thus, approximately 1.27 broadcasts will be needed for the packet to reach any of the intermediate nodes. Adding the additional broadcast performed by the intermediate nodes to send the packet to the destination node, 2.27 broadcasts in total are needed.

Some challenges in Opportunistic routing

The main design challenge of an opportunistic routing is the development of an agreement protocol between the nodes to choose the appropriate forwarder to broadcast the packet to the higher priority, i.e. closer to the destination, nodes. This is done through the creation of forwarders list from the source node, aggregation of packets into batches, and operating batch-wise by using the batch map.

How BLEmesh works

As opposed to just being a routing algorithm, BLEmesh is much more and includes a highly optimized data header that contains information that most data packets contain. The engineering behind BLEmesh truly lies in the information that this data packet contains like Forwarder list and Batch map.

Forwarder list contains the details of participating nodes in the IoT sensor network. Within this forwarder list the destination node has the highest priority and is kept at the top, while the source node of the data packet is kept at the bottom.

Batch map within BLEmesh’s header helps a BLE sensor node in deciding whether to keep a received message or to broadcast it. Upon arrival of batch data to a BLE sensor node, the data header’s Batch map would be inspected to make a final call. If the data packet receiving node is on a lower priority on the Batch map, it would broadcast the message.

BLEmesh’s payload can be calculated by the following formula for k participating nodes in the BLE mesh networks:

BLEmesh: The secret is in energy efficient BLE designs

We created a test set of five BLE sensors nodes to test out the capabilities and comparative performance of BLEmesh.

This is an instance of BLEmesh network being operated, and here you can clearly see how the Batch map gets updated, and each participating sensor network becomes fully aware of each and every participate BLE sensor node.

Here’s how the message broadcasts happen in BLE sensor nodes that are routed using BLEmesh:

IoT mesh networks ble design

During this testing, BLEmesh sent more number of data packets than conventional routing – But it still performs better than conventional routing and Flood routing.

As other routing algorithms required more number of broadcasts, they incurred much more energy consumption as opposed to BLE mesh.

The total number of broadcasts for each routing algorithm compared to BLEmesh can be seen below:

BLE mesh routing comparison

How BLEmesh is better than conventional routing

The difference between conventional routing and BLEmesh is that conventional routing uses a single path to routing messages through the mesh network.

Under BLEmesh, a node transmitting information would forward the information to the node that has the highest probability of receiving the packet from source. Hence, with this approach BLEmesh requires the lowest number of transmissions followed by flooding algorithms and conventional routing methods – Implying that BLEmesh is the best for implementing mesh networks.

Flooding algorithms consume more power than BLEmesh algorithm

In the case of flood routing, the total number of broadcast to send a data from the source to the destination can be calculated by adding the number of estimated broadcasts carried out by each node. Namely, the source node performs 1.27 broadcasts, and the three intermediate nodes perform 1.2 broadcasts adding up to total of 2.47 broadcasts.

Compared with the number of broadcasts needed for BLEmesh, flood routing performs more broadcasts than BLEmesh. From this fact, it can be derived that BLEmesh will consume less power, due to lesser amount of total transmission performed within the network.

While we have discussed only two routing solutions here, we will look into some other BLE mesh solutions in my next blog post on Designing BLE mesh networks.

Meanwhile, if you have anything to share, feel free to reach out or drop a comment.

Hardik Shah

Working from last 8 years into consumer and enterprise mobility, Hardik leads large scale mobility programs covering platforms, solutions, governance, standardization and best practices.

Get Real world industrial guides to BLE mesh networks that 1,000+ Industry practitioners use!

Our Insights on building secure and high quality IoT products using BLE Mesh straight to your inbox.

You have Successfully Subscribed!