8
\$\begingroup\$

I'm software programmer taking the first steps into the electronics world.

I have a circuit that can be fed by a battery (9V) or by a external DC source (from the wall - I'm considering 12V). Ideally, the battery power should only be used when the external DC power is not available. Also, if the circuit is unplugged from the wall, the battery should assume immediately, because there's a microcontroller in the circuit and I suppose that a power drop would reset the microcontroller.

Both sources will pass though a regulator that'll lower the voltage to 5V.

I wonder if a circuit like the one below will do the trick. It seems really simple (maybe too simple) but it did work in the simulator. The resistor respresents the whole circuit, including the voltage regulator.

Power supply schematic

\$\endgroup\$
2
  • \$\begingroup\$ If it were my project, I would consider a circuit that allows the wall wart to charge your local battery too when plugged in. \$\endgroup\$
    – kenny
    Aug 3 '12 at 15:19
  • \$\begingroup\$ @kenny That sounds a great idea. I'm just a beginner, however, and don't really know how to do that. Do you have any links or tutorials that can help me do it? \$\endgroup\$ Aug 3 '12 at 16:22
8
\$\begingroup\$

This will work, if there is no capacitor in parallel with that load resistor. Usually, your linear regulator would have an input capacitor. When the 12v supply is plugged in, it will experience a sudden current surge as it tries to charge the capacitor up to 12v.

To keep this current surge to an acceptable level, simply add a 20 ohm resistor in series with the 12v diode. This will limit the current to no more than 150mA (exact amount depends on the voltage drop from the diode).

Next question: This resistor will drop some voltage across it due to the current flowing. I'm assuming your current draw is 90mA (9v / 100ohms). So the 20 ohm resistor will drop 1.8v (90mA * 20ohms). This shouldn't be a problem, and the voltage from the 12 supply will still override the 90 battery.

\$\endgroup\$
6
\$\begingroup\$

Yes, it will do fine. Since the wall powered supply voltage is higher than the battery's it will have the priority: applying both will bring the node to minimum 11 V, so the 9 V battery will never supply a voltage high enough to make its diode conduct.

If you're going to a linear 5 V regulator you would think you can afford the voltage drop of a common rectifier diode like a 1N4001: the power loss in the diode will otherwise be lost in the regulator. But at high current a 1N4001 may drop 1 V and then you're getting close to what a regulator like the LM7805 needs.

You can use Schottky diodes instead of the 1N4001, or an LDO instead of the LM7805, or use a switcher. The latter will give you an efficiency of about 90 %, while for a 12 V supply a linear regulator's efficiency will be only 41 %. If you use the switcher you better use Schottky diodes as well.

\$\endgroup\$
3
\$\begingroup\$

Yes, that should work.

However, since you are powering the circuit from a battery, you should consider using a switched regulator because it has a higher efficiency compared to linear ones.

\$\endgroup\$
3
  • \$\begingroup\$ Thank you for your answer. But please explain what does a lower efficiency means. Does it mean that the circuit will use battery power while the power from the wall is connected? \$\endgroup\$ Aug 3 '12 at 14:03
  • 1
    \$\begingroup\$ @AndréWagner No. A linear regulator typically adjusts the output voltage by dissipating the excess voltage in form of heat, a switched regulator makes a better management of power. That means that when you power the circuit from a battery, it will run for a longer time than if you had a linear regulator. \$\endgroup\$ Aug 3 '12 at 14:10
  • 1
    \$\begingroup\$ Keyword for searching: "Step-down converter" (as opposed to the "linear converter" you're using now). But don't mind yet: Once you got your circuit actually working you can still swap in another kind of voltage regulator if you like. \$\endgroup\$
    – JimmyB
    Aug 3 '12 at 14:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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