The Ultimate Bluetooth Mesh Tutorial (Part 4)

Bluetooth mesh network

This week we will continue our tutorial series on Bluetooth mesh. Here’s where you can find part 1, part 2, and part 3. But before we get into the practical implementation of an example on the nRF52 series platform, let’s better understand how Bluetooth mesh works on the platform. We’ll go over:

  • The basics and architecture of the nRF5 SDK for Mesh
  • How to install and configure the SDK
  • Which development boards are compatible

nRF5 SDK for Mesh

Architecture Overview

The goal of an SDK is to provide the developer with a set of APIs to make implementation easier and abstract out any unnecessary complexities in the underlying stack. Here’s a diagram showing the architecture of the nRF5 SDK for Mesh:

nRF5 SDK for Mesh architecture
Figure 1: Architecture of the nRF5 SDK for Mesh (source: Introduction to nRF5 SDK for Mesh documentation)

Let’s go through each of the layers within the architecture.

  • Models: as we’ve talked about in the previous posts within this series, models define the behaviors and messages that are specific to a certain application. Models are similar to GATT in BLE in the sense that there are standard models defined by the Bluetooth SIG, but the developer is also given the freedom to define and develop their own (usually to implement a custom application or functionality that’s not satisfied by any standardized models).
  • Access: think of the Access layer as a model multiplexing layer. It’s responsible for determining which mesh messages are meant for a specific model and forwarding it along to the intended model.
  • DSM (Device State Manager): the DSM handles the task of storing the encryption keys and addresses used by the mesh stack. For each model that is configured and assigned application keys and addresses, the DSM stores these values in persistent storage (so they can be retrieved after a power cycle). It provides handles to these values to enable the models to use them.
  • Core: the Core layer within the nRF5 SDK for Mesh consists of a transport and network layer.
    • Transport layer: this layer is responsible for encrypting mesh packets with application keys (AppKeys) and splitting them into mesh packets to be transmitted over the air. It also handles re-assembling incoming packet segments and combining them into a format that can be passed on to the Access layer.
    • Network layer: this layer encrypts all transport layer packet segments with the network key (NetKey) and populates the source and destination addresses before passing it on to the Bearer layer to be sent out over the air. On the receiving end, it decrypts the packets, looks at the source and destination addresses to determine whether the packet should be relayed up the stack.
  • Provisioning: provisioning is a requirement for any mesh network. Each device needs to go through the provisioning process before it joins the network. The mesh stack provides two ways of provisioning a device: either directly through what’s called the PB-ADV (advertising provisioning bearer) or through remote provisioning. The PB-ADV provisioning can only happen between two devices that are within range of each other. Remote provisioning allows the two devices to complete the process without being in the range of each other, with the help of the other devices in the mesh network.
    Important note: keep in mind that the remote provisioning feature is Nordic-specific and cannot be used with devices from other vendors.
  • DFU: this layer/module handles the process of updating the firmware of the device. It allows concurrent, authenticated firmware transfers to all devices within the mesh network without affecting the operation of the application. This is different and incompatible with the DFU process used in the nRF5 SDK for BLE devices.
    Important note: keep in mind that the nRF5 Mesh DFU feature is also Nordic-specific and cannot be used with devices from other vendors.
  • Bearer: this level/module is used only internally and not accessible to the application layer. It handles the low-level radio controller operations needed to comply with the timings and packet format of BLE.

SDK Installation and Configuration

There are a few required tools that need to be installed before being able to build an nRF5 mesh example or application. These tools are summarized in the following table:

nRF5 SDK Mesh required tools
Table 1: List of required tools for nRF5 SDK for Mesh


Download Links

In addition to these required tools, there are two options for the build environment: either using CMake or using SES (Segger Embedded Studio). We will focus on the SES solution since it’s easier and more straight-forward to use.

From Nordic’s documentation:

Python is not required to build the mesh stack and examples, but it is required when working with DFU, the Interactive PyACI, generating SEGGER Embedded Studio projects and when building documentation. The nRF5 SDK for Mesh uses Python 3however, the nrfutil tool used for DFU transfers over serial requires Python 2.7.

In order to get the installation fully working, follow the instructions laid out on the following page:

Building the mesh stack and examples

Hardware Compatibility

The following chipsets and development kits are supported by the nRF5 SDK for Mesh:

nRF5 SDK for Mesh Supported HW
Table 2: List of supported hardware for nRF5 SDK for Mesh


In our implementation examples, we’ll be using a mix of the nRF52840 and nRF52832 development kits.

nRF52 Bluetooth Mesh Examples

There are quite a few examples provided with the nRF5 SDK for Mesh. Each requiring a different number of development kits (or devices) and demonstrating different concepts and features within Bluetooth mesh. Some of these examples include:

  • Light switch
  • Experimental dimming
  • Remote provisioning client
  • Remote provisioning server
  • Beaconing
  • and more


In this post, we covered some of the basics of the nRF5 SDK for Mesh. In the next post in the series, we’ll take a look at the different examples in more depth, choose one of them, and start implementing it.


Don't miss out on the latest articles & tutorials. Sign-up for our newsletter today!

Take your BLE knowledge to the next level.

If you’re looking to get access to full video courses covering more topics, then check out the Bluetooth Developer Academy.

As part of all the courses within the Academy, you’ll also be able to download the full source code to use as a reference or use within your own application.

By joining the Bluetooth Developer Academy, you will get access to a growing library of video courses (one course released every single month).

The Academy also features access to a private community of Bluetooth experts, developers, and innovators. You’ll get to connect and interact with me and other experts in the Bluetooth space, learn from others’ experiences and knowledge, and share yours as well.

So, what are you waiting for?? Join today!

You may also be interested in these articles.

Don't miss out on the latest articles & tutorials. Sign-up for our newsletter today!

Want to quickly learn the core basics of Bluetooth Low Energy?

Grab a copy of my FREE “Intro to Bluetooth Low Energy” e-book now!