Arduino backup battery power (UPS behavior) ?

Hello guys,

I don't know to many about electronics but I already did simple some simple projects with arduino. Now I wanted to add a battery backup power to one of my circuits, and I was wondering if this schematic will work (I did it a few days ago in fritzing)

  1. The thing is I preferred to use a single 2000+mah li-ion smartphone battery, as is quite compact compared to 4AA, and for that I will probably need a step-up DC convertor , not a step-down like I drew in the schematic. Maybe I should use as the main power source a transformer with less than 5v output, and use a step-up regulator like this http://www.ebay.com/itm/201045503060?var=500239373359 ?

  2. I noticed something interesting while testing an old phone charger (nokia, output 3.7v, 300mA) When I used an multimeter to check the output it was 8.5v !! If I connected a big ceramic resistor to it it dropped to 2.65v . Is this normal? I tried 2 nokia chargers as those are the only ones I have, that on their label is mentioned the output of 3.7v

If there are no issues with my schematic, I can think of two options I have:
a. use a different battery, or 4xAA batteries to supply a higher voltage to a step-down convertor to power arduino and ofcorse, as main power a transformer of 7 - 9v
b. use a 1cel li-ion battery (and a charging circuit controlled by arduino, to check the battery daily) and a step-up DC converter

I'm intrested to avoid reseting arduino when the power is lost, this is why I added a big capacitor (1000uF maybe) on the input of arduino, while the relay is decoupling the power neded by arduino should be provided by that capacitor. Maybe I could make this simplier if I will save the settings of my program in arduino flash memory, but now I use 5 libraries (aJson, SPI, ethernet, oneWire, freeMemory) and I'm out of space, the code has 28400bytes, there are aprox 300 free bytes which I freed by commenting all the serial.Print lines.

Any advices are appreciated.

Here is the latest modifications Imade to my program, I added a status RGB led to know easily the status of this online thermostat - YouTube

First, you will need a special charge management circuit for charging your battery. If you don't, chances are it will explode and, if not killing you, it will put you in the burns ward at your local hospital.

Secondly, why re-design the wheel? Sparkfun has a shield that does just what you want: SparkFun LiPower Shield - DEV-10711 - SparkFun Electronics

Thirdly, you can run an Arduino at 3.3V quite happily, as long as what you have attached to it also works at 3.3v (which most things will these days). No need for a fancy boost regulator.

Thank you majenko, but I think you misunderstood me. I didn't added the charging part in the schematic because this topic was about a different subject.

I want to have a circuit that swaps the power source from AC to DC when AC power is unavailable. Just like a computer UPS (Uninterruptible power supply). I wanted to know if my schematic is correct and will work as I made it .

I added a relay which if is unpowered it will supply power to arduino from DC backup battery, if the relay is powered it will supply power to arduino from AC transformer, the AC transformer also powers the relay.

Thank you.

You don't need a relay. Relays are fine for this if you are switching massive currents and voltages, but for a simple Arduino you don't need one.

The Arduino already has the needed hardware in it in the form of the barrel jack and USB. That uses a P-channel MOSFET and an op-amp. You could simply replicate that circuit yourself, or use the existing one onboard :wink:

The problem with a relay is there is (usually) a time during switching when neither connection is established, and during that time you will need to provide enough power from a tank capacitor, and that's going to be large. Also relays are large, whereas a MOSFET is little.

http://www.ti.com.cn/cn/lit/ds/symlink/lm1117-n.pdf Fig. 37.

Make sure you match Vin to the float charge of the battery you use -- don't overcharge the battery. That's the biggest problem with this circuit; maybe even needs a third regulator just to solve that issue.

LM1117-backup.png

@majenko Thank you for the tips, I don't know how MOSFET works, maybe I should have mentioned that only for this prototype I work with arduino UNO, but when this will be ready I will use either a Arduino Pro mini or a Spark Core (I ordered it but not yet have it). My only issue with the ATmega328P is the 32kb of flash, I quite on the limit and I really wanted to add a wireless node, don't know if I can fit that too in less than 1000 bytes .

So I will need to provide 5v or 3.3 v and make the UPS circuit external, I will search and read about MOSFET implementation in arduino to see if I can use that, the mosfet switches very fast from one power source to another , without losing power ?

I did not find yet an online calculator to see if my curent draw is 100 - 200mA what capacitor do I need to provide power for let's say 0.1 seconds (I don't know if the relay will need more time to switch to the default position, this is a datasheet I quickly found and release time is max 5ms )

If anyone can help me with tips to calculate the capacitor value I need for 0.1 seconds with an amp draw of 100 - 200mA I'll appreciate.

majenko, after I will find out how mosfet works and if it can replace the relay, I'll use it definately as it is much smaller than a small relay :slight_smile:

@Chagrin, I appreciate your answer but I really don't want to discuss in this topic about the charging part, this is why I did not added any component in my schematic, maybe I will decide to use 4AA which don't need to be recharged, or one 9V battery which the same doesn't need to be recharged as for sure it will last a lot of time , as it is just for backup, not for full time operation on battery.
If I will chose one cell lipo/li-ion I already have something like this :

Any other advices are appreciated, tonight I will read more about MOSFET as I like the tiny size of it, compared to relays.

The mosfet is basically an on-off switch. It's a form of transistor. You basically want the switch to be "off" when the main power is on (the mosfet controls the battery power), and on when the main power is removed.

If the two voltages are very different (i.e., the main power is higher than the battery power), and they can both take the same route into the device (i.e., both going into the same voltage regulator), then you don't even need the mosfet - just a pair of diodes will do the job:

The voltage difference has to be high enough that the diode in the battery circuit is reverse biased, so for silicon diodes you're talking around 0.7V, preferably more (7.2V battery, and 9v main power would do nicely).

The MOSFET system used in the UNO is kind of like this:

When there is main power applied the comparator U5A provides an output "HIGH" signal. This turns the MOSFET off. When main power is removed the internal diode in the MOSFET allows enough voltage through to power the system, which then causes the comparator to output a LOW signal, which turns the MOSFET on bypassing the internal diode, which allows more voltage though, so you get no diode loss.

With respect to the schematic in my earlier post, if you don't want the batteries to recharge then you can remove the two diodes and 1K resistor. What you have then is two linear regulators in parallel. In this example, the upper regulator is putting out 5.2V (due to the 50R resistor on its GND) and since that 5.2V is higher than the 5.0V that the battery regulator is trying to put out the battery regulator stays off.

If you've ever read about or tried putting two linear regulators in parallel you've probably seen that it doesn't work properly; one regulator tends to be favored over the other. That's pretty much what is happening here except one regulator's output is being set slightly higher so that it is guaranteed to be favored over the other.

I'm glad to see more and more details from you guys. Thank you.

@Chagrin, your schematic will work without any relay as I understand, right ? Because in the beginning I didn't understood why you want to use two regulators, I have a few DC to DC mini regulators I used in aeromodels / hexacopters and the regulators provided 5v on the output no mather the input voltage, so I was thinking to use just one after the switching part of the circuit.

With that battery permanently connected to the regulator, there isn't any risk to discharge it in time ? Even if the battery regulator will be off, the battery will still be charged after a few months ?

@majenko, thanks for the schematic, tonight I will try to look over it to better understand it :slight_smile:

The rate at which the regulator would discharge the battery (while "off") would be the "quiescent current" stated on the datasheet. 5-10ma is typical for any linear regulator (LM1117, LM7805, etc.). To avoid that you'd need to use a regulator that has a shutdown option such as the LP2985 that majenko shows in his schematic or find another way to make up for that lost power from your line power.

Any update ?

Reply #6, schottky diodes. 0.45V drop (vs 0.7).
1N5817, 1N5818
1A capacity.
http://www.digikey.com/product-search/en/discrete-semiconductor-products/diodes-rectifiers-single/1376383?k=1n5817
http://www.digikey.com/product-search/en/discrete-semiconductor-products/diodes-rectifiers-single/1376383?k=1n5818

You can try this:

http://ali.pub/3gc17b

or this:

http://ali.pub/2lilft