In last week’s tutorial (The Ultimate Bluetooth Mesh Tutorial (Part 1)) in this series on Bluetooth mesh, we covered the following:
- Basics of Bluetooth mesh
- Terminology: nodes, elements, states, properties, messages, addresses, publish-subscribe, and managed flooding.
In this week’s tutorial, we’ll continue by covering a few more concepts within Bluetooth mesh, including:
- Types of nodes:
- Relay nodes
- Proxy nodes
- Friend nodes
- Low power nodes
- The architecture of Bluetooth mesh
Let’s go through each of these in more detail.
One important term defined in Bluetooth mesh is the concept of a model. A model defines some or all functionality of a given element.
There are three categories of models:
- Server model: is a collection of states, state transitions, state bindings, and messages which an element containing the model may send or receive.
- Client model: does not define any states; rather, it defines only messages such as the GET, SET and STATUS messages sent to a server model.
- Control model: contains both a server and client model allowing communication with other server and client models.
Models can be extended to include additional functionality instead of modifying the original model. A model that is not extended is called a root model.
Another concept we want to cover is the concept of scenes in a Bluetooth mesh network. A scene is a stored collection of states and is identified by a 16-bit number which is unique within the mesh network.
Scenes allow triggering one action to set multiple states of different nodes. They can be triggered on-demand or at a specified time. For example, a scene may be configured to set the temperature of a room to 72 degrees, the living room lights to a certain brightness level, and the window blinds to close.
Types of Nodes
All types of nodes can send and receive mesh messages. However, optional features give particular nodes special capabilities. Here are the different types of nodes with optional features enabled:
- Relay nodes
- Proxy nodes
- Friend nodes
- Low power nodes
A node may support none, some, or all of these optional features, which may be enabled or disabled at any time. For example, a single node may have the features of a relay node, proxy node, and friend node, all at the same time.
A relay node is one that supports the relay feature. This means it can retransmit messages that are broadcast by other nodes. This enables extending the reach of these messages and allows them to traverse the entire network beyond the reach of the original transmitting node.
To allow communication with a mesh network from a non-mesh-supported BLE device, a special type of node called a proxy node can be utilized. A proxy node acts as an intermediary and utilizes GATT operations to allow other nodes outside of the mesh network to interface and interact with the network.
The protocol used in this case is called the proxy protocol, which is intended to be used with a connection-enabled device (using GATT).
The protocol is built on top of GATT and allows a device to read and write proxy protocol PDUs from GATT characteristics exposed by the proxy node. The proxy node performs the translation between proxy protocol PDUs and mesh PDUs.
For example, this allows a smartphone that does not implement the Bluetooth mesh protocol to interact with a mesh network via a proxy device through GATT operations.
Friend Nodes and Low Power Nodes
A friend node and a low power node (LPN) are closely related to each other. In fact, in order for a low power node to participate in a Bluetooth mesh network, it requires a friendship relationship with another node, called the friend node.
Here are how these two types of nodes work together:
- Low power nodes usually have limited power supply such as batteries, so they need to conserve energy by keeping the radio off as often as possible.
- Low power nodes may be concerned with sending messages more than receiving them. Take for example, a temperature sensor powered by a coin cell battery. It may need to send the temperature reading once per minute whenever that reading is above or below a set limit. If the user decides to change the threshold limit, then that gets sent in a message to the temperature sensor. In order for the sensor to not miss this threshold configuration message, it needs to be on all the time, meaning it will consume a lot of power.
- To solve the problem mentioned in the previous point, the concept of a friend node is introduced. A friend node lets the low power node stay asleep longer.
- Friend nodes make this possible by caching messages that are destined to the low power node. The low power node, at its control, wakes up and polls the friend node for these cached messages. When it polls for the messages, it also sends any messages it needs to relay to the network to its friend node.
- The relationship between a friend node and a low power node is known as “friendship”.
- Friendship is key to allowing power-constrained nodes to participate in a mesh network while keeping their power consumption optimized.
The Architecture of Bluetooth Mesh
Bluetooth mesh builds on top of BLE. It specifically utilizes the advertising state of BLE devices. Devices within a Bluetooth mesh network do not connect to each other like traditional BLE devices do. Rather, they use the advertising and scanning states to relay messages to each other. There is one exception to this in a special device that can be part of the mesh network (which we’ll cover in the section on “Node Types”).
Here’s a description for each of the layers within the architecture of Bluetooth mesh (starting with the bottom layer):
- Bluetooth Low Energy layer
As we mentioned earlier, Bluetooth mesh builds on top of BLE, so it requires a full BLE stack to be running on the device. It utilizes the advertising and scanning states for sending and receiving messages between devices within the mesh network. It also supports the connected state and GATT for special devices called proxy nodes.
- Bearer layer
The bearer layer defines how the different mesh packets (Protocol Data Units or PDUs) are handled. There are two types of Bluetooth mesh bearers:
- Advertising bearer: this bearer utilizes the advertising and scanning states of BLE devices.
- GATT bearer: this bearer utilizes the connection state of BLE devices. It allows non-mesh supporting devices to interact with the mesh network via GATT operations. This is accomplished via a special node called the proxy node.
- Lower transport layer
This layer handles two main tasks:
- Segmentation of packets from the layer above (upper transport layer)
- Reassembly of packets from the layer below (bearer layer)
- Upper transport layer
This layer is Responsible for the following functionalities:
- Transport control messages (heartbeat, friendship, etc.)
- Access layer
This layer defines how the application uses the upper transport layer. It handles the following tasks:
- Application data format
- Encryption and decryption
- Data verification
- Foundation Models layer
This layer is concerned with the network configuration and network management models.
- Models layer
This layer addresses the implementation of models including behaviors, messages, states, and state bindings.
In this post, we covered some additional terminology within Bluetooth mesh in addition to a high-level overview of its architecture. In the next post, we will go over one of the most important concepts in Bluetooth mesh: the provisioning process. We’ll also cover the topic of security and how its handled in Bluetooth mesh. Continuing after that, we will begin implementing a simple Bluetooth mesh network on the Nordic nRF52 series platform.