Author Topic: Voltage supply automatic switching  (Read 4066 times)

0 Members and 1 Guest are viewing this topic.

Offline gregallenwarnerTopic starter

  • Regular Contributor
  • *
  • Posts: 144
  • Country: us
Voltage supply automatic switching
« on: January 14, 2015, 12:04:48 am »
I have a question regarding circuits for automatically switching which voltage supply to use. I've got a circuit that I want to power from either a barrel connector or a USB connector. When the USB alone is connected, it should power itself from the 5v USB bus. When the barrel connector is connected, it should power itself from that, regardless of whether the USB is connected or not. This is similar to the way the Arduino Uno is designed.

I'm using a P-channel MOSFET to turn off the USB supply when the barrel connector is powered. I've attached two schematics below. (Some details are omitted, such as bypass caps on all the voltage regulators and such. Just ignore these peripheral issues. I've also added some basic over current/reverse voltage/ESD protective measures, which are not really relevant to my question.)

In the first schematic, it's designed a bit like the Arduino Uno circuit, with a 5 volt regulator to first step down the voltage to 5 volts, to power the op amp comparator, and then an LDO 3.3 volt regulator to power the load and to supply the negative input to the comparator. In my particular application, the input at the barrel connector will always be 9 volts; this cannot be changed.

In the 2nd schematic, I've omitted the 5 volt regulator, because absolutely nothing in my circuit is powered by 5 volts. So I'd like to eliminate this part if possible. However, that brings me to my question. What's the effect of omitting this regulator on the op amp?

Imagine the circuit is powered by the USB bus, so Vcc going to the op amp is at 5 volts. Then you plug in the barrel connector and Vcc all of a sudden jumps to 9 volts. I've tested this in a simulator, and the circuit works in principle; it cuts off the MOSFET going to the USB supply. But is there anything taboo about having the op amp's Vcc all of a sudden change like this? Should I have done it differently?

Thanks.
 

Offline Paul Price

  • Super Contributor
  • ***
  • Posts: 1419
Re: Voltage supply automatic switching
« Reply #1 on: January 14, 2015, 12:46:39 am »
First of all, you have both of the P-Chan MOSFETS connected backwards in both schematics.

However, not a problem with op-amp power switching suddenly from +5 to +9V

If you reverse the P-Chan MOSFET connecting to the USB +5, so now it works correctly as a switch(instead as always on at present because of its internal diode),  then when 9V power is connected the 9V will connect through the internal diode of the P-Chan MOSFET and short the 9V to the 5V USB input, likely damaging the USB power circuit.

A small DPDT relay might be a better approach to start with to achieve a simple solution. The relay would be energized by the 9V supply and switch over power sources.  A small series resistor (1-ohm) would limit contact damaging surge current from the 9V supply into the filter caps in your circuit on the input of the 3.3V regulator and note that the filter caps, if large enough in uF, would also supply enough steady power during the millisecs of turn-on/off time of the relay.

« Last Edit: January 14, 2015, 01:06:06 am by Paul Price »
 

Offline gregallenwarnerTopic starter

  • Regular Contributor
  • *
  • Posts: 144
  • Country: us
Re: Voltage supply automatic switching
« Reply #2 on: January 14, 2015, 01:15:00 am »
I have always seen the P-channels hooked up this way in these sorts of circuits. The one on the left is for reverse voltage protection, so it needs to be backwards so the internal body diode will initially conduct to bootstrap it, and the one on the USB voltage rail is exactly the same as in the Arduino circuit. And also you mentioned if I turned it around, it would conduct 9 volts back to the USB rail, so I can't switch it anyway because of that.

Anyway, thanks for the feedback, but I'm pretty sure it is correct to hook up the P-channels like this (backwards) when building a power selection circuit.
 

Offline Paul Price

  • Super Contributor
  • ***
  • Posts: 1419
Re: Voltage supply automatic switching
« Reply #3 on: January 14, 2015, 01:30:06 am »
Ok, here is a much simpler circuit that works fine.

The diode can be any 1-amp or greater schottky diode or even a 1N400x would work.

Add another diode in series connecting the to the 9V supply to the cap if you want, but it is likely not at all needed.
« Last Edit: January 14, 2015, 02:36:20 am by Paul Price »
 

Offline gregallenwarnerTopic starter

  • Regular Contributor
  • *
  • Posts: 144
  • Country: us
Re: Voltage supply automatic switching
« Reply #4 on: January 14, 2015, 01:48:36 am »
The problem with that is the diode drops more voltage than a MOSFET, and therefore dissipates more power. That's the reason I've read for using MOSFET's in this application (as well as reverse polarity protection) because the MOSFET results in a more power efficient design. I'm going to be pulling several hundred milliamps in my design, so it may or may not even be an issue. I'll do some considering with your simplified design there.

Thanks.
 

Offline Paul Price

  • Super Contributor
  • ***
  • Posts: 1419
Re: Voltage supply automatic switching
« Reply #5 on: January 14, 2015, 01:57:02 am »
The power lost to heat by the drop of .1V to .2V (on-voltage) of the schottky diode would be really quite small!
A low reverse voltage schottky diode would be the ideal choice and would have the lowest voltage drop.

Your greatest power loss will not be from this diode sw circuit, it would be Vin-Vout drop power dissipation loss in the LDO regulator. With the 9V supply supplying power, there is no power loss due to my power switching circuit.

Power = I*Von of the diode.
« Last Edit: January 14, 2015, 02:35:16 am by Paul Price »
 

Offline gregallenwarnerTopic starter

  • Regular Contributor
  • *
  • Posts: 144
  • Country: us
Re: Voltage supply automatic switching
« Reply #6 on: January 14, 2015, 02:02:45 am »
It'll probably work for my application. It's simple enough. One question though: If it's this simple to build an automatic power selection circuit, why then is the comparator/MOSFET design I drew above still used so prevalently in devices like the Arduino Uno? Seems like a lot more cost for extra components.
 

Offline Paul Price

  • Super Contributor
  • ***
  • Posts: 1419
Re: Voltage supply automatic switching
« Reply #7 on: January 14, 2015, 02:06:01 am »
Even experienced engineers sometimes fail to realize a simple solution to a circuit design problem.
I can see no electronic design reason to justify the extra cost and complexity.

Perhaps they have a brother-in-law to help that is selling parts to populate the board, perhaps they might even get a kick-back related to an inflated BOM?
« Last Edit: January 14, 2015, 02:32:53 am by Paul Price »
 

Offline Dago

  • Frequent Contributor
  • **
  • Posts: 659
  • Country: fi
    • Electronics blog about whatever I happen to build!
Re: Voltage supply automatic switching
« Reply #8 on: January 14, 2015, 06:27:44 am »
There are chips specifically made for this, TI has a bunch such as http://www.ti.com/lit/ds/symlink/tps2115a.pdf

The advantage is that they include all sorts of protection features such as hysteresis (noise immunity) and softstart, current limit etc.
Come and check my projects at http://www.dgkelectronics.com ! I also tweet as https://twitter.com/DGKelectronics
 

Offline LukeW

  • Frequent Contributor
  • **
  • Posts: 686
Re: Voltage supply automatic switching
« Reply #9 on: January 14, 2015, 07:27:40 am »
It'll probably work for my application. It's simple enough. One question though: If it's this simple to build an automatic power selection circuit, why then is the comparator/MOSFET design I drew above still used so prevalently in devices like the Arduino Uno? Seems like a lot more cost for extra components.

Well if you're looking for high quality EE, it's probably not the best example.

The original Arduino circuit may have just been designed non-optimally, and 99% of all the other Arduino-like clone devices on the market simply copy it.
 

Offline gregallenwarnerTopic starter

  • Regular Contributor
  • *
  • Posts: 144
  • Country: us
Re: Voltage supply automatic switching
« Reply #10 on: January 14, 2015, 09:39:36 pm »
Ok, here's another circuit design that I just came up with. It selects between two power sources, and always chooses the higher of the two voltages. As long as the difference in the two voltages is greater than the threshold voltage of your transistors, this should work. Again, I've tested it in a simulator and it works, but haven't tried it in practice yet.

The benefit of this design is you get the greater power efficiency of the MOSFET over just a series diode, and both circuits are automatically protected against reverse polarity by virtue of the MOSFET arrangements, so your reverse voltage protection is automatically build in with this design. The only caveat is you gotta choose transistors with Vgs greater than both of your power rails. Since I'm only working with 9 volts, this is no big deal.

I like this design a little bit better, because it's simpler than the Arduino's over-engineered design with the op-amp comparator, and only uses 2 transistors and some resistors. Care to give feedback?

Thanks.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf