CO2 sensor with STM32WB and Tuya Smarthome
In this project my aim is to develope CO2 level supevisory tool with STM32WB, SPG40 CO2 sensor and widespread Tuya smarthome framework and smartphone app. Tuya compatible zigbee gateways are made by many manufactures, for example Nedis.
Tuya smart is wide spread home automation environment. For example, Nedis zigbee gateway is Tuya compatible and I have several sensors for it. Mainly temperature / humidity sensors, but also one water leagage sensor. Because I wanted to follow also CO2 level in some rooms, I decided to make my own CO2 sensor device using STM32WB and zigbee. For that we need account for Tuya IOT developer portal.
For developement I am using stm32wb5mm-dk board with Sensirion's SPD30 sensor module. For final product I use module STM32WB5MMGH6TR and SPD40.
Tuya's zigbee supports also third party zigbee devices. They have their own zigbee modules, which are directly supported, but also any zigbee capable device is possible to use.
Because you need Tuya PID for Zigbee basic cluster's manufacturer name, you have to make project in Tuya IOT developement platform. The category for CO2 sensor in Tuya developer platform is CO2 detector. Tuya's zigbee network joining guide is here: networking guide and Tuya Zigbee.
It is in chinese, but Google translate it well. Only Tuya specific feature in joining to gateway is basic cluster reading. For that basic cluster information needs to be written. It has to be done after endpoint is created. Otherwise adding attribute returns error code. The basic cluster information can be written like that:
uint8_t mfr_name_str[17] = { 16,'_','T','Z','3','0','0','0','_','r','4','y','c','a','n','l','f' }; //_TZ3000_r4ycanlf status = ZbZclBasicWriteDirect(zigbee_app_info.zb, SW1_ENDPOINT, ZCL_BASIC_ATTR_MFR_NAME, mfr_name_str, 17);
Above shows also how manufacturer name should be formed.
In Tuya developer platform you can define which values are transferred as shown in attached pidture.
When joining to the gateway don't set TC address to 0xFFFFFFFFFFFFFFFF , because it means distributed security network. In our case we have centralized TC.
Project's status is such that joining to the gateway works fine, but I can't get the values transferred yet. For some reason STM32WB5 won't send the response to the simple descriptor request, which comes from the coordinator (gateway).
For developement I am using stm32wb5mm-dk board with Sensirion's SPD30 sensor module. For final product I use module STM32WB5MMGH6TR and SPD40.
Tuya's zigbee supports also third party zigbee devices. They have their own zigbee modules, which are directly supported, but also any zigbee capable device is possible to use.
Because you need Tuya PID for Zigbee basic cluster's manufacturer name, you have to make project in Tuya IOT developement platform. The category for CO2 sensor in Tuya developer platform is CO2 detector. Tuya's zigbee network joining guide is here: networking guide and Tuya Zigbee.
It is in chinese, but Google translate it well. Only Tuya specific feature in joining to gateway is basic cluster reading. For that basic cluster information needs to be written. It has to be done after endpoint is created. Otherwise adding attribute returns error code. The basic cluster information can be written like that:
uint8_t mfr_name_str[17] = { 16,'_','T','Z','3','0','0','0','_','r','4','y','c','a','n','l','f' }; //_TZ3000_r4ycanlf status = ZbZclBasicWriteDirect(zigbee_app_info.zb, SW1_ENDPOINT, ZCL_BASIC_ATTR_MFR_NAME, mfr_name_str, 17);
Above shows also how manufacturer name should be formed.
In Tuya developer platform you can define which values are transferred as shown in attached pidture.
When joining to the gateway don't set TC address to 0xFFFFFFFFFFFFFFFF , because it means distributed security network. In our case we have centralized TC.
Project's status is such that joining to the gateway works fine, but I can't get the values transferred yet. For some reason STM32WB5 won't send the response to the simple descriptor request, which comes from the coordinator (gateway).
Discussie (0 opmerking(en))