Basic concepts of nRF5 SDK for Mesh (VI) BLE MESH
Basic Bluetooth Mesh concepts
The Bluetooth Mesh is a profile specification developed and
published by the Bluetooth SIG. This document explains the basic
concepts of the Bluetooth Mesh and gives an overview of the operation
and capabilities of the profile, as well as explaining the life cycle
of a mesh device. For more specific information about Nordic
Semiconductor's implementation of the Bluetooth Mesh, see the mesh
Basic Concept of Bluetooth MESH
Bluetooth MESH is a profile specification developed and published by Bluetooth Group. This document explains the basic concepts of Bluetooth MESH, outlines the operation and functions of profile, and explains the lifecycle of a mesh device. For more information on the implementation of Bluetooth grid in Nordic semiconductors, see the MESH Architecture Document.
Relation to Bluetooth low energy
The Bluetooth Mesh is based on the Bluetooth low energy part of the
Bluetooth 4.0 Specification and shares the lowest layers with this
protocol. On-air, the Bluetooth Mesh physical representation is
compatible with existing Bluetooth low energy devices, as mesh
messages are contained inside the payload of Bluetooth low energy
advertisement packets. However, Bluetooth Mesh specifies a completely
new host layer, and although some concepts are shared, Bluetooth Mesh
is incompatible with the Bluetooth low energy host layer.
Relation with Low Power Bluetooth
Bluetooth MESH is a low-energy part of Bluetooth based on Bluetooth 4.0 specification and shares the lowest layer with the protocol. In the air, the Bluetooth MESH physical layer represents compatibility with existing low-power Bluetooth devices, because MESH information is contained in the payload of Bluetooth low-energy broadcast packets. However, Bluetooth MESH specifies a completely new host layer. Although some concepts are shared, Bluetooth MESH is incompatible with low power host layer.
Relationship between Bluetooth MESH and Low Power Bluetooth Technology
Bluetooth Mesh primarily targets simple control and monitoring applications, like light control or sensor data gathering. The packet
format is optimized for small control packets, issuing single commands
or reports, and is not intended for data streaming or other
Using Bluetooth Mesh causes higher power consumption than traditional Bluetooth low energy applications. This is mainly due to
the need for keeping the radio running constantly. Therefore, unlike
Bluetooth low energy advertisers, active mesh devices cannot be run
off coin-cell batteries for extended periods of time.
Bluetooth Mesh supports up to 32767 devices in a network, with a maximum network diameter of 126 hops.
Bluetooth MESH is mainly for simple control and monitoring applications, such as optical control or sensor data acquisition. Packet formats are optimized for small control packages, issuing a single command or report, and are not suitable for data streams or other high-bandwidth applications. Using Bluetooth MESH can consume more power than traditional low power Bluetooth technology. This is mainly due to the need to maintain the continuous operation of the radio. Therefore, unlike BLE broadcasters, active mesh devices cannot shut down batteries for long periods of time. In one MESH, Bluetooth MESH supports up to 32767 devices, with a maximum MESH diameter of 126 hops.
Network topology and relaying
Bluetooth Mesh is a broadcast-based network protocol, where every
device in the network sends and receives all messages to and from all
devices within radio range. There is no concept of connections in a
mesh network. Any device in the network may relay messages from any
other device, which makes it possible for a mesh device to send a
message to a device outside of radio range by having one or more other
devices relay the message towards the destination. This property also
allows devices to move around and drop in and out of the network at
Network Topology and Relay
Bluetooth MESH is a broadcast-based network protocol in which every device in the network sends and receives all messages from all devices in the radio range. There is no concept of connection in mesh networks. Any device in the network can transmit messages from other devices, which enables a network device to send messages to devices outside the radio range by having one or more other devices deliver messages to the destination. This feature also allows devices to move and exit from the network at any time.
Bluetooth Mesh utilizes the Bluetooth low energy advertiser and
scanner roles, communicating through Bluetooth low energy
advertisement packets. The advertisement packets are picked up by
nearby mesh devices and handled like other Bluetooth low energy
advertisement packets. The mesh packets are represented with a unique
AD type and added to the advertisement packet payload.
Bluetooth low energy devices send advertisement packets at regular
advertisement intervals, and mesh packets are no exception. However,
unlike traditional advertisers, mesh devices will change their
advertisement payload on every transmission, broadcasting new mesh
packets as they are queued up in the stack. Every Bluetooth Mesh
advertisement is transmitted only once for every device, and if there
is no traffic in the mesh, the devices stay silent.
Bluetooth MESH uses BLE's broadcast and scanner role to communicate through BLE's broadcast package. Broadcast packets are received by nearby MESH devices and processed like other BLE low-energy broadcast packets. MESH packets are represented by a unique broadcast type and added to the payload of the broadcast layer.
BLE sends broadcast packets at regular intervals, and MESH packets are no exception. However, unlike traditional broadcasters, MESH devices will change the payload of the broadcasting layer in each transmission and arrange new MESH packets in a queue manner on the stack. Each Bluetooth MESH broadcast packet is transmitted only once on each device. If there is no traffic in MESH, the device will remain silent.
Bluetooth Mesh expands the range of the network by relaying
messages. Any mesh device may be configured to act as a relay, and no
dedicated relay devices are needed to build a network. Every device
acting as a relay will decrement the Time To Live (TTL) value in
received messages and forward them if the TTL is two or higher. This
undirected relaying is referred to as messageflooding and ensures a
high probability of message delivery, without requiring any
information on the network topology. The Mesh Profile Specification
does not provide any routing mechanisms, and all messages are
forwarded by all relays until the TTL value reaches zero. To avoid
messages being forwarded by the same relays over and over, all mesh
devices maintain a message cache. This cache is used for filtering out
packets that the device has already handled.
The flooding based approach to message relaying can cause a lot of
redundant traffic on air, which may impact the throughput and
reliability of the network. Therefore, it is highly recommended to
limit the number of relays in a network to restrict this effect. The
rate of relay-enabled devices in the network is a trade-off between
message route-redundancy and reliability. It should be tuned according
to network density, traffic volumes, network layout, and requirements
for reliability and responsiveness.
Bluetooth mesh expands the scope of the network by relaying messages. Any network device can be configured as a repeater, and no special relay device is needed to build a network. Each device that acts as a relay reduces the time to receive messages (TTL) values and forwards them if TTL is 2 or higher. This kind of undirected relay is called message flooding and ensures a high probability of message passing without requiring any information about the network topology. The grid configuration file specification does not provide any routing mechanism, and all messages are forwarded by all relays until the TTL value reaches 0. To avoid messages forwarded by the same relay, all grid devices maintain a message cache. This cache is used to filter packets that have been processed by the device. Flood-based messaging may lead to a large amount of redundant air traffic, which may affect the throughput and reliability of the network. Therefore, it is strongly recommended to limit the number of relays in the network to limit this effect. In networks, the rate of relay-enabled devices is a trade-off between message redundancy and reliability. It should be adjusted according to network density, traffic, network layout, reliability and responsiveness requirements.
To enable support for legacy Bluetooth low energy devices that do
not support receiving mesh packets, Bluetooth Mesh defines a separate
protocol for tunneling mesh messages over the Bluetooth low energy
GATT protocol. For this purpose, the Mesh Profile Specification
defines a GATT bearer and the corresponding GATT Proxy Protocol. This
protocol allows legacy Bluetooth low energy devices to participate in
the mesh network by establishing a GATT connection to a mesh device
that has the proxy feature enabled.
The legacy device gets assigned an address and the necessary keys to
become a full-fledged member of the network. The device receives the
security credentials through the regular provisioning procedure or
through some out-of-band mechanism.
To support traditional Bluetooth low power devices that do not support receiving grid data packets, Bluetooth MESH defines a separate protocol for implementing tunnel network messages through Bluetooth GATT protocol with low power consumption. To this end, the MESH profile specification defines a GATT holder and corresponding GATT proxy protocol. The protocol allows traditional Bluetooth low power devices to participate in MESH by establishing a GATT connection to a grid device with proxy characteristics.
Legacy devices are assigned an address and the necessary key to become full members of the network. The device receives security credentials either through routine configuration procedures or through some out-of-band mechanisms.
To enable broadcast-based communication, the devices must
continuously keep their radio in listening mode, causing significantly
higher power consumption than in a typical Bluetooth low energy
device. To enable low power devices to take part in the mesh network,
Bluetooth Mesh contains a low power friendship feature. This protocol
lets low power devices establish a relationship with a regular mesh
device, which will then cache and forward messages to the low power
device at regular intervals. This saves the low power device from
having to stay on to listen for incoming messages.
In order to support broadcasting-based communication, the device must continuously keep the radio in the listening mode, which is much higher than the power consumption of typical low-power Bluetooth low-power devices. In order to enable low power devices to participate in MESH network, Bluetooth MESH includes a low power friendly function. The protocol allows low-power devices to establish a relationship with conventional mesh devices, and then periodically cache and forward messages to low-power devices.
This saves low-power devices from continuing to listen to incoming messages.
The Bluetooth Mesh addressing scheme is different from the Bluetooth
low energy addressing scheme. It features three types of addresses:Unicast addresses: unique for every device Group addresses: allow forming a group of devices and addressing them all at once Virtual addresses: untracked UUID-based addresses with a large address space
When a device is added to a network, it is assigned a range of unicast
addresses that represents it. A device's unicast addresses cannot be
changed and are always sequential. The unicast address space supports
having 32767 unicast addresses in a single mesh network. Unicast
addresses can be used by any application to directly send a message to
Group addresses are allocated and assigned as part of the network
configuration procedure. A group address may represent any number of
devices, and a device may be part of any number of groups. There can
at most be 16127 general purpose group addresses in a mesh network.
The virtual addresses can be considered a special form of group
addresses, and can be used to represent any number of devices. Each
virtual address is a 128-bit UUID generated from a text label. The
virtual addresses do not have to be tracked by a network configuration
device, and in this way, users can generate virtual addresses prior to
deployment or addresses can be generated ad-hoc between devices in the
Bluetooth MESH addressing scheme is different from low power Bluetooth addressing scheme. It has three types of addresses:
Single address: unique for each device Group Address: Allows a set of devices to be formed and processed once Virtual address: Untracked uuid-based address with large address space
When a device is added to a network, it is assigned a single address representing it. The unit address of the device can't be changed, and it's always sequential. A single address space supports 32767 unit addresses in a single grid network. Any application can send messages directly to the device using a unicast address. Group address allocation and allocation are part of the network configuration process. Group addresses can represent any number of devices, and devices may be part of any number of groups. In a mesh network, there can be up to 16127 common target group addresses. Virtual addresses can be regarded as a special form of group addresses, which can be used to represent any number of devices. Each virtual address is a 128-bit UUID generated by a text label. Virtual addresses do not need to be tracked by network configuration devices, so users can generate virtual addresses before deployment or specific addresses between devices in the network.
Before a device can participate in normal mesh operation, it must be
provisioned. During provisioning, a device gets added to the network
and is assigned unicast addresses, a network key, and a device key.
The provisioning is done by a Provisioner, which is a trusted device
with access to the full list of devices in the network and their
addresses. After the new device has been provisioned, the provisioner
is expected to use the new device's device key to establish a secure
channel to configure it.
A device must be provided before it can participate in normal grid operations. During the supply process, a device is added to the network and assigned to a single address, a network key and a device key. Supply is done by a supplier, a trusted device that has access to all devices and their addresses in the network. After configuring the new device, it is expected that the device key of the new device will be used to establish a secure channel to configure it.
Models and Elements
To standardize communication between devices from different vendors,
the Mesh Profile Specification defines an access layer, which routes
mesh messages between the various models in a device. A model
represents a specific behavior or service and defines a set of states
and messages that act on these states. The Mesh Profile Specification
and the Mesh Model Specification each define a set of models to cover
typical usage scenarios like device configuration, sensor readings,
and light control. In addition to these, vendors are free to define
their own models with accompanying messages and states.
The models in a device belong in elements. Every device has one or
more elements, each acting as a virtual entity in the mesh with its
own unique unicast address. Each incoming message is handled by a
model instance in an element. To make it possible to uniquely resolve
how messages are handled, only one model instance per element can
implement a handler for a specific message opcode. If a device has
multiple instances of the same model, each instance must be assigned
to a separate element. Similarly, if two models implement handlers for
the same message, these models must be in separate elements.
To represent complex behavior with minimal message and state
duplication, models can be made up of other models, potentially
spanning multiple elements. These models are referred to as extended
models. Models that are purely self-contained are referred to as root
Models talk to each other through a publish and subscribe system.
Every model may subscribe to a set of group and virtual addresses, and
the model will only handle messages that are published to one of its
subscription addresses or the containing element's unicast address.
Any model may maintain a publish address that it publishes messages
to. This publish address can be of any type.
Models and elements
In order to standardize the communication between devices from different vendors, the grid configuration file specification defines an access layer, which routes grid messages between different models of devices. The model represents a specific behavior or service and defines a set of States and messages that are executed in these states. The grid configuration file specification and the grid model specification define a set of models to cover typical usage scenarios, such as device configuration, sensor reading and optical control. In addition to these, vendors are free to define their own models and provide corresponding messages and states.
The model in the device belongs to the element. Each device has one or more elements, each of which acts as a virtual entity in the grid and has its own unique single address. Each incoming message is processed by a model instance in an element. To uniquely address how messages are processed, only one model instance per element can implement a handler for a particular message opcode. If a device has multiple instances of the same model, each instance must be assigned a separate element. Similarly, if two models implement handlers for the same message, then these models must be in separate elements.
In order to represent complex behavior with minimal message and state duplication, models can be composed of other models that may span multiple elements. These models are called extended models. The pure self-contained model is called the root model.
The model communicates with each other through publishing and subscribing systems. Each model can subscribe to a set of groups and virtual addresses, and the model only processes messages published to its subscription address or unicast address containing elements. Any model can maintain the publishing address of the published message. This publishing address can be of any type.