[Bug]: ESP32 - EVENT_LOW_BATTERY can cause devices with external (intelligent) charging controllers to sleep forever
Category
Other
Hardware
Other
Firmware Version
2.5.x
Description
I'm seeing increased reports of "Solar station doesn't wake up after getting power". Guess we have a problem in the algorithm as we are always assuming that the device is getting charged by 5V.
Assume following scenario
-
We applying power to an entirely discharged battery through an intelligent charge controller (BQ25185, CP*, etc.) with dedicated LOAD pins
-
ADC Battery Voltage slowly rises (2.8V->2.9V->3.0V->3.1V->3.1V->V3.15->etc.)
-
Device is waking up around 2.8V-3.0V
We will never see USB 5.0V voltage during the slow charge process! These chips are using voltage-tracking-algorithm!
Power.cpp, 683
if (batteryLevel && powerStatus2.getHasBattery() && !powerStatus2.getHasUSB()) {
if (batteryLevel->getBattVoltage() < OCV[NUM_OCV_POINTS - 1]) {
low_voltage_counter++;
LOG_DEBUG("Low voltage counter: %d/10\n", low_voltage_counter);
if (low_voltage_counter > 10) {
#ifdef ARCH_NRF52
// We can't trigger deep sleep on NRF52, it's freezing the board
LOG_DEBUG("Low voltage detected, but not triggering deep sleep\n");
#else
LOG_INFO("Low voltage detected, triggering deep sleep\n");
powerFSM.trigger(EVENT_LOW_BATTERY);
#endif
}
} else {
low_voltage_counter = 0;
}
-
We get the 10 hits of "Low Battery"
-
Boom. Deep Sleep for a day (if ROUTER) or forever. But in the background we are still in a happy state as the battery is charging.
Am I seeing this right?
Solution Ideas
- Reduce Deep Sleep duration
or
- Add a define (#define EXTERNAL_BAT_VOLTAGE_CONTROL) that disables the EVENT_LOW_BATTERY transition if we are having an external charge controller and enabled the hardware watchdog
or
- Battery voltage trend monitoring
Relevant log output
No response
This issue has been mentioned on Meshtastic. There might be relevant details there:
https://meshtastic.discourse.group/t/device-brown-out-and-characterizing-chargers/14807/3
Same problem here. I have disabled power saving mode and still the same issue, device is not booting up even though the battery is fully charged.
You can (still) configure how long the deep sleep lasts (power.sds_secs) . If you set it e.g. to 30 minutes, it will wake up from deep sleep after 30 minutes and if battery is still low fall asleep again otherwise continue to work as normal.