A diode is a semiconductor component which allows the current flowing only to one direction:
- when drawn as a symbol, the arrow indicates the direction
- when a real component, there's a striped which indicates the outgoing lead.
However, when the current is flowing there's a small voltage drop across the leads, roughly 0.6V (it's an exponential formula, though).
About what you want to do, consider the internal point where the power is needed: this point is Vin.
Suppose to feed the power through the barrel. Let's say exactly 10V, but there's a diode on the board (D_board), so the Vreg is expected to 10-0.6 = 9.4V. Everything's working fine.
There's a 9V battery connected with a diode (D_bat) to the same Vin point. Now, the voltage on the positive lead is 9V MINUS the voltage on the Vin is 9.4V, yields -0.4V which is lesser than the minimum required for the D_bat to allow the current flowing. That is, under these conditions the battery can't feed any energy, and all the power is given by the barrel.
Now detach the power barrel.
The voltage on the Vin pin WOULD drop to zero, but AS SOON the point falls below 9-0.6=8.4V, the D_bat begins to allow the current flowing. The battery now is the only one feeding energy.
Why 9-0.6=8.4? Because 9V is the battery voltage (on the positive lead) and 0.6V is the drop of the D_bat diode.
NOTE: I used 10V as the barrel voltage to emphasize the circuit's behavior. However, 10V is not a standard voltage for an adapter. If you have a common 9V adapter, you'll experience kinda "challenge" between the adapter and the battery: the one having the highest voltage will actually feed the board. Bear in mind that a new battery has typically a voltage slightly higher than the nominal, but decreases also easily.
I suggest to make some experiment, but if you want to be super-guaranteed there's no "challenges" anytime, just use TWO diodes in series for the battery. At this point the drop is 0.6+0.6=1.2 and the barrel should "win" all the times!
Go to the full post