How to smooth out switching from mains to battery

Hi guys, I need to keep a 5V device like an Arduino powered if it gets disconnected from mains power. I initially followed this guy (Uninterruptible 5v USB Power Supply) and got it running, but I notice when I remove mains power, the time it takes to switch to the battery results in loss of power to the device. I saw someone mention placing a capacitor to bridge that (Controlled shutdown on power loss - Raspberry Pi Forums).

I drew up an example in TinkerCAD (Circuit design battery backup power v3 | Tinkercad), but wasn't sure where to place a capacitor safely. I put a diode because the capacitor looked like it was pushing current in reverse flow. But I end up with a big voltage drop from that.

Do you have an advice or can you help build it the right way? Or, is it easier to just buy a battery like this (V75 USB Battery Pack | 19,200mAh 71Wh) and just plug it in? Thanks.

There are multiple methods to handle this. One good way is to run the Arduino from a rechargeable battery and use the mains power to keep the battery charged. No switching time involved.

You will have to design the charger, probably fast charging when the battery is low and trickle charging when the battery is fully charged.

Here is the power section of a board I made recently


The battery in this case is to cover for main power failure, so is not used much, it might be months or longer between each use. For this reason the charging resistor R1 only supplies about 10mA or so of charging current. This is all the battery needs to charge it and keep it charged when it has months to re-charge between uses.

D2 and D3 switch between mains an battery, these are Schottky diodes to minimise the voltage drop across them.

D1 prevents any of the circuitry powered from 12V from getting power from the battery, which is a specific requirement of my design and might not apply to your design.

U1 and U2 provide 5V and 3V3 respectively.

R2 and R3 are to notify the processor that it is running on battery power.

Hi,
Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".
OR
http://forum.arduino.cc/index.php/topic,148850.0.html.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks.. Tom... :slight_smile:

The best way to go about this is avoid the use of mechanical relays which bring issues of switch bounce and contact transitional time to the table. I would consider a circuit like Perry was kind enough to post or as mentioned a simple SLA battery left on a battery tender. There are also off the shelf solutions which come with a price. A simple Google of 12 Volt SLA battery and 12 Volt Battery Tender will get you a few dozen hits.

Ron

PerryBebbington:
Here is the power section of a board I made recently

D2 and D3 switch between mains an battery, these are Schottky diodes to minimise the voltage drop across them.

D1 prevents any of the circuitry powered from 12V from getting power from the battery, which is a specific requirement of my design and might not apply to your design.

U1 and U2 provide 5V and 3V3 respectively.

TomGeorge:
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Sorry, I thought the link was working: Circuit design battery backup power v3 | Tinkercad

I think it sounds like it's easier to buy a battery with passthrough charging at the moment. I'll play around with the above ideas (thanks PerryBebbington).

Hi,

Sorry, I thought the link was working: Circuit design battery backup power v3 | Tinkercad

Sorry, no not a picture of components, please a proper circuit diagram, not a simulator image.

Forget links to images, some members are using odd platforms to view the forum, not PC or laptops.

Drawing, then post a picture of the diagram is usually the easiest and sometimes involves reverse engineering where some circuit errors have been found.

Thanks.. Tom... :slight_smile: