cancel
Showing results for 
Search instead for 
Did you mean: 

ZigBee Cluster and how to configure the ZigBee stack for my soil moisture sensor?

Kampi
Associate III

Hi,

I´m designing a ZigBee-based soil moisture sensor with three different sensors on it:

- A cap field for the soil measurement
- A temperature sensor for the ambient temperature
- A light sensor for the ambient light

But I´m unsure about a good approach to the ZigBee integration for this sensor and I also don´t understand the idea behind "Clusters" and "Endpoints" so far. Is a "Cluster" something like a "Service" and the "Endpoint" like a "Characteristic" in BLE? If not, what is a good explanation for it?

For the configuration, I have two ideas in my mind

1) Use a different endpoint for each of these sensors. The device ID is set to "Simple Sensor" and "Light Sensor" with profile ID "HA" and don´t use any Cluster

2) Use one endpoint with device ID "Simple Sensor" and profile ID "HA" and use the "Water Content Measurement", "Illuminance Measurement" and "Temperature Measurement" cluster

Which one is the best way (or does an even better solution exist)?

1 ACCEPTED SOLUTION

Accepted Solutions
Ouadi
ST Employee

Hi @Kampi,

Actually the Device ID list configuration on CubeMX does not support all the device ID contained on the struct ZbZclDeviceIdT from the file zcl.enum.h, So you have to configure it manually in the code generated by CubeMX waiting for a new version with the DeviceID list updated.

Best regards

Ouadi 

In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'

View solution in original post

4 REPLIES 4
Ouadi
ST Employee

Hello,

The zigbee protocol is a bit different from the BLE in terms of architecture and mechanisms used for communication between nodes.
Actually, Zigbee uses the cluster-based architecture where each physical device has one or more endpoints linked to a profile ( Home automation,Smart Energy..) which is a logical entity identified by a DeviceId and can have one or more Clusters ( Attributes and Commands)
Here is some links which introduce the Zigbee architecture and how to use clusters template on STM32WB Series :
Introduction_to_Zigbee 
an5498-how-to-use-zigbee-clusters-templates-on-stm32wb-series-stmicroelectronics.pdf 

Regarding your application :
Each sensor has a specific role and can be considered as an application for Zigbee network, which means 3 endpoints using a dedicated device ID like( ZCL_DEVICE_HUMIDITY_SENSOR, ZCL_DEVICE_ENVIRONMENTAL_SENSOR, ZCL_DEVICE_LIGHT_LEVEL_SENSOR)

For this configuration, you need to use at least one cluster for each endpoint which defines the functionality or service that the endpoint provides or uses, please find below an example: 
/* Endpoint: SW1_ENDPOINT */
req.profileId = ZCL_PROFILE_HOME_AUTOMATION;
req.deviceId = ZCL_DEVICE_ENVIRONMENTAL_SENSOR;
req.endpoint = SW1_ENDPOINT;
ZbZclAddEndpoint(zigbee_app_info.zb, &req, &conf);
assert(conf.status == ZB_STATUS_SUCCESS);
/* Temp meas Client*/
zigbee_app_info.temp_meas_client = ZbZclTempMeasClientAlloc(zigbee_app_info.zb,SW1_ENDPOINT);
assert(zigbee_app_info.temp_meas_client != NULL);
ZbZclClusterEndpointRegister(zigbee_app_info.temp_meas_client);

Best regards
Ouadi

Kampi
Associate III

Hi @Ouadi 

thank you for your explanations. So I configured my ZigBee stack to use three endpoints, but I can not find "ZCL_DEVICE_LIGHT_LEVEL_SENSOR" as Device ID in STM32CubeMX. Instead, I find this

Kampi_0-1699769394429.png

Same for the other device IDs.

Or do I have to replace the selection from the STM32CubeMX UI with your example?

 

Ouadi
ST Employee

Hi @Kampi,

Actually the Device ID list configuration on CubeMX does not support all the device ID contained on the struct ZbZclDeviceIdT from the file zcl.enum.h, So you have to configure it manually in the code generated by CubeMX waiting for a new version with the DeviceID list updated.

Best regards

Ouadi 

In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'

Kampi
Associate III

Hi @Ouadi 

thanks for your response. I´ll give it a try 🙂