Bluetooth: Mesh Light

The Bluetooth Mesh Light sample demonstrates how to set up a basic Mesh server model application and control LEDs with the Bluetooth Mesh, using the Generic OnOff models.


This sample is split into two source files:

  • A main file to handle initialization.

  • One additional file for handling Mesh models


The provisioning is handled the Bluetooth Mesh provisioning handler for Nordic DKs with the default configuration.


This sample application has the following composition data:

Mesh light composition data

Element 1

Element 2

Element 3

Element 4

Config Server

Gen. OnOff Server

Gen. OnOff Server

Gen. OnOff Server

Health Server

Gen. OnOff Server

The Generic OnOff Server instances in elements 1-4 control LEDs 1-4 respectively. The Config server allows configurator devices to configure the node remotely. The Health server is used to call attention to the device during provisioning.

The model handling is implemented in src/model_handler.c, which uses the DK Button and LED library to control each LED on the board according to the matching Generic OnOff server’s received messages.


  • One of the following development boards:

    • nRF5340 PDK board (PCA10095) - see Working with nRF5340

    • nRF52840 DK board (PCA10056)

    • nRF52 DK board (PCA10040)

    • nRF51 DK board (PCA10028)

  • The Nordic Semiconductor nRF Mesh app for Android or iOS.

User interface


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


Shows the OOB authentication value during provisioning if the “Push button” OOB method is used. Shows the OnOff state of the Generic OnOff server of the corresponding element.

Building and running

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

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


After programming the sample to your board, you can test it by using the Nordic Semiconductor nRF Mesh app for Android or iOS.

Provisioning and configuration

Before communicating with the mesh models, the device must be provisioned. The provisioning assigns an address range to the device, and adds it to the mesh network. Provisioning is done through the nRF Mesh app for Android or iOS:

  1. Press “Add node” to start scanning for unprovisioned mesh devices.

  2. Press the “Mesh Light” device to connect to it.

  3. Press “Identify”, then “Provision” to provision the device.

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

  5. Once the provisioning and initial configuration is complete, the app will go back to the Network screen. Press the Mesh Light node in the list. You’ll see basic information about your mesh node and its configuration.

  6. In the Mesh node view, expand the first element. It contains the list of models in the first element of the node.

  7. Press the “Generic OnOff Server” model to see its configuration.

  8. Models must be bound to application keys to be open to communication. Do this by pressing “BIND KEY” at the top of the screen. Select “Application Key 1” from the list.

  9. You should now be able to control the first LED on the device by using the “Generic On Off Controls” in the model view. Pressing “ON” should make the first LED on the DK light up.

Repeat steps 7-9 for each of the elements on the node to control each of the four LEDs on the DK.


This sample uses the following nRF Connect SDK libraries:

In addition, it uses the following Zephyr libraries: