Battery Management - Need to program or is it automatic?
-
Building a project with M5Stack DinMeter that will run 24/7. This is the first time I've given serious thought to power management and battery charging. Doing some research, it seems like it is the responsibility of the programmer to incorporate power management and monitoring battery voltage to enable or disable charging... Is that correct?
My application is driving relay modules and if external DC power is lost I will need to put the controller into Sleep mode so battery can maintain RTC time. Then when external DC power is restored I need to wake controller and resume normal operation.
I found this code to check if external DC power is available - I assume that this is the same as checking if USB power is attached -
// If on battery power the system go to sleep and waiting for the wakeup call by RTC // If on USB power the system stay awake so undo what shutdown() did and waste some time before repeating the main loop M5.shutdown(sleepseconds); M5.enableMainPower(); M5.RTC.clearIRQ(); delay(sleepseconds*1000);
Now I need to find examples of battery management and charging. If anyone has information or links on this topic I would be grateful if you could share them.
Thanks!