Skip to main content

Cypress CYBT-213043-MESH Expedites Bluetooth Mesh Development

Main39_96399794233b61213edf7d7274c5d3c4badee4ea.jpg

A look at the Cypress evaluation kit hardware, SDK and Bluetooth Mesh basics.

In a previous post we took a look at the Cypress CYW20819 Bluetooth 5 SoC (186-0727) and its eval kit, noting how the single-chip solution includes support for Bluetooth Mesh 1.0. In this post we will explore Bluetooth mesh networking in a little more detail and take a look at the multi-node Cypress kit which builds on the CY20819 SoC and is designed specifically for this purpose — the CYBT-213043-MESH (187-4661) .

Quick start

Board_23fc06e65869d20ee4a29ed93cbcf80bb36e3b69.jpg

The kit is comprised of four identical boards which provide everything that is needed to get a Bluetooth mesh network up and running with example applications. The boards include a healthy selection of sensors and outputs which should prove useful in evaluation with typical use cases.

Annotated_c01bcde8f64a93598eaf5bf902fbdac2c552830a.jpg

In addition to USB the boards can be powered by a battery (not included) inserted into a holder on the underside of the PCB. This should come in handy given that in evaluation and prototyping it would be typical to want to test the range of the solution and use multiple boards, where tethered operation with power cables could be inconvenient.

Cell_01edc3869413fcc2053f5ac2ad56c57d20c0a236.jpg

A jumper allows the power source to be selected.

Jumpers_f3f01b7ce91339e2f012fda32a6cace89a50a7a8.jpg

Another jumper can also be removed to allow current measurement. Again, a handy feature to have when developing low power solutions which will be battery powered.

Current1_0b0e5e1775511240834e9c6673b85ab1fd1c8cc1.jpg

Software support includes code examples such as:

  • RGB light
  • Dimmer
  • Motion sensor
  • Temperature sensor
  • Smart switch

These are built and applications are developed using the Eclipse IDE based Modus Toolbox. As noted previously, the SDK provides peripheral drivers and APIs, a Bluetooth stack with support for numerous profiles, and support for device over-the-air (OTA) upgrades.

Module convenience

Module_3afb4069db0aed3e5fdbe8c41dc07ce3e3d389c3.jpg

Rather than mounting a CYW20819 SoC directly, the mesh boards make use of the CYBT-213043-02 module. This combines the SoC with a crystal, passive components and a PCB antenna plus RF matching, in a convenient 12x16mm module that has also screening and employs castellated solder pad mounting. The module is also qualified by Bluetooth SIG and has FCC, ISED, MIC and CE approval, which altogether should mean less work when integrating into solutions.

SDK setup

MT_Update_490a577cee1c98184e0f665d49734e381cb2b1a1.jpg

So next let’s take a look at getting the development environment set up.

First we need to install Modus Toolbox. With Linux it’s simply a case of downloading the archive, extracting this and then executing the eclipse/ModusToolbox file. We could opt to use the bundled Bluetooth SDK v1.0, but better to download an up-to-date version.

After executing ModusToolbox and selecting the location for the workspace (where to store projects etc.) we can then proceed to update the SDK. If we select Help > Update ModusToolbox SDKs... we will get an error and following which an Update Modus Toolbox window will appear. From here we can then select to remove SDK 1.0, following which click on Install Custom SDK and browse to the .cysk file extracted from the downloaded ZIP archive.

Bluetooth Mesh 101

CYW_Mesh1_396a7a924e2c3f3bf595e485b09260cf9bc11f4f.jpg

Bluetooth Low Energy (BLE) has proved popular in IoT applications, but whereas this is point-to-point only and hence has a limited range, with Mesh every node can communicate with every other node that is part of the same network — with the potential to greatly extend the effective range. This is facilitated via “advertising” or broadcast packets and nodes relaying these on to other nodes, instead of having one-to-one connections between simply a pair of devices.

A BT Mesh network is made up of the following node types:

Relay Node

Relay Nodes are able to forward packets on to other nodes and most have this feature unless they are Low-Power. Examples of a relay node might be a smart bulb or switch.

Low-Power (LPN)

Low-Power Nodes operate on low duty cycles and work in conjunction with Friend Nodes that collect messages on their behalf. Battery operated devices are typically Low-Power Nodes.

Friend Node

Friend Nodes communicate with LPNs at predefined intervals, meaning that the latter can conserve energy, while the Friend Node may require more memory due to its store and forward function.

Proxy Node

Proxy Nodes relay messages between network types. For example, you might have a smartphone that supports BLE but not Mesh on one side, with a Mesh network on the other side.

Provisioner

A node that is a Provisioner is responsible for joining unprovisioned nodes into the mesh network and takes care of things such as key exchange for secure communications.

A BLE Mesh operates using a “managed flood operation” to transfer messages, which is to say that this is a multi-path implementation, albeit with measures such as a Time to Live (TTL) to ensure that messages which have been relayed once are not relayed through the network again.

Publish and subscription (pub/sub) messaging — think along the lines of MQTT etc. — is also possible, where you have a Publisher Node which sends messages and only those which have subscribed to it will receive messages.

Some additional key concepts in BLE Mesh are:

  • Elements. A node has one or more elements with entities that define its functionality. A dimmable bulb, for example, might have two elements: one for a lighting function and another for an occupancy sensor.
  • Models. A node will have a Server, Client or Control model which defines its functionality. E.g. using the previous example, a Server Model might expose the states of the dimmable bulb elements that can be read or controlled by a client.
  • States. These might be e.g. ON and OFF or some value on a scale.
  • Security. AppKeys are used to separate applications. NetKeys separate networks and subnetworks. DevKeys are unique to a device.

So there we have it — a network built on Bluetooth technology and with increased range and resilience due to its mesh architecture, featuring support for low power devices aided by always-on mains powered nodes, plus multi-level security and interoperability with non-mesh capable devices.

Examples

NewApplication_f7653a9f9c5b0b667ddb327fa618fa15472af483.jpg

We can get the very latest examples for the kit by cloning the following GitHub repository or selecting to download a ZIP archive:

https://github.com/cypresssemiconductorco/Code-Examples-BT-SDK-for-ModusToolbox.git

To build an example if we then select File > New > ModusToolbox IDE Application and when prompted select the CYBT-213043-MESH target hardware. At the time of writing the SDK ships with four examples and next we are given the option of selecting one of these as our Starter Application. However, just below the project list there is an Import... button and selecting this will allow us to browse to a project in our cloned GitHub repository.

StarterApplication_8a4564fab0a016e5f75407f0768419b97aae137d.jpg

Even if you’re interested in one of the examples that are packaged with the SDK, it’s probably a good idea to use the version of that which is provided in the GitHub repository instead, as this is likely to have been updated more recently than the examples which are bundled.

ChangeProjectSettings_62de7643fa3599206bcf6f5bab1fb2e0e812727c.jpg

With a project loaded in the IDE we can select its name in the Project navigator top-left and then right-click and select Change Application Settings... to set options such as the device address. Above we can see the options that are available for the Sensor Motion app.

Bottom-left in the IDE we have a Quick Panel with handy links to common tasks, such as to launch build and then subsequently program the board. Note that if running Linux your user account will need to be a member of the dialout group in order to be able to program boards.

MeshController

MeshController_e8182be90461ca6b693903ab45ac8d1e301c9c13.jpg

Companion helper applications are provided for Android, iOS and Windows. These facilitate evaluation and development, with source code provided along with pre-built binaries. The apps are provided as part of the BT SDK and are found located under the directory:

ModusToolbox_1.1/libraries/bt_sdk-1.1/components/BT-SDK/common/apps/snips/mesh/peerapps/

To install the MeshController app on Android:

  1. Plug an Android device into a laptop/desktop and enable USB for File Transfer
  2. Copy the MeshController.apk file onto the device
  3. Open the Files app on the Android device, navigate to the package select to install

Further reading

Cypress provides comprehensive documentation for Bluetooth Mesh, ModusToolbox and the BT SDK. For example, see:

Andrew Back

Open source (hardware and software!) advocate, Treasurer and Director of the Free and Open Source Silicon Foundation, organiser of Wuthering Bytes technology festival and founder of the Open Source Hardware User Group.