This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF5 SDK for Mesh v2.2.0: Light Switch Demo - Where Next?

So I have successfully built & deployed the Light Switch Demo - and it works.

But where do we go next?

The documentation seems far too close-in focussed on the microscopic details of functions, types, etc - I can't see anything which gives a macroscopic overview of how to create a system.

It's like a car handbook which describes each cog in the gearbox in fine details - but doesn't tell you how to drive the car!

For example, the Server controls just 1 LED on the DK.

How would we expand that to give independent control of all 4 LEDs?

In BT Mesh terminology, I think that would mean making each LED an "Element" ?

So how would we instantiate these - as instances of the Generic On/Off model?

  • Yes, an element is essentially a controllable part of the device. So each LED would be a different element.

  • I realize this is 4 months too late, but better late than never. I have created an example showing how you can create two generic on off server models with one element each. That way, it is possible to provision & configure the server example from the nRF Mesh smartphone app & control the LEDs 1 & 2 from the app itself. Unfortunately, there is a bug at the moment in the iOS app, which means that the state set message only gets sent to the first on off server unicast address & never to the second one.

    However, this works fine with the Android nRF Mesh app.

    I made a copy of the generic on off server light switch example from mesh sdk v3.1.0. The main changes were the following:

    - increased the ACCESS_MODEL_COUNT & ACCESS_ELEMENT_COUNT by one since I have added an extra element. The ACCESS_SUBSCRIPTION_LIST_COUNT has also been increased by one. All of these defines are found in nrf_mesh_config_app.h.

    - in main.c, I added another APP_ONOFF_SERVER_DEF() for the second on off server model

    - also changed the app_onoff_server_set_cb() to either change the LED state of LED 0 or LED 1 depending on which server model state is changed

    - app_model_init() has also been updated to initialize two generic on off models instead of one.

    I have added a comment //added by BK behind each line I have changed, so it should be easy to make search for the different changes.

    In nRF Mesh, just provision & configure the node similar to this Youtube video, find the first server model, bind the app key & then change the state at the bottom of the same window. The same procedure applies for the second on off server model.

    I would recommend to run a debug session by pressing F5 to get additional logging info in SES.

    Unfortunately, I was unable to upload the zip file to DevZone, but I found a workaround. I have only tested on a 52832 DK.

    Just unzip the folder like this: nrf5_SDK_for_Mesh_v3.1.0_src\examples\light_switch\server_4_generic_on_off

    It should then look similar to this:

  • Thanks - I will have to find some time to look at it again!

Related