My project runs on a 5-volt USB cable, from either a computer or a charger on the wall.
My project contains a 9-volt battery as backup, which can power the project through a 5-volt regulator if there is a power failure from the computer or wall socket.
But, how can I prevent the 9-volt battery from slowly discharging when not needed, since it must stay connected; especially since in some cases, the USB power supplied might be as low as 4.6 volts?
Is there a better solution than using a mechanical relay?
I think the arduino has a power auctioneering setup that shouldn't allow the battery to drain when powered from the USB source. I'm not sure I would trust it. Have you been able to measure any current leakage from the 9v battery when the arduino is USB powered?
That's an interesting question you asked. I tried it with both an Arduino Uno, and a Funduino Uno.
The results are that the Funduino drew 46 ma on battery alone, and drops to 24 ma from the battery when the USB connection is added as a power source.
The Arduino, on the other hand, drew the same 46 ma on battery alone, but (unexplainably) jumpted to 53 ma from the battery when the USB power source was added.
What's more important to me, is the circuit on the breadboard I'm designing. On the bread board, the 5-volt regulator draws 4.5 ma with no load on it at all. And of course, if the USB was supplying a little less voltage to the circuits -- perhaps 4.7 volts -- the regulator would kick in, drawing power from the battery to boost the circuits up to a full 5 volts.
The Arduino, on the other hand, drew the same 46 ma on battery alone, but (unexplainably) jumpted to 53 ma from the battery when the USB power source was added.
I am guessing that when the battery and the USB source is connected power is drawn from the battery to the PC via the USB. This could be the case if the output voltage of the regulator shown above is higher than the voltage from the USB. What if you connect a diode in series with the usb to prevent reverse current flow?
Watcher:
I am guessing that when the battery and the USB source is connected power is drawn from the battery to the PC via the USB. This could be the case if the output voltage of the regulator shown above is higher than the voltage from the USB. What if you connect a diode in series with the usb to prevent reverse current flow?
There's still the quiescent current of the regulator to consider. With a 9V battery, (I'm assuming the type used in smoke detectors), even that current will drain a backup battery pretty quickly, and it won't last very long when connected to the circuit either.
The regulator needs to be completely isolated when 5V USB is available. I'd probably take the lazy option and use a relay operated by the USB supply to completely disconnect the battery from the regulator input. A reverse diode from output to input of the regulator is probably a good idea too. My 2c worth.
@CosmickGold, which 5V regulator are you using, by the way?
There's still the quiescent current of the regulator to consider.
True. However the regulator was connected right from the beginning both with and without the USB connection. and, according to the original post, the current was increased when the USB was connected. So i dont think this has anything to do with the quiescent current of the regulator.
Watcher:
True. However the regulator was connected right from the beginning both with and without the USB connection. and, according to the original post, the current was increased when the USB was connected. So i dont think this has anything to do with the quiescent current of the regulator.
No, quite right. I just meant that besides what you were saying, there was the quiescent current to consider. I didn't mean to imply that it was related to the problem. I agree with what you said.
I probably didn't word my reply well enough.
When someone here says "a 9 V battery", they usually mean this:
There are two things wrong with that.
One is that it has very little actual capacity (even Duracell) and even under the best of circumstances (circuit), will not run an Arduino for long.
But the best of circumstances is not to run it through a linear regulator and lose 4/9 of its capacity.
If you run the circuit you picture, then it is a toss-up as to whether the USB supply or the regulator will provide the higher voltage and most commonly, the USB will be the lower, so your regulator will be the one powering the circuit, from the battery.
You could use a relay on the USB supply to disable the battery (before the regulator, as the regulator draws current even if it is not supplying any), but you would need the relay (or a diode) to also disconnect the USB supply when you dropped to battery power so the battery would not be back-powering the USB circuit (your diagram indicates you are using a Pro Mini with a separate USB-TTL converter - that too points out a problem as the USB-TTL converter may draw power from the Tx line when it is powered down) and you might lose power in the switch-over process.
What you really want to do is to use a 4.5 V backup - three alkaline AA cells - with Schottky diodes from this and from the USB-TTL converter to your Arduino, so the battery only supplies power when the USB source drops to under 4.5 V. This means the circuit will be running from as little as 4 V, but in most cases and for most purposes this will be OK. Or perhaps you should explain the purpose too.
Paul__B:
....use a 4.5 V backup - three alkaline AA cells - with Schottky diodes from this and from the USB-TTL converter to your Arduino, so the battery only supplies power when the USB source drops to under 4.5 V....
ALL the problems commented on above seem correct to me. But this will solve every one of them.
I have ordered some Schottky diodes through eBay (10 of them for only 99 cents). But these diodes won't arrive for several days, and I won't try testing the circuit until I have them.
The real question is, how well does the circuit work at only 4 volts? And also, what is the actual drop across each diode? They likely won't drop exactly 1/2 volt, hopefully less, but could be more.
Also, what you are building won't be the same as what I'm building, so 4 volts might work for one of us but not the other. You'll have to test your own circuit to find out.
Below is the circuit diagram you asked for. It's the circuit I'm planning to use for this. Lets keep our fingers crossed.
I have ordered some Schottky diodes through eBay (10 of them for only 99 cents). But these diodes won't arrive for several days, and I won't try testing the circuit until I have them.
The real question is, how well does the circuit work at only 4 volts? And also, what is the actual drop across each diode? They likely won't drop exactly 1/2 volt, hopefully less, but could be more.
Also, what you are building won't be the same as what I'm building, so 4 volts might work for one of us but not the other. You'll have to test your own circuit to find out.
Below is the circuit diagram you asked for. It's the circuit I'm planning to use for this. Lets keep our fingers crossed.
In your diagram, is the "Circuit Board" a 3.3V Arduino?
mrsummitville:
In your diagram, is the "Circuit Board" a 3.3V Arduino?
Mine is a 5.0-volt Arduino, but you can connect as much as 12 volts to the pin labeled "raw" on your 3.3-volt Arduino. The onboard regulator will then reduce the voltage to 3.3 volts, which you can access at the pin labeled VCC.
(UPDATE: Before you use the VCC pin, please read the next comment (on page 2) from CrossRoads about doing so safely.)
Some 3.3-volt components for your Arduino have data inputs that are "5-volt tolerant", while others would be damaged by 5 volts.
For example, most SD Card holders can handle either 3.3 volts or 5.0 volts. On the other hand, my 3.3-volt two-way radio, states in the instructions that powering it with more than 3.6 volts will cause permanent damage!
Since you are evidently powering a 3.3 volt project, why not power everything through a 3.3-volt regulator? That would work better than my situation where my 5.0 volt components will see only 4.0 volts at times. You could use the above backup-power circuit and be giving your project the expected 3.3 volts all the time.
The addition of the 3.3 volt regulator to the above circuit would look like this:
If drawing more than 100 milliamps, your project would need a bigger regulator.
The MIC5205 fixed regulator on the promini http://www.micrel.com/_PDF/mic5205.pdf
will only work with a 12V input if the current draw is very low.
If you attempt to use anything close to the 150mA output it is capable of, then Vraw needs to be much lower, like 5-6V.