Skip to content

andi38/esp-zigbee-sensor-custom-cluster-reporting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 

Repository files navigation

ESP32-C6 & ESP32-H2 Zigbee Sensor (Analog NTC) Custom Cluster Reporting with Light Sleep

This project is about reporting temperature values through zigbee network. Temperature is measured by ADC with NTC resistor. Zigbee function is a custom cluster with minimal, maximal, and on-change reporting intervals in order to transmit more frequently on changes. Light sleep is used to reduce energy consumption. It works on both esp32c6 and esp32h2 as zigbee end device.

Transmitted data is received by tasmota zigbee coordinator.

Previous work considered for this project are the examples from Espressif SDK (in particular "light sleep", "sleepy ED", and others from Zigbee-SDK) and the following projects:

https://github.com/lmahmutov/esp32_c6_co2_sensor

https://github.com/prairiesnpr/esp_zha_test_bench

https://github.com/luar123/esphome_zb_sensor

Getting started

For a fresh install make directory ~/esp and within install esp-idf (legacy installation) and esp-zigbee-sdk according to this instructions:

https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/linux-macos-setup-legacy.html

https://docs.espressif.com/projects/esp-zigbee-sdk/en/latest/esp32/developing.html

Put folder light_sleep into folder ~/esp and compile according esp-idf manual (run export.sh and build according to existing sdkconfig). Have the paths for SRC_DIRS and INCLUDE_DIRS in main/CMakeLists.txt changed according to your installation if necessary.

Data transmission

Tasmota zigbee coordinator is version 14.2.0 on esp32c3 with cc2530/cc2591 zigbee module:

https://tasmota.github.io/docs/Zigbee/

Within tasmota after enabling joining (ZbPermitJoin) and establishing a connection, bind the device with ZbBind {"Device": "0x1ae5", "Cluster": "0xff00", "Endpoint": 90}, changing device address to the applicable value. The data (here ADC value 1853) can be retrieved via MQTT in the following format, where "FF00/0001" is the chosen custom cluster and custom attribute ID, respectively: tele/tasmota_C126AC/SENSOR = {"ZbReceived":{"0x1AE5":{"Device":"0x1AE5","FF00/0001":1853,"Endpoint":90,"LinkQuality":184}}}

Reporting intervals and other parameters are set in zb_ntc_sleep_xx.h. Data is reported when changed more then DELTA, latest after MAX_INTERVAL, earliest after MIN_INTERVAL. A switch (here GPIO3 in esp32c6 and GPIO4 in esp32h2) is added to transmit more frequently in order to run a calibration sequence. Obtaining correct temperature from the ADC reading is done in a seperate script including the calibration function, e.g. a python script listening to MQTT and writing to a database.

Power consumption

Although in the schematic 3.0 V is given as supply, I observed instabilities with 3.0 V (two alkaline cells) and now prefer using 3.3 V or 3.6 V. Current consumption with esp32c6 was about 500 µA in average (during light sleep phase 53 µA). One transmission was about 106 mJ during less than 0.9 s. One minute idling and ADC activity was about 700 mJ. So, once joined, during 15 minutes with one transmission (no temperature change) in average 260 µA were drawn.

Further Comments

Binaries in /bin were compiled for esp32c6.

I use this device to monitor flow temperature of my heating system. The NTC resistor used is a small bead type (100k, beta 3950) used in 3D printer nozzles. It is taped to the supply pipe directly behind the heater and isolated with some fabric.

About

ESP32-C6 & ESP32-H2 zigbee sensor (analog NTC) custom cluster reporting

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors