/mesh-gateway-node

Bluetooth MESH gateway node with Sensor Clients

Primary LanguageC

Bluetooth: Mesh sensor observer

The Bluetooth® mesh sensor observer sample demonstrates how to set up a basic Bluetooth mesh :ref:`bt_mesh_sensor_cli_readme` model application that gets sensor data from one :ref:`bt_mesh_sensor_srv_readme` model. Four different sensor types are used to showcase different ways for the server to publish data. In addition, the samples demonstrate usage of both :ref:`single-channel sensor types and sensor series types <bt_mesh_sensor_types_channels>`.

Note

This sample must be paired with :ref:`bluetooth_mesh_sensor_server` to show any functionality. The observer has no sensor data, and is dependent on a mesh sensor to provide it.

The sample supports the following development kits:

.. table-from-rows:: /includes/sample_board_rows.txt
   :header: heading
   :sample-yaml-rows:

The sample also requires a smartphone with Nordic Semiconductor's nRF Mesh mobile app installed in one of the following versions:

Additionally, the sample requires the :ref:`bluetooth_mesh_sensor_server` sample application, programmed on a separate development kit and configured according to mesh sensor sample's :ref:`testing guide <bluetooth_mesh_sensor_server_testing>`.

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

The provisioning is handled by the :ref:`bt_mesh_dk_prov`. 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 mesh sensor observer composition data for this sample:

Element 1
Config Server
Health Server
Sensor Client

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 Client gets sensor data from one or more :ref:`Sensor Server(s) <bt_mesh_sensor_srv_readme>`.

The model handling is implemented in :file:`src/model_handler.c`. A :c:struct:`k_work_delayable` item is submitted recursively to periodically request sensor data.

Buttons:
Can be used to input the OOB authentication value during provisioning. All buttons have the same functionality during the provisioning procedure.
Terminal:
All sensor values gathered from the server are printed over UART. For more details, see :ref:`gs_testing`.

|config|

This sample is split into the following source files:

Note

The mesh sensor observer sample cannot demonstrate any functionality on its own, and needs a device with the :ref:`bluetooth_mesh_sensor_server` sample running in the same mesh network. Before testing the mesh sensor observer, go through the mesh sensor's :ref:`testing guide <bluetooth_mesh_sensor_server_testing>` 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.

All sensor values gathered from the server are printed over UART. For more details, see :ref:`gs_testing`.

Provisioning the device

Configuring models

See :ref:`ug_bt_mesh_model_config_app` for details on how to configure the mesh models with the nRF Mesh mobile app.

Configure the Sensor Client model on the :guilabel:`Mesh Sensor Observer` node:

  • Bind the model to :guilabel:`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 Server subscribes to the same group.
    • Retransmit count: Set the count to zero (:guilabel:`Disabled`), to avoid duplicate logging in the UART terminal.
  • Set the subscription parameters: Select an existing group or create a new one, but make sure that the Sensor Server publishes to the same group.

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

This sample uses the following |NCS| libraries:

In addition, it uses the following Zephyr libraries: