Take the 2-minute tour ×
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It's 100% free, no registration required.

As a complete beginner in the field of electrical engineering, I am trying to build an alarm system on an Arduino board. I want to power my board using an external 10V power supply. In case of power shortage (probably in form of an intruder that is smart enough to pull the plug below my alarm system) I want the board to seamlessly switch to a built-in 9V backup battery.

According to the Arduino documentation, the board will automatically use the higher voltage power supply, so my external should be used whenever available.

Now I am struggling to get the circuit working. So far I came up with this: circuit idea

But this does not look right to me (connecting V_IN to the kathode came pretty natural to me, but I haven't quite figured out how to close the circuit). Could someone please explain how to properly design the circuit?

My circuit has one more issue I want to address: as you can see, there is a voltage divider parallel to my pseudo power supply. This is to allow me keeping track of the battery voltage and warning early when to exchange batteries. Using these resistor values the voltage of a fresh battery on AD0 comes across as about 0.85V. Will this drain a lot of my battery capacity while the battery is not even used?

Thanks in advance.

share|improve this question
2  
Your circuit shows the battery shorted out. –  Olin Lathrop Jun 5 '12 at 23:23
    
"Will this drain a lot..", use Ohms law, 10+1k=11k. What will Vbat/11000 give you? –  Kenny Robinson Jun 5 '12 at 23:24
4  
Kenny: the 11 kOhms is irrelvant compared to the dead short in parallel with it. –  Olin Lathrop Jun 5 '12 at 23:33
3  
@nijansen: While I appreciate you accepting my answer, it is a good idea to wait a while to see what your options are before picking one. Others may see this question has a accepted answer and skip over it, as I often do. –  Olin Lathrop Jun 5 '12 at 23:34
    
Why are you shorting 9V directly to ground ? The battery completely ignores those resistor if you are going to put a wire directly connecting the opposite ends of the terminal. Basic rule, never directly connect + and - of a battery. It will draw a lot of current, shorten the lifespan of the battery and just plain dangerous. –  user15723 Oct 31 '12 at 2:07

2 Answers 2

up vote 7 down vote accepted

The simplest way to connect a emergency backup battery as you describe is by diode ORing. Both the power supply and the battery dump onto the internal power bus thru a diode. Arrange for the power supply to be a bit higher voltage than the battery, and all the current will come from it. For example, if you have a 9 V battery then a 12 V power supply would work fine, assuming that the internal power supply can run the arduino from this whole range of voltages. This is the easy part.

The hard part is occasionally testing the battery while it is not in use. The problem is that you don't want this to run down the battery. One strategy is to use a high resistance divider to get down to the arduino's A/D input range. You could make it high enough so that the little bit of current draw is small enough compared to the battery capacity so that it doesn't matter. However, then you end up with a very high impedence signal which is unsuitable for the A/D input on the processor. You would have to buffer it, which is doable, but adds some complexity.

Another option is to switch the battery tester circuit on when needed. That takes a extra processor output pin, but now you can switch in a more substantial load so that the signal is suitable for the A/D input directly, and also puts enough load on the battery to get a meaningful measurement. You want to load it with a few 10s of mA to see what it can do with a real load, not just sitting there without providing current. Here is one way to do this:

BATT_TEST is driven by a processor digital output. When low, the battery current is off. When high, the battery voltage minus the little saturation voltage of Q2 will be applied accross the R2-R3 divider. This divider brings the voltage into the processor's range, and also loads the battery at the same time. BATTV is suitable to connect directly to a processor A/D input. You only have to turn this on for a few 10s of µs to test the battery. Once a day should be plenty often enough to check a battery that is not being used. 50 mA or so once a day for 100 µs isn't going to impact the life of the battery.

share|improve this answer

The simplest way to provide an isolated backup battery is to use two isolation diodes - your question indicates that you understand this part.

You can do what you want by increasing the value of the resistors used by a factor of 10 to 20 times and by using an Alkaline 9 Volt "PP3 battery". This will give you about 18 months of standby operation.

If you place a diode such as a 1N4004 or a 1N4148 in the +ve feed from the battery to the Arduino Vin terminal and another diode from the power supply +ve to the Arduino Vin terminal the highest voltage present will power the Arduino.
Connect B+ or PSU+ to diode Anodes and Vin to bothe Cathodes.

When battery voltage is 9V then current drain will be 9V divided by (R1+R2) odr about 0.8 mA.

A typical PP3 type transistor radio style 9V battery capacity is typically around 550 mAh so it would drain the battery in about 1 month (550/.8/24 days)

In that time the battery voltage would fall to about 6V - which would need to be checked against your Arduino specification for adequacy. The [Atmel Duemilanove] http://brittonkerin.com/annotateduino/annotatable_duemilanove.html uses the [Microchip MC33269D LDO regulator] which has a dropout of 1.5V typical. By the time the PP3 battery gets to 7V its volts/cell = 7/6 = 1.17V. That is, it will be not fully exhausted when the regulator reaches it's lowest Vin for a stable 5V out. If you used say a small 12 volt, 1.2Ah lead acid battery it would last about 2 months.

The Arduino ADC maximum allowed input impedance specification is 10 k ohms (giveon on [page 194 in the data sheet] http://www.atmel.com/Images/doc2486.pdf) but it is clear from the text that a larger value than this is possible if possible reduced accuracy is required.

Rin effective is R1 + R2 in parallel which is slightly less than R2 when R1 is much bigger than R2. You can increase R2 to 10,000 Ohms and R1 to 100,000 Ohms, in which case you'd get about 10 months for Alkaline and more than 3 years for lead acid , but self discharge will reduce this value, in this application. The divider current will drop as battery voltage drops so you will get longer with the PP3 battery probably in the 12-18 month range. , as long as the Arduino will accept 6V in when the battery is almost fully discharged, but the lead acid battery "self discharge" will stop you getting 3 years.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.