Author Topic: Switch between power sources automatically  (Read 5592 times)

0 Members and 1 Guest are viewing this topic.

Offline OM222OTopic starter

  • Frequent Contributor
  • **
  • Posts: 768
  • Country: gb
Switch between power sources automatically
« on: April 20, 2019, 02:12:08 pm »
Hello
I have a project that runs on a battery and a 12v jack. I can detect the voltage at 12v line and switch to it when I detect a voltage. there is also a capacitor that allows the MCU to operate and switch back to the battery when the 12v line is disconnected. my only issue is coming up with a way of actually doing that ... I initially tried using mosfets but then the 12v line back feeds the battery via the body diode of the fet which is no good ... a mechanical solution such as a relay is also no acceptable. I also can't really use diodes as the device can pull up to 5 amps and that's simply way too much of wasted energy and heat do deal with. are there any easy solutions that come to mind for switching between the two sources? thanks!
 

Offline KC0PPH

  • Supporter
  • ****
  • Posts: 117
  • Country: us
Re: Switch between power sources automatically
« Reply #1 on: April 20, 2019, 02:49:52 pm »
Use a Diode if current is not too much.

12V Supply goes directly to your circuit
12V Battery goes through a diode.

If you want protection against backfeeding your 12V supply use 1 diode in series with your 12V supply and 2 in series with your battery.

Quick and dirty and works like a charm.
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 15360
  • Country: fr
Re: Switch between power sources automatically
« Reply #2 on: April 20, 2019, 03:27:33 pm »
One way of avoiding to be bothered with the body diode is to put two MOSFETS back-to-back.
 

Offline OM222OTopic starter

  • Frequent Contributor
  • **
  • Posts: 768
  • Country: gb
Re: Switch between power sources automatically
« Reply #3 on: April 20, 2019, 03:47:03 pm »
I'm sorry if this sounds stupid but I'm not sure how back to back fets would work. Can you please provide a schematic?
 

Offline madires

  • Super Contributor
  • ***
  • Posts: 8164
  • Country: de
  • A qualified hobbyist ;)
Re: Switch between power sources automatically
« Reply #4 on: April 20, 2019, 03:53:33 pm »
Search for "ideal diode" or "power oring". For example LTC4359 which I'm using for one of my projects.
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 15360
  • Country: fr
Re: Switch between power sources automatically
« Reply #5 on: April 20, 2019, 04:11:56 pm »
I'm sorry if this sounds stupid but I'm not sure how back to back fets would work. Can you please provide a schematic?

You can find the principle here: http://www.ti.com/lit/an/slva948/slva948.pdf
(don't mind the eFuse devices, the first pages explain the concept.)

There are also integrated OR'ing controllers so you might want to look that up as well.
 

Offline OM222OTopic starter

  • Frequent Contributor
  • **
  • Posts: 768
  • Country: gb
Re: Switch between power sources automatically
« Reply #6 on: April 20, 2019, 06:36:39 pm »
I think the fet approach is cheaper although it might take a bit larger space on the pcb. Thanks for all the replies!
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19962
  • Country: gb
  • 0999
Re: Switch between power sources automatically
« Reply #7 on: April 20, 2019, 09:49:10 pm »
If you just connect two Pchannel MOSFETs up, back-to-back, with the sources tied to 0V, they'll act as low value resistors. Some active circuitry is required to direct which MOSFET and therefore which power supply is active. An ideal diode controller does this by monitoring the voltage across the MOSFET and turning it off, if it senses the current is reversing.

If the voltage drop is acceptable, then the cheapest option is zener diodes.
 

Offline OM222OTopic starter

  • Frequent Contributor
  • **
  • Posts: 768
  • Country: gb
Re: Switch between power sources automatically
« Reply #8 on: April 20, 2019, 10:29:57 pm »
I understand how the power oring chips works but even the cheapest one on mouser (MAX40200) costs about 0.70$ ... I can get 2 dual fets (any fet is easily rated for 5A) for almost half of that, but those chips are also a viable option. thanks!
 

Offline KL27x

  • Super Contributor
  • ***
  • Posts: 4108
  • Country: us
Re: Switch between power sources automatically
« Reply #9 on: April 21, 2019, 12:02:13 am »
Quote
with the sources tied to 0V
??

Quote
If the voltage drop is acceptable, then the cheapest option is zener diodes.


I'm now extra super confused.
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19962
  • Country: gb
  • 0999
Re: Switch between power sources automatically
« Reply #10 on: April 21, 2019, 06:56:11 am »
Perhaps I'm confused? No schematics have been posted of what the original poster meant by two MOSFETs.

I understand how the power oring chips works but even the cheapest one on mouser (MAX40200) costs about 0.70$ ... I can get 2 dual fets (any fet is easily rated for 5A) for almost half of that, but those chips are also a viable option. thanks!
How would you intend to solve this, without one of those ICs?

Because the MOSFETs conduct in both directions, the voltage on one input can back-feed to the other input, which isn't connected. The direction of the current needs to be sensed, in order to decide which MOSFET is activated, and is what these ideal diode controllers do. It's possible to do it with and op-amp, but is far easier to just use a dedicated IC.
 

Offline madires

  • Super Contributor
  • ***
  • Posts: 8164
  • Country: de
  • A qualified hobbyist ;)
Re: Switch between power sources automatically
« Reply #11 on: April 21, 2019, 11:14:07 am »
I understand how the power oring chips works but even the cheapest one on mouser (MAX40200) costs about 0.70$ ... I can get 2 dual fets (any fet is easily rated for 5A) for almost half of that, but those chips are also a viable option. thanks!

It's either an ORing controller plus MOSFET or a Schottky diode with larger power loss (less battery runtime). Choose one! ;)
 

Offline OM222OTopic starter

  • Frequent Contributor
  • **
  • Posts: 768
  • Country: gb
Re: Switch between power sources automatically
« Reply #12 on: April 21, 2019, 02:03:50 pm »
as per the application note by TI, if you connect two P channel fets with common source config (or N channels with common drain) there will be 2 body diodes in opposite directions, effectively blocking the back feed. their gates are also connected so they turn on / off together. dual fets with common drain / source configs are pretty cheap on mouser.
 

Offline SeanB

  • Super Contributor
  • ***
  • Posts: 16363
  • Country: za
Re: Switch between power sources automatically
« Reply #13 on: April 21, 2019, 02:27:58 pm »
Dual 12A Schottky rectifier in a TO220 package, with power from battery on one leg and 12V on the other. 0.4V drop, and low enough leakage at room temperature to not worry, plus with 5A only a small TO220 PCB mount heatsink needed. 2W of power worst case, and the highest voltage source supplies the load, no dropout when changing. Common item, used in every PC power supply, and available from multiple vendors.
 

Offline OM222OTopic starter

  • Frequent Contributor
  • **
  • Posts: 768
  • Country: gb
Re: Switch between power sources automatically
« Reply #14 on: April 21, 2019, 02:40:47 pm »
as I mentioned, I don't want to deal with diodes because of huge wastes of power and voltage drop (especially from battery) as I said the cheapest option seems to be the dual fet approach.
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19962
  • Country: gb
  • 0999
Re: Switch between power sources automatically
« Reply #15 on: April 23, 2019, 10:43:49 am »
as per the application note by TI, if you connect two P channel fets with common source config (or N channels with common drain) there will be 2 body diodes in opposite directions, effectively blocking the back feed. their gates are also connected so they turn on / off together. dual fets with common drain / source configs are pretty cheap on mouser.
Yes, I did read the application note. The question is how do you intend to control the gates?

What determines which MOSFET is on and which one is off?

Imagine the capacitor and 12V supply are connected to the 12V input via switches and the 12V supply is removed. How are you going to detect the fact that the 12V supply has been disconnected? You can't simply monitor the 12V supply, because the charge on the capacitor will back-feed into it.

That's what the ideal diode IC does. It monitors the current direction through the MOSFET and turns if off if the current starts to reverse. Some ideal diode controller ICs have the benefit of an internal charge pump, so a single N-channel MOSFET per channel can be used.
 

Offline OM222OTopic starter

  • Frequent Contributor
  • **
  • Posts: 768
  • Country: gb
Re: Switch between power sources automatically
« Reply #16 on: April 23, 2019, 04:51:32 pm »
I monitor the 12v rail itself using a resistor divider and the analog comparator provided by the MCU (D6 of arduino). the mosfet is placed after that which is the same for the battery rail. that way when the 12v supply is connected, it triggers an ISR to first turn off the fets on the battery, and then turn on the 12v rail fets (which happens in a few mS) same situation for when the 12v line is disconnected. the ISR will turn those fets off and turn the ones on the battery on. If there is enough capacitance on the 5V rail of the MCU to keep it going for lets say at least 100mS, then during the short gap between disconnecting and connecting the fets nothing bad happens, just a small Vdroop on the 5v rail as the cap discharges. This actually should work surprisingly well
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19962
  • Country: gb
  • 0999
Re: Switch between power sources automatically
« Reply #17 on: April 23, 2019, 07:28:40 pm »
I monitor the 12v rail itself using a resistor divider and the analog comparator provided by the MCU (D6 of arduino). the mosfet is placed after that which is the same for the battery rail. that way when the 12v supply is connected, it triggers an ISR to first turn off the fets on the battery, and then turn on the 12v rail fets (which happens in a few mS) same situation for when the 12v line is disconnected. the ISR will turn those fets off and turn the ones on the battery on. If there is enough capacitance on the 5V rail of the MCU to keep it going for lets say at least 100mS, then during the short gap between disconnecting and connecting the fets nothing bad happens, just a small Vdroop on the 5v rail as the cap discharges. This actually should work surprisingly well
It's difficult to visualise without a schematic.

Are you trying to do something like this?

How do you decide which MOSFETs to activate?

What happens if the battery has a slightly higher voltage, than the supply voltage or can't that happen? If it can, then there's the issue of the battery back-feeding into the supply. Remember once on, the MOSFETs conduct in both directions. They don't act like diodes, but switch contacts. Even if the battery can't be a higher voltage, then the supply, there's still the issue of knowing which MOSFETs to turn on.
« Last Edit: April 23, 2019, 07:33:53 pm by Zero999 »
 

Offline OM222OTopic starter

  • Frequent Contributor
  • **
  • Posts: 768
  • Country: gb
Re: Switch between power sources automatically
« Reply #18 on: April 23, 2019, 08:27:27 pm »
Yes, that schematic is exactly correct, except the BAT_MON section. it's not needed as we can assume battery is always connected (it also charges from the PSU with a buck converter when PSU is connected, similar to a how a laptop works). and yes, battery is always lower voltage than PSU (2S lipo, so maximum of 8.4V). As I mentioned the battery fets are on as default. as soon as the voltage on PSU_MON is detected (it still can't feed anywhere, mosfets are disconnected). the MCU switches off the BAT_CNTRL fets and a few mS later, it turns on the PSU_CNTRL fets. using this "break before make" (if you will) approach we can ensure nothing ever back feeds as the two sources are never on at the same time! as I explained, I just need enough capacitance on the whole circuit (not only in parallel with Rload as you drew it) to allow the MCU to stay on while making this switch over where there is no power from either the battery or the PSU.
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19962
  • Country: gb
  • 0999
Re: Switch between power sources automatically
« Reply #19 on: April 23, 2019, 09:08:39 pm »
Yes, that schematic is exactly correct, except the BAT_MON section. it's not needed as we can assume battery is always connected (it also charges from the PSU with a buck converter when PSU is connected, similar to a how a laptop works). and yes, battery is always lower voltage than PSU (2S lipo, so maximum of 8.4V). As I mentioned the battery fets are on as default. as soon as the voltage on PSU_MON is detected (it still can't feed anywhere, mosfets are disconnected). the MCU switches off the BAT_CNTRL fets and a few mS later, it turns on the PSU_CNTRL fets. using this "break before make" (if you will) approach we can ensure nothing ever back feeds as the two sources are never on at the same time! as I explained, I just need enough capacitance on the whole circuit (not only in parallel with Rload as you drew it) to allow the MCU to stay on while making this switch over where there is no power from either the battery or the PSU.
That makes sense, I think.

In future please post a schematic. It will save yourself and us a lot of time. Even a rough sketch is far better than a verbal description.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf