nRF5 SDK for Mesh v5.0.0
Quick demonstration guide

This is a quick demonstration of some of the basic concepts of the Bluetooth mesh network using Nordic's nRF5 SDK for Mesh.

You don't need to build any binaries for running it, as it uses pre-built binaries of the light switch example. Moreover, this example uses the the file to flash the required hex files on the Development Kits.

Table of contents

The light switch example, on which this example is based, demonstrates the major parts of the Bluetooth mesh network ecosystem. It consists of three minor examples:

In the following sections, these three example applications will be referred to as the server, the client, and the provisioner, respectively.

The following figure gives the overall view of the mesh network that will be set up in this example. Numbers in parentheses indicate the addresses that are assigned to these nodes by the provisioner.

Mesh network demonstration

Hardware requirements

You need at least three supported kits for this example:

Software requirements

Although this example does not require you to install the complete toolchain, you still need the following software:

On Debian/Ubuntu, you must reload the udev rules after installing the nRF5x Command Line Tools:
    $ sudo udevadm control --reload
    $ sudo udevadm trigger --action=add


You can find the source code of the example in the following folder: <InstallFolder>/examples/light_switch

LED and button assignments

The buttons (1 to 4) are used to initiate certain actions, and the LEDs (1 to 4) are used to reflect the status of actions as follows:

Flashing the example firmware

Before running this example, you need to flash the boards. You must specify the client and the provisioner boards. The server firmware is automatically loaded to the rest of connected boards.

To flash the example firmware on the client and the provisioner:

  1. Connect the nRF5 boards to the USB ports.
    If you do not have a sufficient number of USB ports, you can program the boards one by one. In this case, switch off or disconnect the boards that you have finished programming to prevent them from being overwritten by the script.
  2. Decide which board you want to use as client and which one as provisioner.
  3. Execute the python script in one of the following ways:

    • let the script ask you to choose the provisioner and client boards based on their SEGGER IDs:
        nrf5_sdk_for_mesh$ python scripts/quick_start/
    • specify the provisioner and client boards manually by providing SEGGER IDs for the provisioner (-p) and client (-c):
          nrf5_sdk_for_mesh$ python scripts/quick_start/ -p 682438729 -c 682204868
    You can also use the command line switch -v if you want to increase the verbosity of the output.

    The script flashes the required SoftDevice and example firmware on the boards.

When the flashing is complete, the script executes a reset operation to start the example applications.

Running and observing the example

After the reset, the provisioner waits for user input. Follow these steps to see the Bluetooth mesh network in action:

  1. Press Button 1 on the provisioner board to start the provisioning process:
    1. The provisioner provisions and configures the client and assigns the address 0x100 to the client node.
    2. The two instances of the OnOff client models are instantiated on separate secondary elements. For this reason, they get consecutive addresses starting with 0x101.
    3. The provisioner picks up the available devices at random, and adds them to odd and even groups.
      - The sequence of provisioned devices depends on the sequence of received unprovisioned beacons.
      - You can use the J-Link RTT viewer to view the RTT output generated by the provisioner. The provisioner prints details about the provisioning and the configuration process in the RTT log. See the subsection below for details.
  2. Observe the LED status on the provisioner, client, and server boards.
  3. Wait until LED 1 on the provisioner board remains ON steadily for a few seconds, which indicates that all available boards have been provisioned and configured.
  4. Press buttons on the client board to change the state of LED 1 on the server boards:
    1. Press Button 1 on the client board to turn ON LED 1 on all servers with ODD addresses.
    2. Press Button 2 on the client board to turn OFF LED 1 on all servers with ODD addresses.
    3. Press Button 3 on the client board to turn ON LED 1 on all servers with EVEN addresses.
    4. Press Button 4 on the client board to turn OFF LED 1 on all servers with EVEN addresses.
  5. Press Button 1 on the servers to locally change the state of LED 1 and observe that the client receives the status message from the corresponding server containing the new state value.

Running the example with RTT logs

If you want to see the RTT logs printed during the provisioning and configuration process, complete the following steps:

  1. Connect the nRF5 boards to the USB ports.
  2. Start J-Link RTT viewer. The Configuration window appears.
    You can also press the F2 button or select File > Connect to open the Configuration window.
  3. In the Configuration window, depending on the development kit board chip number you are using, make sure that the appropriate SoC is selected in the Specify Target Device dropdown menu.
  4. Click OK. The Emulator selection window appears.
  5. Choose the desired board by selecting its USB Identification (SEGGER ID).
    You can open several RTT viewer sessions to observe the RTT log of all the connected boards. In this case, you have to repeat steps 2 to 5 for each board.
  6. Repeat steps 2 to 4 from Flashing the example firmware.
  7. Go through the steps 1 to 4 from Running and observing the example.
  8. If you are monitoring the RTT log for the client, observe messages sent by the servers in response to the acknowledged Set messages.
    • The client example sends acknowledged Set messages only to odd servers, and hence only those servers respond with status messages.
    • Additionally, the provisioner enables publication for all servers, so that they can publish messages to their corresponding group client.
  9. Go through the step 5 from Running and observing the example.

More information and further reading

See the Getting started section for information on environment setup, including installing the mesh toolchain, building the mesh stack and examples, running examples, and more.

Once you set up your nRF5 SDK for Mesh environment, see the example documentation for more detailed information about light switch and other examples.

Documentation feedback | Developer Zone | Subscribe | Updated