Bluetooth: Mesh sensor

The Bluetooth mesh sensor sample demonstrates how to set up a basic mesh Sensor Server model application that provides sensor data to one Sensor Client model. Four different sensor types are used to showcase different ways for the server to publish data. In addition, the sample demonstrates usage of both single-channel sensor types and sensor series types.


This sample must be paired with the Bluetooth: Mesh sensor observer sample to show any functionality. The mesh sensor provides the sensor data used by the observer.


The sample supports the following development kits:

Hardware platforms


Board name

Build target

nRF52 DK




nRF52840 DK




For provisioning and configuring of the mesh model instances, the sample requires a smartphone with Nordic Semiconductor’s nRF Mesh mobile app installed in one of the following versions:

Additionally, the sample requires the Bluetooth: Mesh sensor observer sample application. The application needs to be programmed on a separate device, and configured according to the sensor observer sample’s testing guide.


The following Bluetooth mesh sensor types are used in this sample:

Moreover, the on-chip TEMP_NRF5 temperature sensor is used.


The provisioning is handled by the Bluetooth mesh provisioning handler for Nordic DKs. It supports four types of out-of-band (OOB) authentication methods, and uses the Hardware Information driver to generate a deterministic UUID to uniquely represent the device.

Use nRF Mesh mobile app for provisioning and configuring of models supported by the sample.


The following table shows the Bluetooth mesh sensor composition data for this sample:

Element 1

Config Server

Health Server

Sensor Server

The models are used for the following purposes:

  • Config Server allows configurator devices to configure the node remotely.

  • Health Server provides attention callbacks that are used during provisioning to call your attention to the device. These callbacks trigger blinking of the LEDs.

  • Sensor Server provides sensor data to one or more mesh sensor observers.

The model handling is implemented in src/model_handler.c, which uses the TEMP_NRF5 temperature sensor, and the DK Button and LEDs library to detect button presses.

User interface


Can be used to input the OOB authentication value during provisioning. All buttons have the same functionality during the provisioning procedure.

Button 1:

Simulates presence detected (after the provisioning procedure is finished).


See Configuring your application for information about how to permanently or temporarily change the configuration.

Source file setup

This sample is split into the following source files:

  • A main.c file to handle initialization.

  • One additional file for handling Bluetooth mesh models, model_handler.c.

Building and running

This sample can be found under samples/bluetooth/mesh/sensor_server in the nRF Connect SDK folder structure.

See Building and programming a sample application for information about how to build and program the application.



The Bluetooth mesh sensor sample cannot demonstrate any functionality on its own, and needs a device with the Bluetooth: Mesh sensor observer sample running in the same mesh network. Before testing the sensor sample, go through the sensor observer sample’s testing guide with a different development kit.

After programming the sample to your development kit, you can test it by using a smartphone with nRF Mesh mobile app installed. Testing consists of provisioning the device, and configuring it for communication with the mesh models.

Provisioning the device

The provisioning assigns an address range to the device, and adds it to the mesh network. Complete the following steps in the nRF Mesh app:

  1. Tap Add node to start scanning for unprovisioned mesh devices.

  2. Select the Mesh Sensor device to connect to it.

  3. Tap Identify, and then Provision, to provision the device.

  4. When prompted, select an OOB method and follow the instructions in the app.

Once the provisioning is complete, the app returns to the Network screen.

Configuring models

See Configuring mesh models using the nRF Mesh mobile app for details on how to configure the mesh models with the nRF Mesh mobile app.

Configure the Sensor Server model on the Mesh Sensor node:

  • Bind the model to Application Key 1.

  • Set the publication parameters:

    • Destination/publish address: Select an existing group or create a new one, but make sure that the Sensor Client subscribes to the same group.

    • Retransmit count: Set the count to zero (Disabled), to avoid duplicate logging in the Sensor Client’s UART terminal.

  • Set the subscription parameters: Select an existing group or create a new one, but make sure that the Sensor Client publishes to the same group.

The Sensor Server model is now configured and able to send data to the Sensor Client.


To enable Sensor Server configuration by a Sensor Client, an application key must be bound to the Sensor Setup Server. This functionality must also be programmed in the Sensor Client device.


This sample uses the following nRF Connect SDK libraries:

In addition, it uses the following Zephyr libraries: