This blog introduces a vendor specific mesh model used for self configuration of Bluetooth mesh nodes. It is demonstrated with the help of two mesh demo code examples - Dimmer_self_config and Embedded_provisioner.
Generally, we provision and configure mesh devices with the help of an external configuration client (Eg. Provisioners such as mobile apps, MeshClient, etc.). But in some scenarios where the mesh network does not allow (or need not allow) access for cell phones or any external devices, we can use the self-configuration vendor specific model for fast configuration. For example, a dimmer switch can be sold with one or several light bulbs. User should be able to power up the devices and start using them.
Here, Dimmer_self_config is a simple dimmer application with self-configure feature. It works in concert with Embedded_provisioner app - a dimmable light application which also serves as an embedded provisioner and/or self-configured device. In this blog, we will be looking at the implementation of Self-Configure feature of Dimmer_self_config in detail. If you are not familiar with simple dimmer and light_dimmable apps, please see the Mesh AppNote -AN227069.
In this use case, the Embedded_provisioner app is expected to create a mesh network, scan for un-provisioned devices and provision Dimmer_self_config app without the help of any external provisioner devices. After provisioning, the Embedded Provisioner sends the Application Key and a vendor specific command to start the self-configuration of Dimmer_self_config app based on the hardcoded rules. The rules for self-configuration is hardcoded in the shared embedded_provisioner.h. After the successful configuration of Dimmer_self_config, LED on the Embedded_provisioner can be controlled using the push button on the Dimmer_self_config app. (Note: Enable both EMBEDDED_PROVISION and SELF_CONFIG flags in Embedded_provisioner app for this use case).
Below figure summarizes the overall mesh network structure.
Now, let us see some key steps required to implement the self-configure feature.
Step1: The rules for self-configuration is hardcoded in the shared embedded_provisioner.h. This header file mainly provides the definition of vendor specific model, configuration parameters/rules, required structures , etc.
The Cypress vendor specific Self-Config model is defined as follow.
The configuration parameters/rules (eg. Group address used for publication/subscription) are also defined in embedded_provisioner.h
Step2: Define configuration data of necessary models.
Along with necessary models for simple dimmer app, we define three additional models as well for Dimmer_self_config to aid self-configuration feature.
Step3: Model Initializations.
Apart from the level client initialization, which is used for dimmer app functionality, we initialize the configuration client and default transition time client models as well with appropriate message callback handler passed as parameter to receive and process messages for respective the models.
mesh_default_transition_time_client_message_handler is implemented in mesh_default_transition_time_client.c.
Step4: Implementation of Vendor Server message handler to process vendor specific mesh messages.
As indicated earlier, the Embedded_provisioner needs to instruct the Dimmer_self_config app to start the self-configuration - based on the hardcoded rules - by sending appropriate vendor specific command. So, the Dimmer_self_config should have a vendor server message handler to process these vendor messages/commands and take appropriate actions.
mesh_vendor_server_message_handler() checks the model_id, opcode, subcode, etc. and ask the local device to do the self-configuration by calling self_configure() function.
Step5: Self-Configuration logic implementation.
self_configure(uint16_t node_addr) function implements the basic logic for self-configuration of the device by binding Application Key to all models, configure models for subscriptions, publications and setting default transition time.
The main sub functions called inside self_configure() for the configurations are: -
Note: The Self Config logic can be combined with the normal configuration. For example, after performing hardcoded actions, the Provisioner can still use standard Config Relay Set method to turn the relay feature on or off.
Links:
mtb-example-btsdk-mesh-demo-dimmer-self-config
mtb-example-btsdk-mesh-demo-embedded-provisioner
Check the readme of each apps for testing instructions.
Show LessBluetooth SDK
The Bluetooth SDK is targeted for the CYW20706, CYW20719B2, CYW20721B2, CYW20735B1, CYW20835B1, CYW20819, CYW20820, CYW89820, and the CYW43012 Wi-Fi/BT combo (for embedded Bluetooth development only). ModusToolbox 2.2 with the Bluetooth SDK 2.8 provides a complete development environment to allow you to quickly create Bluetooth enabled IoT solutions like audio devices, beacons and trackers, hid devices, smart watches, medical devices, and home automation platforms.
The Bluetooth SDK includes:
Notes for Installing Bluetooth SDK 2.8 with ModusToolbox 2.2:
This release is an update to Bluetooth SDK 2.7. Bluetooth SDK 2.8 is targeted for the CYW20706, CYW20719B2, CYW20721B2, CYW20735B1, CYW20835B1, CYW20819, CYW20820, CYW89820 and the CYW43012 Wi-Fi/BT Combo (for embedded Bluetooth development only). ModusToolbox™ with the Bluetooth SDK software library provides a complete development environment to allow you to quickly create Bluetooth-enabled IoT solutions like smart watches, medical devices, or home automation platforms. This document describes the features and known limitations for Bluetooth SDK 2.8.
Show LessModusToolbox® with the Bluetooth SDK provides a complete development environment that allows you to quickly create an IoT solution utilizing world-class Bluetooth/Bluetooth Low Energy (BLE) connectivity technologies. This document provides the details of various features, modes, and limitations associated with the supported hardware development platforms.
Show LessModusToolbox® with the Bluetooth SDK provides a complete development environment that allows you to quickly create an IoT solution utilizing world-class Bluetooth/Bluetooth Low Energy (BLE) connectivity technologies. This document provides the details of various features, modes, and limitations associated with the supported hardware development platforms.
Show LessThis release is an update to Bluetooth SDK 2.6. Bluetooth SDK 2.7 is targeted for the CYW20706, CYW20719B2, CYW20721B2, CYW20735B1, CYW20835B1, CYW20819, CYW20820, CYW89820 and the CYW43012 Wi-Fi/BT Combo (for embedded Bluetooth development only). ModusToolbox™ with the Bluetooth SDK software library provides a complete development environment to allow you to quickly create Bluetooth-enabled IoT solutions like smart watches, medical devices, or home automation platforms. This document describes the features and known limitations for Bluetooth SDK 2.7.
Show LessModusToolbox™ with the Bluetooth SDK provides a complete development environment to allow one to quickly create an IoT solution utilizing Cypress’ world-class Bluetooth/BLE connectivity technologies. This document also provides the details of many supported features and modes, and limitations associated with supported hardware development platforms.
Show LessThis release is an update to the Bluetooth SDK 2.5. The Bluetooth SDK 2.6 is targeted for the CYW20706, CYW20719B2, CYW20721B2, CYW20735B1, CYW20819, CYW20820, CYW89820 and the CYW43012 Wi-Fi/BT Combo (for embedded Bluetooth development only). ModusToolbox™ with the Bluetooth SDK software library provides a complete development environment to allow you to quickly create Bluetooth enabled IoT solutions like smart watches, medical devices, or home automation platforms. This document describes the features and known limitations for the Bluetooth SDK 2.6
Show LessModusToolbox™ with the Bluetooth SDK provides a complete development environment to allow one to quickly create an IoT solution utilizing Cypress’ world-class Bluetooth/BLE connectivity technologies. This document also provides the details of many supported features and modes, and limitations associated with supported hardware development platforms.
Show LessThis release is an update to the BT SDK 2.4. The BT SDK 2.5 is targeted for the CYW20706, CYW20719B2, CYW20721B2, CYW20735B1, CYW20819, CYW20820, CYW89820 and the CYW43012 Wi-Fi/BT Combo (for embedded BT development only). ModusToolbox™ with the Bluetooth SDK software library provides a complete development environment to allow you to quickly create Bluetooth enabled IoT solutions like smart watches, medical devices, or home automation platforms. This document describes the features and known limitations for the BT SDK 2.5.
Show Less