Cypress CYBT-213043-MESH Expedites Bluetooth Mesh Development
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) .
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.
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.
A jumper allows the power source to be selected.
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.
Software support includes code examples such as:
- RGB light
- 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.
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.
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
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 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 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 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 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.
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.
We can get the very latest examples for the kit by cloning the following GitHub repository or selecting to download a ZIP archive:
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.
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.
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.
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:
To install the MeshController app on Android:
- Plug an Android device into a laptop/desktop and enable USB for File Transfer
- Copy the MeshController.apk file onto the device
- Open the Files app on the Android device, navigate to the package select to install
Cypress provides comprehensive documentation for Bluetooth Mesh, ModusToolbox and the BT SDK. For example, see:
- Cypress > BLE Mesh
- In particular, Getting Started with Bluetooth Mesh
- CY20819 Bluetooth SoC Product Guide
- CYBT-213043-02 Module
- In particular, Getting Started with EZ-BLE Creator Modules
- ModusToolbox Software Environment
- ModusToolbox BT SDK
CommentsAdd a comment
Referring to the screen clip, is it just me or is the CYBT-213043-MESH kit link dead?
I did find it under this link, https://uk.rs-online.com/web/p/products/1874661/
@cpcfreak - I have noticed this happens if you are logged in from a country that might not stock the product locally. Worth checking the local RS site if yu are outside Europe. My colleague finds products via RS Export which she can't see locally, might help.
The examples all compile with no errors and do work. Each example is very simple: a light on/off switch or an RGB LED sort of controlled by PWM. What would be really helpful is an example that combines lots of elements and models on the one board maybe along the lines of the PIR sensor will switch on a red LED somewhere maybe on a different board, the USER button a green LED and two GPIO inputs can be grounded by external switches to raise/lower a pwm output.
That would demonstrate how models and elements can work together. Just a thought...
Some of the examples supplied e.g. light on/off switches, read the USER button to toggle the state of a/some LED(s) on other boards. Great! But I have discovered that it is unwise to press the USER button on other examples as it seems to cause it to lose its provisioning and maybe software. A cut and paste job on the USER button interrupt handlers seems to cure that.