Backup Battery on mains failure

Hi, I've been creating some arduino nodes with nrf24l01 and some relays to control my room and now I want to power them when there is a failure on the main power, but need some help with the current readings i got from both nodes.

First, Node A:

normal operation :

With one of the four relays ON:

So, from what i understood, Node A is consuming 42.9mA on normal operation and 110.8mA with 1 relay ON, is that correct ?

Next, Node B:

normal operation:

and because with the red probe on the 200mA MAX (bottom right side) it couldnt power the electric door lock, i had to move it to 10A and now that's where current readings made me confused with eletric door lock ON:

http://imageshack.us/a/img812/6186/7kjb.jpg (scale 20m) it seems equal to the 10A scale shown above?! 0.5 ~ 0.49 ... CONFUSED :| http://imageshack.us/a/img837/7884/2tlk.jpg (scale 200m) also this doesnt make any sense to me

so at normal operation is consuming 55.9mA and it's consuming 500mA with the door lock on ?

With that questions answered i can understand what capacity i need for a battery. Since i'm powering those arduinos with 12v, i'm gonna look for a 12v battery and charger, correct ? (1) Now, i want them to work directly from a 12v charger (power supply) and , when there's a mains power failure, they detect the failure and work from the battery and disconnect from the battery when main power returns. (2) Also, i want that the arduino can detect if there was a power failure, or more simple, it knows when it's running from the battery. I'm power

If you have the option to use a small 12v lead-acid battery that will be by far the simplest back-up solution. Just get a suitable trickle charger and leave the charger on all the time. When the power fails the battery will just keep things going without the need for any detection or switchover. Obviously the charger has to have somewhat more output (perhaps 50%) than the average consumption of the Arduino and its accessories.

If you put a suitable diode between the charger and the battery the Arduino could monitor the voltage on the "mains" side of the diode to detect when the mains supply fails. Bear in mind that the diode will cause a voltage drop and must be well able to carry the full charge current continuously.

...R

Yes im thinking about a 12v lead acid battery. About the readings can someone comment? I would like to see a circuit showing what i need to do related to charger/battery and the two arduinos plus a detection circuit(so one of the arduinos can check if its running from battery)

From your earlier post I can't figure out what is confusing you. You haven't posted a link to the specs for the lock so I can see no reason to dispute the 0.5A consumption.

...R

With most multimeters with both a low current and high current socket you have to ensure the correct range is set for the socket you are using, the meter is actually just reading a voltage across a shunt resistor network. Use the 2000mA range with the 10A socket and the result is meaningless.

The high current shunt cannot be switched since the voltage across the switch would massively reduce the accuracy of the reading and the high current would rapidly destroy the switch contacts, hence the separate socket to plug the probe into. A 10A shunt might be a few milliohms only.

Thank you for the explanations One thing that made me confused was the 0.5 on the 10A scale being the "exact" same value as 0.49 on the 20m scale

According to the door lock specifications sheet, it can use from 200mA to 450mA. So 450mA plus 50mA from normal operation = 0.5A ;) that right.

About the backup battery circuitt: (1) Over estimating power draw from the two arduinos... let's say they draw 0.6 (node a) + 0.6 (node b) = 1.2 amps A battery with 1.5AH, would work for one hour, correct? (2) Can you give me some hints/examples, to connect the battery/charger to both arduinos and one of them sense if it's working with battery or not ?

Unfortunately battery manufacturers are very generous with their own specifications and I don't know any way to test their claim without damaging the battery through excessive discharge. You should only expect about half the stated capacity to be available on the basis that in your case the battery will only be discharged occasionally. If I had a project where the battery is used frequently I would only rely on 1/3 or 1/4 of the stated capacity.

I would wire the system like this (hope it makes sense - read from top to bottom)

wall-plug | battery charger | ------------- Arduino connection to detect voltage with suitable voltage divider | diode | battery | --------------- power to Arduino 1 | --------------- power to Arduino 2

...R

Yes, the drawing you made, makes sense :) Where i live power failure is not very common... it can happen 1 once in a week, or 2 or 3 times in a month but for very short period, so the battery is only to prevent me being locked outside the room.

Despite planning on using 12v for both arduinos, I am having some problems with the 7805 regulators now :/ With that readings on node B, (55mA normal operation and 0.5A for 10 seconds when it opens the door lock), powering with a 12v 2A wall supply, the regulator 7805 is getting too hot (i mean, if i touch it i can burn my finger in a matter of seconds). But according to my calculations: (12-5)*0.5 = 3.5W maximum because normaly it would be (12-5)*0.05 ?, shouldnt the regulator operate normaly with this power dissipation ?

Would this work and prevent the 7805 from being too hot ?

With that schematic how would i be able to detect if i'm getting power from charger or from battery ?

I've suggested twice now that you should put a diode in the power supply and use the Arduino to detect the voltage on the power supply side of the diode. The purpose of the diode is to prevent the battery from putting a voltage on the power supply line when the external power fails.

Be sure to drop the sensed voltage below 5v with a voltage divider (a couple of resistors) or the 12v of the charger will damage the Arduino.

...R

Ok, what kind of diode can i use ? And also what values of resistors i need to go from 12v to 5v so i wont damage the arduino ?

About the schematic i posted, it should work, right ? Both arduinos receive the +5v power that comes from the switching regulator that receives power from the 12v charger or battery if a power failure happens

I think you need to get a little book that explains basic electronics - or read about it online.

I'm reluctant to give advice that may cause damage if it is misunderstood or if I make a mistake that you can't detect. I had assumed you had a greater background knowledge.

...R

Ok, thank you for your help :wink:

Robin2, about the trickle charger constantly connected to the battery, wont that overcharge the battery?

A lead-acid battery can be permanently connected to a suitable lead acid battery charger. The charger voltage is set so that it can't overcharge. Of course this also means it will be a slow charger.

...R

The charge voltage is constant, the current is self regulated via the battery, which means they can be charged indefinitely (For lead acid only). You can charge NiMH cells at 1/10C for a long period too.

Some comments

1) Have you considered purchasing a computer UPS? this might tick all your boxes without need for any design work

2) For a reliable design the battery should be cutout before it is fully discharged. Fully discharging a lead acid and recharging is normally refereed to as a full cycle, usually they can deal with 1-4 full cycles before they are scrap.

3) You should be fine when using most voltage regulators. An LM7805 is an old but very robust regulator suited to small projects as they are not very fussy about input and output capacitors for stability, you drawing shows no capacitors.

4) remember that the output from most automotive battery chargers is very dirty, you should actually connect the charger direct to the battery and your circuit also direct to the battery if using one. The regulator will help a lot with this but you should add at least a 1U cap to the input side of the reg.

5) Your battery is capable of supplying enough current to set fire to things, on the battery output you should place a suitably rated fuse, under 2A would suit you, but remember any capacitance on the output of the battery will mean a large in-rush current which might blow even a 2A fuse.

6) Most automotive battery chargers already have diodes on their output and will not be damaged if a power cut occurs, most trickle chargers will also. However you will not be able to measure the line voltage as Robin2 correctly says. Choose a 2A diode with voltage ratings in excess of the likely supply range.

7) Remember your voltage reg is dropping 7V with a 500mA output (looking at your pics?) P=IV so the regulator will be dissipating 3.5W. A 3 pin TO-220 has a thermal resistance of circa 40 deg C per watt junction to air. Very roughly this will mean a junction temperature rise of 140 deg C above ambient. You will need a heat sink, this will probably get you down to 10c per watt giving 35deg above ambient which is perfectly acceptable.

8 ) Assuming again that you are using a solenoid to lock a door, which will be scoffing 0.5A for long periods of time your battery will have to be pretty large. A motor bike lead acid is around 8Ah which could mean 16hours of door lock fun. But remember you can't fully cycle and expect long life time. Bank on 12 hours max from a motor cycle lead acid.

Have a good read up on basic electronics as recommend before building this. Anything on the mains is a fire hazard, anything on a big battery is a fire hazard. Fuse everything, limit currents as much as possible, be safe and learn as much as you can.

Rob,

Hello_World_ROB: You can charge NiMH cells at 1/10C for a long period too.

Very bad idea. Maximum float more like 1/60C, notwithstanding any advertising to the contrary. Most instructions specify not to charge more than 24 hours at most.

Hello_World_ROB: Remember that the output from most automotive battery chargers is very dirty

Most "traditional" automotive battery chargers are unregulated and completely inappropriate for float charging, though there is as with other appliances, a trend to move to switchmode versions which are lighter, actually use less materials and thus (now) more economic to manufacture and are by default, regulated. However, unless specifically designed for the purpose (and truly "intelligent", actually switching from "recharge" to a genuine "float" mode), should not be used as float supplies.

Such a regulated supply may however, be suitable for float charging if you add the diode or diodes suggested to reduce the "float" voltage.

Hello_World_ROB: Assuming again that you are using a solenoid to lock a door, which will be scoffing 0.5A for long periods of time your battery will have to be pretty large.

I think it is pretty clear that he intends the solenoid to un*lock the door, so the very opposite is true. He is more concerned that he be able to get *in in the case of power failure.

Where electromagnetic holds are employed, it is usually considered entirely desirable that they release on power failure.

Where electromagnetic holds are employed, it is usually considered entirely desirable that they release on power failure.

And for public/work environments this may indeed be a code or legal requirement as it could lead to loss of life in emergency situations. A battery back up design would be very questionable as how would one ensure the battery would function years down the road when there may be a real emergency situation requiring the door to unlock automatically?

Fail-safe design is called for in my opinion. No single point failure should lead to undetectable failure to operate when required.

Lefty

An UPS is expensive and i'd like to keep the thing on a diy style and gain some knowledge As refered by Paul__B, the battery is only to be as a backup power, not for constant use. Both of my diy arduinos have the LM7805 regulator and respective capacitors, but since i need to bring 12v to 5v (planning on using the LM2596 dC-dc converter cause it's cheap), i need to remove the LM7805 and the capacitors... and the LM2596 should bring a clean 5v power line to the arduinos, correct? I am planning on using Lead acid battery, but dont know if every charger and battery combo will work as you refer (that stops charging once the battery is full) but how does this works ? The charger will stop providing power once the battery is full, or the battery will not charge anymore and the charger keeps providing power (so it can power the arduino when it's not charging the battery) I just need some directions on this, because this is the main question of the project... and this will help me on future projects that need to work even when the main power fail.

Yes, it should be fail-safe, but i want to keep the door locked just in case somebody brings the power down so they can enter the room.

I remain confused as to why you refer to two Arduinos in this project.

Beyond that, unless I have missed something, the Arduino itself will draw only about 50 mA at most, so a 7805 or even the tiny LM117 regulator used in the stock Arduino should be perfectly happy running at 12V as long as you are not expecting to to carry the solenoid current, the solenoid being switched by a transistor from the Arduino output pin and as best as I can follow, is connected direct to the 12V anyway. A switchmode regulator will be slightly more economical on power.

Now, to float charge a 12V Lead Acid ("Gel cell") battery, you generally provide it with a regulated supply set to about 13V. A car charges at 13.8V but this is excessive for continuous use. Since you are using a battery, and in the absence of any other device - RFID or whatever - you do not seem to have described what the interface device is, drawing power, then this float charger probably needs to be rated at only a couple of hundred milliamps and could be a regulated "plug pack" if that can be set to 13V, or any unregulated supply feeding a 7812 regulator with two silicon diodes in series with its "reference" terminal.

The two arduinos i refer, is Node A and Node B, they are two independent arduinos.

The power draw is as follows: Node A maximum: 0.7A

Node B maximum: 0.1A

Door solenoid maximum: 0.5A

total: 1.3A

I tried powering the Node B (that only draws maximum 0.1A) with 12V, and the 7805 regulator got too hot. That's why i now bought the LM2596 dc-dc converter, to feed those two nodes with 5v and avoid the 7805 regulators. The solenoid can receive the 12v directly from the battery. The question that remains to me is, will the trickle charger continue to supply power to arduinos even when the battery is tottaly charged ?

So can i wire it as this image i posted before?