Closed
Description
Board
ESP32H2
Device Description
Devboard, Supermini
Hardware Configuration
nothing connected
Version
latest development Release Candidate (RC-X)
IDE Name
Arduino IDE
Operating System
Windows 11
Flash frequency
80MHz
PSRAM enabled
no
Upload speed
921600
Description
The device require too much energy in active and sleeping mode.
- not clear, why there are so many peaks with 100mA
- sleeping current is in my case about 450uA - too much. Any idea how to minimize it for ESP32H2?
-
- maybe other request - provide a light sleep example without needed rejoin
Sketch
A bit modified sleeping sketch:
----------------------------------
#ifndef ZIGBEE_MODE_ED
#error "Zigbee end device mode is not selected in Tools->Zigbee mode"
#endif
#include "Zigbee.h"
#include <rom/rtc.h>
#define BOOT_PIN 9 //Boot button for C6/H2
/* Zigbee temperature + humidity sensor configuration */
#define TEMP_SENSOR_ENDPOINT_NUMBER 10
#define uS_TO_S_FACTOR 1000000ULL /* Conversion factor for micro seconds to seconds */
#define TIME_TO_SLEEP 55 /* Sleep for 55s will + 5s delay for establishing connection => data reported every 1 minute */
uint8_t button = BOOT_PIN;
ZigbeeTempSensor zbTempSensor = ZigbeeTempSensor(TEMP_SENSOR_ENDPOINT_NUMBER);
/************************ Temp sensor *****************************/
void meausureAndSleep() {
// Measure temperature sensor value
float temperature = temperatureRead();
// Use temperature value as humidity value to demonstrate both temperature and humidity
float humidity = temperature;
// Update temperature and humidity values in Temperature sensor EP
zbTempSensor.setTemperature(temperature);
zbTempSensor.setHumidity(humidity);
// Report temperature and humidity values
zbTempSensor.reportTemperature();
//delay(100);
zbTempSensor.reportHumidity();
Serial.printf("Reported temperature: %.2f°C, Humidity: %.2f%%\r\n", temperature, humidity);
// Put device to deep sleep
Serial.println("Going to sleep now");
delay(100);
}
/********************* Arduino functions **************************/
void setup() {
Serial.begin(115200);
// Init button switch
pinMode(button, INPUT_PULLUP);
// Configure the wake up source and set to wake up every 5 seconds
esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR);
// Optional: set Zigbee device name and model
zbTempSensor.setManufacturerAndModel("Espressif", "SleepyZigbeeTempSensorTest");
// Set minimum and maximum temperature measurement value (10-50°C is default range for chip temperature measurement)
zbTempSensor.setMinMaxValue(10, 50);
// Set tolerance for temperature measurement in °C (lowest possible value is 0.01°C)
zbTempSensor.setTolerance(1);
// Set power source to battery and set battery percentage to measured value (now 100% for demonstration)
// The value can be also updated by calling zbTempSensor.setBatteryPercentage(percentage) anytime
zbTempSensor.setPowerSource(ZB_POWER_SOURCE_BATTERY, 100);
// Add humidity cluster to the temperature sensor device with min, max and tolerance values
zbTempSensor.addHumiditySensor(0, 100, 1);
// Add endpoint to Zigbee Core
Zigbee.addEndpoint(&zbTempSensor);
// Create a custom Zigbee configuration for End Device with keep alive 10s to avoid interference with reporting data
esp_zb_cfg_t zigbeeConfig = ZIGBEE_DEFAULT_ED_CONFIG();
zigbeeConfig.nwk_cfg.zed_cfg.keep_alive = 10000;
// When all EPs are registered, start Zigbee in End Device mode
if (!Zigbee.begin(&zigbeeConfig, false)) {
Serial.println("Zigbee failed to start!");
Serial.println("Rebooting...");
ESP.restart();
}
Serial.println("Connecting to network");
while (!Zigbee.connected()) {
Serial.print(".");
delay(100);
}
Serial.println();
Serial.println("Successfully connected to Zigbee network");
// Delay approx 1s (may be adjusted) to allow establishing proper connection with coordinator, needed for sleepy devices
if ( (int)rtc_get_reset_reason(0) != 5 ) { // = SW_CPU_RESET=12 // POWERON_RESET=1 //DEEPSLEEP_RESET=5
delay(20000);
}
}
void loop() {
// Checking button for factory reset
if (digitalRead(button) == LOW) { // Push button pressed
// Key debounce handling
delay(100);
int startTime = millis();
while (digitalRead(button) == LOW) {
delay(50);
if ((millis() - startTime) > 3000) {
// If key pressed for more than 3secs, factory reset Zigbee and reboot
Serial.println("Resetting Zigbee to factory and rebooting in 1s.");
delay(1000);
Zigbee.factoryReset();
}
}
}
// Call the function to measure temperature and put the device to sleep
meausureAndSleep();
}
Debug Message
No errors in debug
Other Steps to Reproduce
disabled USB CDC, debugging for saving energy.
Have removed the internal temperature procedure and replaced with random value.
Have used Nordic Power Profiler Kit II for measurements with 3.3V power
I have checked existing issues, online documentation and the Troubleshooting Guide
- I confirm I have checked existing issues, online documentation and Troubleshooting guide.