How to automatically use an external power source?

Hey everyone, this is something that I should know by now, but I never really did bother to learn about transistor circuits, so I figure someone has a schematic laying around that can help.

Basically, I want to add a DC power jack to something that runs on batteries, what is a simple way I can get it to switch automatically to the external power source when there is voltage?

The easiest and common way is to use two diodes wired as a OR circuit with their cathodes wired together and then on to the load. One diode anode wires to the positive of the battery and the other diode's anode wires to the external positive terminal, and wire the grounds together. Set the external DC voltage input slightly higher then the batteries highest voltage. That way the current will be provided by the external power until and if it goes away, which then the battery automatically takes over.

Lefty

retrolefty:
The easiest and common way is to use two diodes wired as a OR circuit with their cathodes wired together and then on to the load. One diode anode wires to the positive of the battery and the other diode's anode wires to the external positive terminal, and wire the grounds together. Set the external DC voltage input slightly higher then the batteries highest voltage. That way the current will be provided by the external power until and if it goes away, which then the battery automatically takes over.

Lefty

Ah, ok that sounds good, I'll give it a try later. It's good too because I have lots of spare diodes, not sure what I have for transistors.

Or you could use a switched DC power jack.

BillO:
Or you could use a switched DC power jack.

It would stick out more than I would like on this thing

One like the power jack on the Arduino? Well, they don't stick much, but if you need it really sleek, then...diodes might be the way to go. Simple enough, but make sure you can afford the voltage drop.

BillO:
One like the power jack on the Arduino? Well, they don't stick much, but if you need it really sleek, then...diodes might be the way to go. Simple enough, but make sure you can afford the voltage drop.

I can. I'm planning on adding this to my portal gun replica if I can ball up to cut the white case open, I need to figure out a good way to get in there are cut it smoothly so I can super glue it back, so I want there to be as little showing as possible.