Understanding the Silicon Labs Bluetooth® Mesh SDK v6.x or Higher Lighting Demonstration#
NOTE: This section replaces AN1299: Understanding the Silicon Labs Bluetooth® Mesh SDK v6.x or Higher Lighting Demonstration for Simplicity SDK 2024.12.2 and up. Further updates to this application note will be provided here.
The Bluetooth Mesh SDK comes with example projects that creates a wireless network of lights and switches using Bluetooth Mesh technology. These pages assume the usage of Silicon Labs WSTKs for switches and lights and an Android or iOS mobile phone for provisioning and controlling the network. We discuss the basics of Bluetooth Mesh required to understand the example, and walk through key aspects of the application source code.
This demonstration assumes you have read the QuickStart Guide for SDK v4.x and Higher, installed the Bluetooth Mesh SDK, and successfully run the examples.
This demonstration explains the Bluetooth Mesh lighting demo, installed as part of the Bluetooth Mesh SDK. It focuses on the example application and its usage flow, explaining key parts of the source code and the Silicon Labs Bluetooth Mesh mobile application. It also introduces some concepts of the specification that are important for understanding the example.
There are different light sources with different capabilities. If a light source is a tuneable white, the CTL Model can control its light intensity, color temperature and Delta UV. The SoC Light CTL example, which demonstrates these types of light sources, is described in this document. There are also color-changing lights, where the HSL Model can control the Hue, Saturation, and Lightness to describe the quality of the light. Although the SoC Light HSL example demonstrates these types of light sources, this example is out of scope for this document. There is also a BT Mesh Lighting standard, called Networked Lighting Control (NLC), which defines profiles for the various roles in the lighting network. Each of these profiles are also demonstrated by NLC examples. These examples are not in scope for this document but are described in AN1438: Networked Lighting Control. In this document, BT Mesh SoC Light CTL nodes will be referred to as light nodes, and BT Mesh SoC Switch CTL Nodes will be referred to as switch nodes.
The following subsections briefly go through the relevant aspects of the Bluetooth Mesh technology. Section Bluetooth Mesh Lighting Demonstration describes the features and functions of the Lighting Demonstration, section Network Analyzer describes using Network Analyzer for packet capture, and section Bluetooth Mesh Stack and Application for Smartphones focuses on the mobile application.
Bluetooth Mesh#
Bluetooth Mesh is a networking technology available for Bluetooth LE devices and applications. Previously Bluetooth devices have been using point-to-point connectivity or broadcasting topologies to communicate with other devices. Bluetooth Mesh extends that and allows both many-to-many device communications and using Bluetooth devices in a mesh topology. This enables multi-hop communications between Bluetooth devices and much larger-scale Bluetooth device networks than has previously been possible.
Bluetooth Mesh uses Bluetooth LE advertising channels to send and receive messages between the Bluetooth Mesh nodes, but it can also use Bluetooth connections and GATT services to communicate with devices that do not natively support Bluetooth Mesh.
Bluetooth Mesh also uses its own security architecture, which is separate from the normal Bluetooth LE security architecture, although the same AES-CCM 128-bit and Elliptic Curve Diffie Hellman (ECDH) security algorithms are used.
Bluetooth Mesh also defines its own application layer called mesh model which is different than the GATT-based profiles and services that non-mesh Bluetooth LE devices use. The new application layer was defined to address the requirements and needs of mesh-based topologies and also to make Bluetooth Mesh a full stack solution and enable interoperable mesh devices to be built.
Bluetooth Mesh Network Roles and Node Features#
The Bluetooth Mesh network typically consists of multiple nodes. All nodes can transmit and receive mesh messages, but they can optionally also support one or more additional features. If a node does not implement any of the additional features, it is considered just a node. Various node types are illustrated in the following figure.
The four types of specified node features are as follows:
Proxy feature: Enables message proxy between Bluetooth Mesh and GATT, and enables devices such as smartphones to connect to Bluetooth Mesh.
Relay feature: Relays messages to extend the range and scale of a Bluetooth Mesh network.
Friend feature: Implements an additional message cache to support nodes with the low power feature.
Low power feature: Allows sleeping and polling of messages from friend nodes at known time intervals.
For further information on these features and Bluetooth Mesh technology, please go to the Silicon Labs Bluetooth Mesh learning center.
Provisioning#
Provisioning refers to the operation where devices that are not part of any Bluetooth Mesh network are transformed into nodes that are part of one or more Bluetooth Mesh networks. For example, provisioning happens when a new light bulb is installed and taken into use, so it can be controlled by switches or dimmers.
Provisioning is mainly a security process where the first level security keys are generated by the provisioner and transferred to the device that is being provisioned to make it part of a Bluetooth Mesh network.
The provisioning process begins when a device starts to send unprovisioned Bluetooth beacon packets and the provisioner receives them. The provisioner then initiates the provisioning process, the devices exchange public keys, and both generate session keys. The session keys are used to secure the session, in the transfer of the actual network key, and the rest of the provisioning process. After provisioning, each device, now a node in the network, has the network key, a security parameter called the IV index, and its unicast address.
Publish and Subscribe#
In Bluetooth Mesh, communication to a group of devices is typically implemented through a publish and subscribe mechanism. This is an easy-to-understand concept which also simplifies the setup of Bluetooth Mesh networks and adding and reconfiguring nodes.
Usually the Bluetooth Mesh nodes are configured into groups, which may represent their physical location (kitchen or living room) or specific function (lights or window coverings). Usually the devices are also controlled as groups, so the same message is sent to all devices in a group. To accomplish this functionality, Bluetooth Mesh uses a concept called publish – subscribe, where nodes, such as lights, subscribe to messages groups and nodes, like switches, publish messages to those groups. At the network layer, each group is assigned a group address, and multicast messaging is used to send the messages to all devices in a specific group.
The benefit of publish and subscribe is that, when a new node is added or an existing node is removed or replaced, only that node needs to be provisioned and configured.