How do I create a switched power supply for a 12v circuit?

Thread Starter

deaston

Joined Dec 22, 2020
6
I have a unit that is powered by a 12v battery, but I can also power it with a 12v mains unit. To switch between them I have to physically unplug one from the unit and plug in the other.

But I'm wondering about having both the battery and mains adaptor permanently connected and installing a switch in order to switch between them. Is it a SPDT switch I need? Only I can't find one suitable.

I'd have six cables: +/- of the battery and +/- of the adaptor being switched to feed the +/- of the unit.
 

Thread Starter

deaston

Joined Dec 22, 2020
6
The SPDT switches have three terminals - I have a total of six cables to connect.

Not sure of the amperage, but it'll be very small.
 

wayneh

Joined Sep 9, 2010
17,152
The SPDT switches have three terminals - I have a total of six cables to connect.

Not sure of the amperage, but it'll be very small.
The switch needs only to switch the load power (or ground) between the two sources. The sources can share ground (or +12) and that does not need to be switched. SPDT is fine.
 

wayneh

Joined Sep 9, 2010
17,152
And just to elaborate a little, there is such a thing as a charge controller that would automate this. A solar powered device is a good example. When solar is available, the load is driven by that and any extra goes to charge the battery. In the dark, the load is powered by the battery. Your 12V supply is like the solar panel in this example.
 

LowQCab

Joined Nov 6, 2012
551
If your Loads can tolerate loosing ~0.7 Volts of power input, just use 2 Diodes, super easy.
If you want to get fancy, what you are looking for is called an "ORing-Controller", (as in , either-OR).
.
.
 
Depending on the values we're talking about, a DPDT relay would suffice. A relay would provide the benefit of full automation with regards to source selection rather than performing the operation manually with a switch.
 

Thread Starter

deaston

Joined Dec 22, 2020
6
If your Loads can tolerate loosing ~0.7 Volts of power input, just use 2 Diodes, super easy.
If you want to get fancy, what you are looking for is called an "ORing-Controller", (as in , either-OR).
.
.
I considered diodes, but was worried about the chances that both 12v power and 12v battery could be connected accidentally. I figured an SPDT would ensure it was only ever one or the other.
 

LowQCab

Joined Nov 6, 2012
551
There is ZERO chance of a Diode flowing in reverse.
Actually that's not true, the reverse voltage rating on a Diode is where it will flow in reverse,
usually over ~100 Volts, and some are over ~1000 Volts.
.
.
 

Thread Starter

deaston

Joined Dec 22, 2020
6
There is ZERO chance of a Diode flowing in reverse.
Actually that's not true, the reverse voltage rating on a Diode is where it will flow in reverse,
usually over ~100 Volts, and some are over ~1000 Volts.
.
.
I must be confused. Two power sources feeding into the same circuit with a diode inbetween each power source to prevent reverse flow.

But that wouldn't prevent both power sources being connected simulatneously and overloading the load circuit. If the unit is happily working from the battery and then I switch on the mains power, nothing is then stopping the battery supply.
 

LesJones

Joined Jan 8, 2017
3,179
This is a case of using a simplified explanation first so the person being taught understands the concept. So explaining diodes you would first be taught that a diode allows current to pass only in one direction. When that was understood the forward volts drop though a diode would be taught. The point being made in post #9 is that a real diode can not tolerate a reverse voltage above a certain level. With the silicon diodes that you are likely to use this will not be a problem as the most reverse voltage you will apply to them is 12 volts. The lowest reverse voltage rating I have seen for normal silicon power diodes is 50 volts. For diodes in general the reverse voltage rating can be lower. For example LEDs (Light emitting diodes.) typically have a reverse breakdown voltage rating of about 5 volts. There are many types of diode so there would be a lot to teach to cover all types of diodes and their characteristics. You do not need to have such an extensive understanding for what you are doing.

Les.
 

Thread Starter

deaston

Joined Dec 22, 2020
6
Thanks Les - I do understand how a diode works, but don't see how the use of diodes would prevent overloading the load circuit.

With two potential power supplies, how would the use of diodes prevent both supplies supplying the circuit at the same time? I can see that it would preven the mains power supply feeding into the battery supply, but not how they would prevent both the mains supply and battery supply supplying simultaneously.
 

bertus

Joined Apr 5, 2008
21,364
Hello,

When using diodes to separate the power supplies, the highest voltage will supply the device.
The lower voltage will be "isolated" by the diode. Only the reverse leakage of the diode will be there, wich is likely in the microamp range.

bertus
 

Thread Starter

deaston

Joined Dec 22, 2020
6
This is clearly going way beyond my knowledge! Thanks for all the help, but I think the safest way is for me to install a switch therefore simply mimicking me unplugging one power source and plugging in the other.
 

LowQCab

Joined Nov 6, 2012
551
To clarify your confusion .........
Which ever Voltage Source has the Highest Voltage will be powering your Load.
So, if the Battery has a Voltage of, lets say, 12.2 Volts,
And the Mains-Powered Power-Supply puts out 12.5 Volts,
Then the Load will get ALL of its Power from the Mains Power Supply.
If the Mains Power goes down for some reason,
the Voltage to the Load will only experience a drop of 0.3 Volts,
and will continue to work like nothing happened.

As long as the Mains-Powered Power-Supply will put out just slightly more voltage than the Battery,
then the Battery will not be drained.
( Note that there is nothing being discussed here about possibly CHARGING the Battery )
( maybe the Batteries are just plain old Non-Rechargeable Alkaline-Cells,
but for this discussion, the TYPE of Batteries is irrelevant,
only the Battery VOLTAGE, RELATIVE TO, the Mains-Powered Power-Supply VOLTAGE, means anything )

As for "Overloading" the Load being Powered by having 2 Power Sources connected ..........
You can have 10 or even 50 power sources all connected to the same Load, though Diodes,
and as long as none of them have an Output Voltage that is substantially higher than the others
it won't make any difference to the Load.
The Source with the highest Voltage is the one that will be providing Power to the Load.
The Source with the lowest Voltage will be supplying ZERO Power to the Load.
The Load only cares about having enough Voltage to operate correctly.
As long as the Voltage going to the Load is close to the Loads rated Voltage,
the Load will be a happy-camper, and Bob's-Your-Uncle .

If the Load has a built-in "Voltage Regulator",
the Load may operate just fine with a wide variety of Voltages, that are
higher or lower than its "nominal" Voltage Rating.
( for instance, everything in a Car is labeled "12 Volts", that's the "Nominal Voltage",
the ACTUAL Voltage will routinely go from ~8 Volts to ~15 Volts ).

Now, this is not strictly or absolutely an exact fact in every single situation, and with every type of Diode,
but for a very basic discussion on how Diodes work, in general,
you can consider this concept to be engraved in stone.
.
.
 

Woz_a

Joined Nov 21, 2018
1
Thanks Les - I do understand how a diode works, but don't see how the use of diodes would prevent overloading the load circuit.

With two potential power supplies, how would the use of diodes prevent both supplies supplying the circuit at the same time? I can see that it would preven the mains power supply feeding into the battery supply, but not how they would prevent both the mains supply and battery supply supplying simultaneously.

Apologies if this is a bit over simplified, which in some respects it is, but to address your concerns about overloading the circuit with two power supplies connected at the same time.

The amount of current you can push through your circuit is determined by the total resistance of the circuit and the electrical pressure (Voltage) applied.

So, you connect your circuit to a 12V battery and lets say 100mA of current flow through the circuit and all is well.

Now if you connect a second 12V batter IN PARALLEL with the first battery i.e. +ve to +ve and -ve to -ve,
you are still only applying 12V of pressure. Yes you now have two batteries worth of Amps but the resistance of the circuit has not changed so it will still only let 100mA through, the difference being that you now have two batteries worth of amps to use before you run out of power instead of just one, so the circuit will run for twice as long.

If you now replace one of the batteries with a 12V mains power supply you are still only applying 12V of pressure so the circuit will be quite happy and only allow 100mA to flow.

The problem is going to occur when one source (battery or psu) has a lower voltage than the other, The higher voltage supply will start pushing current (amps) back into the other supply, your circuit will still only allow 100mA to flow through it and will still work quite happily.
The reverse powered supply though may not be so happy so this is where the Diodes come in to block the reverse supply or the switch to physically disconnect it.
 

PhilTilson

Joined Nov 29, 2009
96
You will find that the very knowledgeable and well-intentioned people on this forum sometimes end up making an answer a lot more complicated than it need be! What they are saying is (usually) quite correct but may go well beyond the needs of the original enquirer.

Refer to the diagram below. Let's assume that your PSU is switched off. Therefore V1 will be 0 Volts. V2 will be (say) 12 Volts. Thus current will flow from the battery, through the second diode, through the load and back to the battery. It can't flow through the first diode as this will have a higher voltage on the negative end than the positive (it is "reverse biased").

Now let's switch on the PSU, and let's also assume that its output is, say, 13 Volts (wall warts often have an output voltage higher than their stated value). Now current will flow through the first diode, through the load and back to the PSU. With an ideal diode (see later) the voltage at the load would be 13 Volts. But the battery voltage is only 12 Volts. Thus the second diode is reverse-biased and current cannot flow, so the battery is protected.

If the PSU voltage were to fall to, say, 11 Volts, then the voltage at the load would be the 12 Volts from the battery and the first diode would be reverse-biased, so no current could flow back from the battery into the PSU.

I mentioned "ideal diodes" earlier. There is always a small voltage drop across a diode so, for example, the 13 Volts from the PSU would appear as (typically) 12.3 Volts at the load, or the battery 12 Volts would appear as 11.3 Volts, but the mechanism is exactly the same.

Cct1.jpg

There is no danger of "overloading" the load. If the output from the battery and the PSU happened to be exactly the same, then the current would be shared between the two, with both diodes conducting!
 

AnalogKid

Joined Aug 1, 2013
9,256
If the power supply unit has an adjustable output, you can use that feature to your advantage. If you adjust the power supply output voltage to be slightly above the highest possible battery voltage, then the circuit will use the power supply whenever it is available, leaving the battery sitting there as a backup power source. For example, if the battery max output is 12 V, you can adjust the power supply output to 12.5 V. Over time this can significantly increase the battery life.

The tradeoff is that you do not have total control over the circuit. If you want to demand that the circuit use either particular power source when both are connected, then you are back to a electromechanical switch or an electronic switch circuit.

ak
 

crutschow

Joined Mar 14, 2008
27,218
I do understand how a diode works, but don't see how the use of diodes would prevent overloading the load circuit.
If it's not clear it's because the "load" only takes the current it needs.
It makes no difference how many supplies are connected to the load by diodes as long as their voltages are close to the same.
 
Top