Automatic switching to battery on mains failure?

Hello all,

I'd like to design a circuit such that my Arduino can automatically switch to a backup battery if the standard power supply (a wall wart) fails, due to a power outage or circuit breaker tripping, etc.

Any thoughts on this? I know the Duemilanove reference design has circuitry onboard to automatically switch between USB and external power. Can I reliably copy that to switch between "external" and "battery" power?

Bonus points if the solution has some capacity to charge the battery and is cheap. I'd like to use rechargeable batteries and include some form of battery maintenance (trickle charging?) so I don't have to worry about a 9v battery going flat. This is a custom "embedded" Arduino so I'm starting from scratch - there's no onboard USB and the default power switching circuit in the Duemilanove design isn't there (right now at least).

I'm sure this has been done before but I'm not finding much.

Oh, and more bonus points if the solution includes an obvious way for the Arduino to determine which power source it's running on (so it can sound an alarm when it switches to the battery).

I guess what I'm looking for is a small-capacity DC UPS.

The easiest way to do this use something off the shelf like this:

Attach a battery (any small lithium ion will do), and apply mains power through a standard AC adapter. When power is cut to mains the battery is both charged and ready to go.

Hi there,
If you are looking to embed something in your application, I would think that starting with a supervisory circuit IC like this: would be a good place to start.

Disclaimer: This is listed on my website with other surplus components that I have for sale. (I have a $5.00 minimum order and ship as much as possible in a single USPS flat rate box)

I cannot advise on the exact circuitry that you need to use but I am sure a copy of the data sheet would guide you well.

HTH- Jeff

Linear Technology and Maxim make a number of ICs that will work in your
application. Search for "power path controller" and "battery charger".
Some of the newer ICs will integrate both functions. Some ICs also integrate
switching regulator and LDO functions too.

For a very simple switchover two diodes will work. The issue is the forward
voltage drop. The powerpath controller uses a FET which has a much
lower drop. TI makes an "Ideal Diode" IC. The higher the voltage drop
the less margin you have for the linear regulator.

I have used the LT4412 for powerpath control and the MAX1555 for Li-ion

(* jcl *)


This is my first foray into battery management so you guys are gonna have to bear with me a bit.

jluciani, I had originally imagined something similar to what you're implying - that you'd essentially have on IC to determine which source to use and switch back and forth as needed, and a second IC to charge the battery when it needed it. I want to keep this as simple as possible. Are there ICs that'll do both?

In other words, I supply my "power management" circuit with, say, 9v from a wall wart. The power management circuit is composed of an IC and a battery and some other passive components. As long as the wall wart is supplying juice, the output from the power management circuit will be from that source. When the wall wart fails, the battery takes over. The IC makes sure the battery is charged all the time. Is this sort of approach possible with a single (cheap) IC?

I'm browsing Mouser and seeing things like this:

But (call me stupid) I'm not sure if this really does what I described above or not. . .

The Max1555 can accomplish what you want with one chip, but there is a small downside.

The wall wart powers the charger, but it also powers the Arduino, because the charging voltage on the battery is connected to the Arduino.

There are two problems here:

One is that the charger is trying to keep the current into the battery at something it knows, and you are "robbing" current to power the Arduino. This is probably a small problem.

The bigger problem is that when the battery is charged, the charger stops sending current. Now the Arduino is powered from the battery. No problem, but eventually, the battery is discharged enough that the charger comes back on. Again no problem, the charger is supplying current to the Arduino, and the battery again.

But the problem is that you have used a "cycle" in the battery. It's a shallow cycle - the charger won't let the battery get very discharged before it starts charging again, but the batteries do have a limited number or charge/discharge cycles.

If you use the power control chip, it really does switch the power source from the wall wart to the battery. You won't get the charge/discharge cycle.

Ok, I see the argument for two chips then.

The MAX1555 seems popular so I looked at the datasheet. Correct me if I'm wrong, but it looks like it only works for a single cell lithium-polymer battery? Correct me if I'm wrong, but that only gives me 3.7v from the battery, which won't really work unless I boost it up to something my onboard 5v reg can use, which would seem counter-productive. . .

The MAX1555 is what I use for Li-ion. The Li-ion works well for a 3.3V
system. You get 300-400mV of voltage for a LDO.
Pictures of myt MAX1555 based charged are at Loading...
I did not add powerpath control to the board. I may in the future.

The device you linked to is a NIMH charger. That should work for charging too.
You could use either charger with an LT4412 (or other powerpath controller).

I believe if you check the Linear Technology, TI and Maxim sites you could
probably find a single IC that will do both functions. Chances are the
part will only be available in SMD packaging.

(* jcl *)

Ok, I picked a chip for each purpose and came up with this:

I used the LT1512 for the charger and the LTC4412 for the powerpath controller.

I'm assuming I'd use it with a 5 or 6 cell NiCd or NiMH battery.

The datasheet for the powerpath controller had SOME info for using it with a battery charger but I'm still not sure I "get" how it operates. It looks to me like there is SOME possibility for the charging circuit to end up powering the output, but I guess that would only happen if the aux source (wall wart) was not present and the charger was charging, which should never happen - because if the wall wart's not there, the charger won't work.

There are some pricey components out there for this sort of thing! The charger IC suggests a particular dual inductor that Mouser wants almost $7 for! I may switch the charger to the Maxim MAX712 because it looks like a cheaper build that way.

Still I'd appreciate comments from some of you who have done this sort of thing before I run off and build it.

I did not check your solution in detail but it looks like it should work.

The reason it is pricey is that you are using a SEPIC converter which can operate
in step-up or step-down mode. Li-ion could work better (flat discharge, either
always step-up to 5V or step-down to 3.3V). Going with 3 Ni-MH cells (5V system)
or 2 (3.3V system) would give you a step-up. The dual inductor is replaced
with a low cost choke if the SEPIC requirement goes away.

I am not sure how much current you require but the LT3101 and LT3456 are single chip solutions that should work. They are only available in QFN packages.

Did Maxim have anything to offer?

(* jcl *)


I saw those one-IC solutions but I am hand-soldering (for now at least) so QFN packages are out. From Maxim, I saw the charger IC I mentioned above (MAX712/713) but at second look I'm not sure if it's realistic given it's voltage requirements.

As I mentioned above, the idea with this circuit is to power a typical Arduino that's using a 7805, which means that both the battery and wall wart have to be between 7.5 and, say, 12v. To me, that made the SEPIC topology attractive because the wall wart and the (fully charged) battery could be pretty much the same voltage. If I went with the MAX713, I'd need the wall wart to be significantly higher (it wants 1.9v * cell count + 1.5v minimum), which means I'm burning off a lot of waste in the Arduino's voltage regulator when it's operating on wall wart power (which will be 99% of the time).

I suppose I could put a voltage regulator on this circuit and feed the Arduino's 5v pin instead of it's Vin pin, but my particular Arduino has a pH amp circuit that needs a Vin > 5v so that solution is out.

Total current requirement is unknown but there's a lot on my 'duino clone (two 328p's, an MCP23008 for an LCD, an ENC28J60 Ethernet interface, the pH circuit mentioned above, etc.) so I'm guessing it's not going to be low.

FYI in case anyone's perched on the edge of their seat, I went ahead and designed a PCB using roughly the schematic posted above. I'll reply back once it's up and running.

So what happened? I want to do something similar...