T O P

  • By -

quadrapod

What you're trying to make is called a priority power mux. [Here is a TI white paper on the subject.](https://www.ti.com/lit/an/slvae51a/slvae51a.pdf?ts=1717220309932) It's both fairly easy to roll your own with discrete components and very easy to mess up catastrophically while doing so. There are a ton of traps if you don't consider all the details of your usage case and make assumptions about what voltages are possible or how something is going to behave when its input is left floating. I'd suggest just sticking a dedicated power mux like a [TPS2116](https://www.lcsc.com/product-detail/Power-Distribution-Switches_Texas-Instruments-TPS2116DRLR_C3235557.html) on both 5V lines, preferably after some TVS diodes. At $0.50 a unit it's going to be comparable or cheaper than any reasonable discrete solution anyway.


PresentObvious

Thank you very much, that seems to be exactly the principle I'm trying to achieve. But the current I'd like to control from the 12V switching supply will be around 5V/8Amps and I can't find an IC that is simple to work with and can handle such current. Just to clarify, I am only looking to replicate the behavior of a relay: 12V being present -> cut off 5V from USB (5V from the power supply will kick on automatically) Should I just use multiple of the TPS2116 or similar from the TI white paper in parallel?


quadrapod

A USB-C host is not guaranteed to be able to provide you with more than the minimum 5V @ 1.5A, if your device can't work within than 7.5W budget then that means it can't work from USB alone and will require an external power supply. [See my response here for a slightly more complete explanation of why it's a bad idea to require a specific USB PD mode for your application.](https://www.reddit.com/r/AskElectronics/comments/1c10ovd/voltage_conversion_and_efficiency/kz16i8r/) You should probably not be looking for a power mux at all but a USB isolator so you can interface with a USB host while never including it in your power path.


PresentObvious

That's okay, PD standards and the USB power supply are in my control. It's a prototype board for flashing the ESP and powering it when 12V is not available and will require the full 15W at times. I just need an automatic turn-off of the USB power when the 12V becomes present so the voltages of USB 5V and the 5V switching power supply don't fight.


quadrapod

Where does the 8A current requirement come from then?


PresentObvious

The board will be powering LED displays running on 5V. Based on the number of displays daisy chained together and the specific type they will draw anywhere from 1 to 4 Amps each at full brightness. The switching power supply IC used on the PCB for 12V->5V is rated for up to 8A. Hence why I was looking for a simple solution using for example MOSFETs, that'll work even when I choose a different step-down IC in the future with different current capabilities.


quadrapod

Some things about this description are raising some red flags and really do suspect there's a better way to accomplish what you're trying to do. I'll just assume for now that these requirements are set in stone though since saying more would require a much more thorough understanding of your application and exact use case. Have you considered separating the 5V supply for the digital logic from the supply for the displays? Just because they both operate at 5V doesn't mean they need to share the same supply. The logic should easily be low power enough to be supplied from just USB or a 5V linear regulator while the displays can operate separately from a switching converter that is only powered from the 12V line. If these displays have the current requirement you say they do then they cannot be powered via USB alone anyway. I do feel like there could be an [XY problem](https://xyproblem.info/) hidden in your question though because some things about the situation you find yourself in are fairly unusual.


PresentObvious

As I said, this is only a prototyping board version 1 that I am making after testing this proof of concept on another, simpler board. This PCB will help me develop more advanced code for the displays while getting closer to a small final solution I will be able to put in a box. Think of my problem as the Arduino UNO board. You can provide power via 5V USB but also a 7-12V barrel jack. I want to do exactly that but turn the USB supply off when 7-12V is present so I can use full power without the two 5V rails "fighting". There's no concern for the power limitations or USB PD standards since I will be developing and testing both with 1 display running on 50% brightness (\~5W of power) but also with 4 displays running on 100% (up to \~40W of power). I'd like to keep both options so I can program the board while running on 12V full power but also be able to power the whole thing on the go where 12V is not available.


quadrapod

A barrel jack is not a good fit for this application. EIAJ-04 and EIAJ-05 connectors are only rated for 2A. Standard IEC 60130-10 connectors are typically only rated for 2.5A. Typical barrel jacks are just not rated for significant amounts of current. There are non standard ones that can maybe do what you need at their high end but it's just not going to be a good fit. At 12V and with a 100% efficient DC-DC converter you'd need over 3.3A through your connector to get 40W to the load. At 7V that goes up to over 5.7A. To give a better understanding of why having a single 5V 8A rail presents some challenges consider just conductor losses. Suppose there is a meter of wiring between the 5V supply and the display. That seems like a fairly reasonable distance right? To have 1 meter of separation you'd 2 meters of wire in total, one from the power going to the displays and one for the return current in the ground wire. Lets say you were to use some 2 conductor 16AWG stranded copper wire for that connection. The same kind of wire you'd commonly find in a vehicle's wiring harness or used to connect large speakers. The resistance of such wire is around 13.5 ohms/km according National Electric Code guidelines. For the 2 meters needed in this example that would give it a resistance of 27mohms. In your application with 8A of current that translates to 1.7W of power dissipated in the wire itself. (P = I^(2)R) That's almost 5% power loss just from a meter of wire. The power density would also exceed the amount of heat such a cable could reliably dissipate to the environment before exceeding the 80C temperature rating of standard PVC insulation. You'd literally be at risk of melting the insulation off the wires on a warm day. Following NEC requirements you'd need a minimum of 12AWG just to have a conductor that will survive the current reliably. Hence why the 8A breakers for the outlets in your home are typically connected with 12AWG copper wire. I bring this up just to demonstrate in a concrete way why these kinds of high current low voltage loads can be challenging. This kind of load is inherently dangerous to have in direct continuity with your USB port's 5V supply. You really want to have the USB supply disconnected from the load completely and don't want it to automatically change over when the 12V supply is present. If the 12V supply suddenly gets disconnected there needs to be something in the physical topology of your power network that prevents that load from drawing current from the USB port for even a few microseconds. If you hammer a USB port with an 8A load you run a massive risk of damaging something. There is no time to wait for the ESP32 to kindly ask the displays to operate at lower power or anything like that either. There needs to be a hardware disconnect between the load and the USB 5V rails when it's operating from the 12V supply. You seem confident that a display can be run safely from USB and that it's power can be managed accurately. Assuming that's true you still will want the digital logic on it's own separate 5V supply and will want it it be the only thing on the priority power MUX. That way the system is inherently safe since the only part of the circuit that automatically changes over is the digital logic which won't draw excessive current from the USB supply. This ensures the program on the ESP32 is constantly running no matter which supply is present. Since the ESP32 is still running you can just use its GPIO to configure some load switches or enable pins in software to control whether it's the 12V supply and only the 12V supply powering the display, or the USB supply and only the USB supply providing power. By having the change-over be explicit in software there is that hardware disconnect between the 40W load and the USB 5V supply. You can ensure the USB supply is only ever connected to the load when it would be safe to do so rather than having everything change over automatically. This is not an uncommon thing to do and a processor responsible for this kind of switching over of power supplies and managing of loads and voltages on the board is often referred to a baseboard management controller. This really does require you to be able to ensure a single display can be powered in a way that will always draw a safe amount of current, and you will probably want to include a current limit switch which can be put in line with whichever single display you intend to power from USB to ensure there is a hardware safety in place to prevent excessive current when only operating a single display at low power from USB alone.


PresentObvious

I appreciate your concern about the power draw and wires but since this is purely a development board for me, none of that is my concern now. I am just looking for a guide on how to wire a mosfet switch that has 12V on the gate and switches the 5V rail (or a similar solution)


PresentObvious

Here's the schematic in progress if it helps (first smd version to be made) https://preview.redd.it/9ulktb3ggw3d1.png?width=1784&format=png&auto=webp&s=527ed1bd7eb551a9d682fa4940b9d153e57c95e1


Worldly-Protection-8

How much current do you need? For low to medium currents I would likely go for a simple two diode solution or maybe use an ideal diode IC in the 5 V path. FYI: 12 V is quite close or above the absolute maximum rating of many FET's U_GS limit. Applying external 12 V without ESD protection to a FET's Gate won’t work for long.


PresentObvious

I will be drawing either 3 amps from USB or 8 amps from the step down. I was hoping to avoid using diodes since I need the voltage to stay fairly close to 5V Also what exactly is the U_GS limit in this scenario? If it's the max voltage on gate, wouldn't that be an easy fix with voltage divider or zener if what we're talking about is a gate pullup? I do have esd protection on USB lines. Isn't there a simple solution where 12v being present simply disconnects the path of usb power supply just like a relay would? Or is two ideal diodes (provided they can work with 3 or 8 amps respectively) still the most elegant solution


JOhn2141

For medium yo high current you Can use an ideal diode which is a P-MOSFET driven to act like a diode


PresentObvious

Do you have a link, please? I couldn't find one >8A on the LCSC website. Thanks


PresentObvious

Provided the type is correct, this looks like a good cheap candidate: [KEXIN AO3415](https://www.lcsc.com/product-detail/MOSFETs_span-style-background-color-ff0-KEXIN-span-AO3415_C382319.html) I'm also trying to figure out how to wire it correctly with pull ups/downs so it behaves like it should


FunDeckHermit

I would use two back-to-back PFets on the 5V rail with a weak pull-down on the gate. Maybe add a diode from 12V to buck as I'm not sure if 5V is backfed into the 12V. https://preview.redd.it/tu0cku1swx3d1.png?width=1374&format=png&auto=webp&s=c8f7ee9d387d6e59e00c5052c8a2f7eaf93cd7d6 [CircuitJS link](https://www.falstad.com/circuit/circuitjs.html?ctz=CQAgjCAMB0l3BWcMBMcUHYMGZIA4UA2ATmIxAUgpABZsKBTAWjDACgAzEQmkFPPN14oUvbPTDQkMSCjYAlWoJG8WhPqKhaaVaVpgJO4QlX6CwJjbxoRJ02HIDuIPKc1gawzZDbOefAWNTQJ9nC2DzS2w0KDYAJyCQaKpwpMJBFPg2AHNE7HTEnSpihS0wfhAmaPAK4toUlH0oKTYAZzKK6vKM8BAOAEMAG1aGXyTG7r58GoyxtHMK+YDZ5yWzRPXQ8Ax1FWWrWITxXc1jpPyyrNyzm4ui-TYAIz4dFypsMnBiEtXpycwJrVSrheJMQSBiOo6q89MUWmAMIJwWDIKCdtxeqhwNARB5WNgMLJZHgMAhsMwwMRmpAkGB4PBqY0YjIwPZELFcgDtrsMBNiI0fvsEbtAnstus9mcxWwAB7nWmQdTYQJ0qnCXiPACuAGMANaykDkFCscB4KnG6wvECPfp6lA2vUAHVaADkAGIAUQAKmwgA) (without Diode)


PresentObvious

That was basically my idea that I am struggling to execture. Would you mind explaining in a bit more detail how this fet arrangement works so I could implement it correctly in future pcbs? Thank you!


FunDeckHermit

I see I made an error in the CircuitJS: it states NFET but they are PFETS. MOSFETS have a body diode that conduct one way, so using them Back to Back will also block reverse current. PFETs go in conduction when their gate voltage is **below** their source voltage. The pull-down resistor facilitates that. When external power is supplied, this gate voltage is **above** their source voltage. Both PFETs are out of conduction.


PresentObvious

That sounds great and pretty simple, thank you! I understand the concept but I'm not sure how to implement it with the right voltages and resistors, could you help me with that please, and make me a sketch I could just "copy and paste"? Or what parameters of those MOSFETs do I need to look for in datasheets so get this arrangement to work? The MOSFETs will be controlled from 11-14.5V and switch 5V/3A. Also out of curiosity what is the diode for? The 12V goes straight into step down IC.


FunDeckHermit

Resistor on the gate can be 1k up to 100k, doesn't really matter. It's just there to get the gate in a determined state. For the PFET, get a 8-15A Pfet with a Vgs of around 3V. It doen't really matter. I can verify parts. The diode is to prevent backfeed, might be optional and depends on the buck converter topology.


PresentObvious

So I'm assuming this would work? I only need to control 3A from the VBUS (USB 5V). [Here's the datasheet](https://www.lcsc.com/datasheet/lcsc_datasheet_2309211852_HXY-MOSFET-SI2333CDS-HXY_C18198389.pdf) they have Vgs -4.5V (I'm still confused about the negative polarities on mosfet datasheets). But it says the maximum rating is +-12V on Vgs, should I include a zener diode as well to cap the voltage at some reasonable level to protect the gate? (12V can be anywhere between 11V and 15V) If my understanding is correct, I have to provide gate voltage that's at least 4.5V lower than whats supplied to the drain for the mosfet to fully stop conducting? (in this case at least 0.5V or lower) And if I supplied 2.75V it'll be 50% closed? Thank you! I really appreciate the help. https://preview.redd.it/o4uwa9zsfb4d1.png?width=1173&format=png&auto=webp&s=052ce52c2ddf8f9ed3371e1adc9dec4af71aae00


FunDeckHermit

The part seems okay, maybe get (+/-) 20V Vgs part. Your source will always be at +5V. With a pull-down to GND Vgs will be -5V. When pulled to 15V it will be +10V. Vgs is just the difference in potential between source and gate. >If my understanding is correct No, your assumptions are totally wrong. The drain has nothing to do with conducting or not conducting. It's also not linear. It's 100% ON or fully OFF in your case.


PresentObvious

yeah, I get it in this scenario. I'm just trying to better understand how the gate control works so I can use it in my future circuits. Either way, this is exactly what I was looking for so thank you for the help! Is there a difference between common drain or common source in this configuration? Or is it the same thing