Optimizing Power Consumption and Ensuring MQTT Reliability with ESP32 and FreeRTOS
In an effort to optimize power consumption in an ESP32-based loT project using FreeRTOS and MQTT, I face challenges with high power usage and unreliable MQTT reconnections after deep sleep.
Despite using deep sleep modes and optimizing task scheduling, power consumption remains at 10mA, above my target of 5mA. The ESP32 stays in deep sleep for 10 minutes before waking up.
Upon waking, MQTT reconnections fail intermittently with errors such as MQTT:
Connection Timeout, Failed to Re-establish Network
Connection, and Server Response Delayed, causing missed data transmissions and requiring multiple retries.
What advanced techniques or configurations can further reduce power consumption while ensuring reliable MQTT communication upon wake-up?
3 Replies
Are you using ESP-IDF ?
Share your code
Try doing this
1. Use Low Power Modes: Employ the ULP co-processor and disable unnecessary peripherals.
2. Optimize Deep Sleep: Use efficient deep sleep functions and increase sleep intervals.
3. Adjust MQTT Settings: Set proper timeouts and keep-alive intervals, enable persistent sessions, and use a back-off strategy for retries.
Check this docs also for better insight: https://docs.espressif.com/projects/esp-idf/en/release-v3.0/api-reference/system/power_management.html