Add backup battery on Esp32 or esp8266

I have an ESP32 that is powered by a 12V main power supply, and I'm using a buck converter to step it down to 3.3V. In case the 12V power supply is unexpectedly disconnected, the ESP will shut down.

Now, I want to add a backup power source using three non-rechargeable AA batteries, also stepping down the voltage to 3.3V. The intention is not to run the ESP for an extended period but to use the batteries as an emergency power source to notify me when the main power supply is cut off. I'm looking for an efficient switching mechanism to ensure the AA batteries last a long time (ideally at least 1 year if unused), and the ESP continues to receive power from the 12V source.

there is not a problem if esp shut down and then restart from AA batteries.

Is there an efficient switching mechanism that can achieve this without wasting the AA batteries' power when the main power supply is still available?

Use a common step down from both 12V and AA batteries. Diode OR them and when the 12V collapses below ~6V the AAs will supply.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.