I am working on a device that will use outlet power when plugged in; however, if unplugged in, it will switch to a 9V power.
I have considered having the AC/DC converter connect to a separate coaxial socket which will be connected to both a coaxial plug (which is connected to the Arduino) and a logic gate. The logic gate (preferred XOR but NAND might work) will have, for inputs, the 9V and the outlet circuit, and its output will lead to the Vin pin. The idea would be that , if the device is not plugged in, the gate will allow the battery to power the Arduino, but if both power sources are present then the battery will not be drained.
I would like to know if this will be an effective system before I start buying components.
I'm assuming your AC/DC converter output is greater than 9 volts (it must be higher than your standby 9V battery for this solution) and you would normally connect it to the Arduino 'Raw' input jack.
All you would then need is two 1 amp or greater rectifiers, with the anodes connected to the two power sources and the cathodes tied together, going to the (coaxial) Raw voltage input jack.The higher of the two voltages will then power your Arduino.
I would never tie any power source to the Vin pin.
pegwatcher, I apologize in advance for not being very informed in the principles of circuitry, but I do not understand how your configuration works. I don't see how it will only allow the larger voltage source through. Also, do both power sources share a ground in this configuration?
I still thank your for your contribution.
Also, I have not yet purchased the AC/DC converter, so I could use whichever one I want (if I can afford it).
V1 and V2 are your two voltage sources. One is the battery, the other your DC adapter. Doesn't matter which is which here, but for the sake of explanation, let's assume V1 is a battery and V2 is the DC adapter. Each is connected through a diode to a central junction point, which becomes the input to your circuit. The diode's anode is the side closest to the V input, and cathode is the side toward the junction.
Each diode will only conduct if its anode is higher (typically 0.7v higher) than its cathode. If V2 is unplugged, the junction point will be 0v, so as long as V1 is higher than about 1v, D1 will conduct. This applies (V1 - 0.7v) to the output. Let's say there's a 6v battery on V1. The junction will be (V1 - 0.7v) so 5.3v.
Now, if you plug in the DC adapter and V2 becomes live, D2 will start to conduct IF V2 is 0.7v higher than the junction point. If the DC adapter is putting out 9v, D2's anode will be higher than its cathode (that is, D2 will be "forward biased") and it will start to conduct. At this point, the junction will now be at 8.3v, so D1 will no longer be forward biased (it will be "reverse biased") and it will stop conducting.
In the case that V1 and V2 are exactly the same voltage, both will contribute to the output. This is not harmful, since the two voltage sources will be unable to charge each other -- that would require one or both diodes to be reverse biased, which won't happen unless one or both have failed short.
Finally, yes, you would tie the grounds together between V1, V2, and your load device.
I apologize in advance for not being very informed in the principles of circuitry, but I do not understand how your configuration works. I don't see how it will only allow the larger voltage source through.
Short answer... [u]Diodes[/u](rectifiers) allow current flow in only one direction.
As long as you hook 'em up so that current flows out of the power supply, and not back in, everything will work fine. There is about a 0.5 to 0.7V forward voltage drop across a regular silicon diode, but with power supplies in the 9V range you'll be fine.
Current* flows from positive to negative, or from higher to lower. So without the diodes, current from the higher voltage would flow into the lower-voltage supply. The diodes will prevent that. (That's actually how you charge a battery, but you have to control/limit the current.)
This is what's called "conventional current", and it's the way engineers and technicians "talk about" and "think about" current. The electrons actually flow the other way, and in your science/physics class, you will learn about electron flow from negative to positive.