Charge battery when power up, use battery when power down

battery-chargingdevicepower supply

I have a tiny little esp8266 that runs happily on 3.3V and draws about 250mA and I can make it sleep and use very little battery power at all.
What I want to do is use supplied power when possible but switch to battery when needed.

Are there any existing components that can do this for me or do I have to fire up the soldering iron (It needs to small as well)

I had a look at some of the answers here but didn't find anything that answered exactly what I require

Help appreciated

Best Answer

Simple diodes should work. Select diodes with a low forward drop, and ensure that your line power is just a little bit higher than your battery power. Connect the cathodes together to feed your load, your battery to the anode of one, and the power supply to the anode of the other.

May as well edit to add based on the comment below, No this won't charge the battery in any way, and essentially completely isolates the battery when the line voltage is sufficient. Only when the line drops, or dips will the battery supply power.

Charging is another matter. This is just a small, simple solution for having automatically switched alternate power sources.