Author Topic: Reverse current blocking circuit  (Read 8095 times)

0 Members and 1 Guest are viewing this topic.

Offline VEGETATopic starter

  • Super Contributor
  • ***
  • Posts: 2292
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Reverse current blocking circuit
« on: May 25, 2025, 03:51:51 pm »
Hello,

I have a circuit uses 5v, then going through p-mosfet current mirror stage (doing something else), then to the load.

However, the load circuit sometimes when connected to 5v external source, delivers this 5v to the device which makes me want to make a simple blocking circuit to prevent it from doing so. it does so when device is off and external power is on.

it must be high-side circuit. my needs are very simple, 4 identical circuits which has a total of 500-800mA... so that each one is just about 150-300mA max and even less.

I found these 3 solutions:

1- TPS22917, I found it to be very good solution and cheap via LCSC but wanted something easier to be done via n or p mosfets if possible.

tps22917 has 80 mOhm Ron which for 200 mA can be 0.0032v drop which is fine. however, for about 700mA is going to be ~0.04v drop meaning 5v will be 4.96v. overall not bad.

TPS22953 is similar but better, 14m resistance but more expensive and less available. 800mA total would make negligible drop.

2- LM66100, it has reverse current blocking but not sure if it fits my needs. it is an ideal diode which is a function that is not really needed.

3- TPS25200 -> 60 mOhm + fuse operation. assume 300 mA it will not give big drop. circuit already has resettable fuse per port, this one can eliminate them.


If going to pure mosfet route, please check the circuit in attachment.


will it work?

is there any other circuit that can be better?

N-mos circuit?

___

EDIT:

some P-mosfets I found:

https://lcsc.com/datasheet/lcsc_datasheet_2410122030_LRC-LP3218DT1G_C172437.pdf  -> looks like can handle current + low Ron. Very cheap.

https://lcsc.com/product-detail/MOSFETs_Winsok-Semicon-WST2339_C148354.html -> small sot package, 19mOhm resistance.

https://lcsc.com/product-detail/MOSFETs_MSKSEMI-AON7401-MS_C17702935.html -> smaller R than both and can handle current well. size a bit bigger. above are cheaper (for 100 finished board i would need 1600)

https://lcsc.com/product-detail/MOSFETs_JSMSEMI-IRLML6402TRPBF-JSM_C18190991.html  -> cheapest by far, seems ok too. can handle 200 mA i guess :?

https://lcsc.com/product-detail/MOSFETs_XNRUSEMI-XR25P01M_C42456887.html -> very low resistance (6.5~9 mOhm), relatively cheap.

https://lcsc.com/product-detail/MOSFETs_HL-80P02_C22379649.html -> very big size but < 4 mOhm resistance.

« Last Edit: May 25, 2025, 06:09:36 pm by VEGETA »
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 22531
  • Country: gb
  • 0999
Re: Reverse current blocking circuit
« Reply #1 on: May 25, 2025, 08:51:18 pm »
Only one transistor is needed.

And it's not a reverse current blocking circuit. It's a reverse voltage protection circuit.

 

Offline VEGETATopic starter

  • Super Contributor
  • ***
  • Posts: 2292
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: Reverse current blocking circuit
« Reply #2 on: May 25, 2025, 09:34:02 pm »
Only one transistor is needed.

And it's not a reverse current blocking circuit. It's a reverse voltage protection circuit.

Thanks for your reply.

what is the difference then between reverse polarity and reverse current blocking? I mean in this situation.

in your circuit the body diode will be blocking the reverse for sure. if GND and 5v were swapped, it won't turn on.

however the application i am describing is that ground will always stay ground but rather 5v of the input can be off while 5v can appear on the output.

what I want is that 5v on the output does not pass through to the input when the device is off (and therefore Vin=0).


the issue is the main device supplies 5v to external accessory device, that accessory can be hooked to external 5v. Now, while it is connected to main device, the 5v rail is the same between both of them which means the external 5v of the accessory will make its way to being also the 5v rail of the device... the ground is the same and nothing is reversed.

Offline langwadt

  • Super Contributor
  • ***
  • Posts: 5857
  • Country: dk
Re: Reverse current blocking circuit
« Reply #3 on: May 25, 2025, 09:53:58 pm »
Only one transistor is needed.

And it's not a reverse current blocking circuit. It's a reverse voltage protection circuit.

Thanks for your reply.

what is the difference then between reverse polarity and reverse current blocking? I mean in this situation.

in your circuit the body diode will be blocking the reverse for sure. if GND and 5v were swapped, it won't turn on.

however the application i am describing is that ground will always stay ground but rather 5v of the input can be off while 5v can appear on the output.

what I want is that 5v on the output does not pass through to the input when the device is off (and therefore Vin=0).


the issue is the main device supplies 5v to external accessory device, that accessory can be hooked to external 5v. Now, while it is connected to main device, the 5v rail is the same between both of them which means the external 5v of the accessory will make its way to being also the 5v rail of the device... the ground is the same and nothing is reversed.

it is not reverse current blocking because once the fet is on it'll stay on conducting in both directions

you can instead use something like this; https://github.com/xioTechnologies/Ideal-Diode
 

Offline VEGETATopic starter

  • Super Contributor
  • ***
  • Posts: 2292
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: Reverse current blocking circuit
« Reply #4 on: May 25, 2025, 10:33:36 pm »
Only one transistor is needed.

And it's not a reverse current blocking circuit. It's a reverse voltage protection circuit.

Thanks for your reply.

what is the difference then between reverse polarity and reverse current blocking? I mean in this situation.

in your circuit the body diode will be blocking the reverse for sure. if GND and 5v were swapped, it won't turn on.

however the application i am describing is that ground will always stay ground but rather 5v of the input can be off while 5v can appear on the output.

what I want is that 5v on the output does not pass through to the input when the device is off (and therefore Vin=0).


the issue is the main device supplies 5v to external accessory device, that accessory can be hooked to external 5v. Now, while it is connected to main device, the 5v rail is the same between both of them which means the external 5v of the accessory will make its way to being also the 5v rail of the device... the ground is the same and nothing is reversed.

it is not reverse current blocking because once the fet is on it'll stay on conducting in both directions

you can instead use something like this; https://github.com/xioTechnologies/Ideal-Diode

I checked and found this device: https://www.ti.com/product/TPS22964C

seems nice but the package is small bga which i don't like, maybe pcbway will charge extra for it.
___

For your suggestion, I have this found on LCSC: https://lcsc.com/product-detail/Bipolar-BJT_Nexperia-BCM856BSH_C458150.html I guess it is the same part but different package. Maybe I can use a lot cheaper Chinese part to save more cost if needed. "matched pnps" can also regular single pnps as this implementation looks like current mirror.

btw, will it have typical diode drop voltage or based on mosfet internal Ron?

here is my understanding for it:

5v on input passes through left pnp making 0.6v difference around it, meaning its collector is 4.4v which is sent to the base. Now base of both PNPs are 4.4v.

if Vout = 0 and Vin = 5v, left pnp will be the same, but right pnp will have 4.4 as base voltage but about 0v as emitter voltage which makes Vbe = 4.4 which means it is off as it is a pnp. while right pnp is off, the resistance under it has no current which means 0v is delivered to mosfet gate... -> mosfet is fully ON now.

if Vout = 5v and Vin = 0v, now left pnp will have 0v at its base, collector, and emitter which makes it off. While right transistor will have 5v at emitter and 0v at base -> Vbe = -5v which means it is on. if right transistor is ON, now collector will be 4.4v and will deliver it to mosfet gate... -> mosfet is fully OFF now.

^
is this correct?

i don't have pnps in my design now, i do have npn, nmosfet, and pmosfet. if this works, i guess i can replace the circuit with one which uses those. does this circuit have a special name I can search?

pairing this with a low Ron mosfet from above would be good. One main reverse protection for the entire 4 sub-circuit as there is no need to duplicate it 4 times.



« Last Edit: May 25, 2025, 10:48:59 pm by VEGETA »
 

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 8355
  • Country: fi
    • My home page and email address
Re: Reverse current blocking circuit
« Reply #5 on: May 26, 2025, 07:27:00 am »
I see the P-channel MOSFET one very often in various designs (especially microcontroller developer boards), it is typically called reverse polarity protection.
The point is to avoid any damage if someone connects the supply to the board in the wrong polarity.

That alone should suffice, if you do not expect the polarity to change while connected.
Otherwise, you can use an ideal diode, or an ideal diode with a P-channel MOSFET as a pass element (if the MOSFET has lower on-state resistance than the ideal diode), or even construct your own ideal diode circuits with two matched PNP transistors and a couple of resistors.

I'm only a hobbyist doing my own free designs, and tend to overengineer my designs, but the single P-ch MOSFET suffices for this for me.
(When I use a linear regulator to say 3.3V, I tend to omit even the MOSFET, and just use a regulator that tolerates the reverse polarity.)

When the MOSFET is in the expected orientation (same as the body diode), the voltage drop over it depends on the on-state resistance Rds(on).  It typically depends on both the voltage and the current.

I prefer to use SOT23 P-channel MOSFETs like Nexperia PMV50EPEA (0.295€ apiece at Mouser in lots of ten; $0.1265 apiece at LCSC in lots of five, part C478012), because they're small but easily solderable by hand if necessary, cheap, and can be used for many other purposes in my designs also.  It has about 80mΩ DC resistance at 3.3V, should handle ±20V, and has ESD protection to 2 kV.

If you look at the datasheet Fig. 8, the top-leftmost curve corresponds to 3.3V voltage, horizontal coordinate to the current drawn, and the resistance is on the (left) vertical axis.  We can see that below 1A of current (at 3.3V), the on-state resistance is below 80mΩ = 0.080Ω.  At that current, the voltage drop would be 0.080V (from 3.30V to 3.22V), 0.080W of waste heat generated, and according to Rth(j-a)≲261K/W, would heat up by about 21 K = 21°C ≃ 38°F, not much at all.

It does not matter if the gate is connected directly to ground, or to the ground-side leg of an ideal diode; the on-state resistance will dictate the voltage drop.

I've seen Diodes Inc. DMG2305UX used in 3.3V and 5V designs; its gate-source voltage is limited to ±8V.  Diodes Inc. DMP3056L is usable up to ±25V, say for 9V-12V input polarity protection.  So, I'd say you can pick any P-channel MOSFET that satisfies your on-state resistance Rds(on) at your voltage and maximum expected current, and has sufficient maximum drain-source (Vds) and gate-source (Vgs) voltage ranges.  Although gate-source threshold voltage Vgs(th) is related, you still want to look at the datasheet to find out the exact Rds(on) at your voltage (3.3V) and maximum current (say 1A).
« Last Edit: May 26, 2025, 07:35:10 am by Nominal Animal »
 

Offline VEGETATopic starter

  • Super Contributor
  • ***
  • Posts: 2292
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: Reverse current blocking circuit
« Reply #6 on: May 26, 2025, 08:19:31 am »
I see the P-channel MOSFET one very often in various designs (especially microcontroller developer boards), it is typically called reverse polarity protection.
The point is to avoid any damage if someone connects the supply to the board in the wrong polarity.

That alone should suffice, if you do not expect the polarity to change while connected.
Otherwise, you can use an ideal diode, or an ideal diode with a P-channel MOSFET as a pass element (if the MOSFET has lower on-state resistance than the ideal diode), or even construct your own ideal diode circuits with two matched PNP transistors and a couple of resistors.

I'm only a hobbyist doing my own free designs, and tend to overengineer my designs, but the single P-ch MOSFET suffices for this for me.
(When I use a linear regulator to say 3.3V, I tend to omit even the MOSFET, and just use a regulator that tolerates the reverse polarity.)

When the MOSFET is in the expected orientation (same as the body diode), the voltage drop over it depends on the on-state resistance Rds(on).  It typically depends on both the voltage and the current.

I prefer to use SOT23 P-channel MOSFETs like Nexperia PMV50EPEA (0.295€ apiece at Mouser in lots of ten; $0.1265 apiece at LCSC in lots of five, part C478012), because they're small but easily solderable by hand if necessary, cheap, and can be used for many other purposes in my designs also.  It has about 80mΩ DC resistance at 3.3V, should handle ±20V, and has ESD protection to 2 kV.

If you look at the datasheet Fig. 8, the top-leftmost curve corresponds to 3.3V voltage, horizontal coordinate to the current drawn, and the resistance is on the (left) vertical axis.  We can see that below 1A of current (at 3.3V), the on-state resistance is below 80mΩ = 0.080Ω.  At that current, the voltage drop would be 0.080V (from 3.30V to 3.22V), 0.080W of waste heat generated, and according to Rth(j-a)≲261K/W, would heat up by about 21 K = 21°C ≃ 38°F, not much at all.

It does not matter if the gate is connected directly to ground, or to the ground-side leg of an ideal diode; the on-state resistance will dictate the voltage drop.

I've seen Diodes Inc. DMG2305UX used in 3.3V and 5V designs; its gate-source voltage is limited to ±8V.  Diodes Inc. DMP3056L is usable up to ±25V, say for 9V-12V input polarity protection.  So, I'd say you can pick any P-channel MOSFET that satisfies your on-state resistance Rds(on) at your voltage and maximum expected current, and has sufficient maximum drain-source (Vds) and gate-source (Vgs) voltage ranges.  Although gate-source threshold voltage Vgs(th) is related, you still want to look at the datasheet to find out the exact Rds(on) at your voltage (3.3V) and maximum current (say 1A).


by the looks of it, the p-mosfet with 2 pnps is the best solution so far. I even found a part (DZDH0401DW) which integrates this but overall using dual matched pnps is cheaper and more available. but is my understanding of its operation (explained above) correct?

mosfets to be used:

https://www.lcsc.com/product-detail/MOSFETs_HL-70P03_C22379653.html
https://www.lcsc.com/product-detail/MOSFETs_HL-50P02_C22379650.html -> those are interchangeable and all very low resistance.

https://www.lcsc.com/product-detail/MOSFETs_XNRUSEMI-XR25P01M_C42456887.html -> small size but still low resistance.


I calculated 700-800 mA absolute max current usage which means for 7.5mOhm R is gonna be 0.0048v drop from 5v, which will be 4.9952v effectively 5v.

What I am trying to understand is if all ideal diode\Oring chips prevent reverse current or what? I mean if an ideal diode is used but put to off, will there be current in reverse direction?


the orientation of the mosfet seen above, as you mentioned, is with the diode. but this also means the diode is forward biased. how can this mean the drop total is gonna be so minimal (based on R and I) rather than typical diode drop (0.3-0.7v)?



on a side note, i believe i can use this circuit as Oring for 2 rails, 3.3v and 5v delivered to the same pin where user selects which voltage he needs. i think of having a small switch to deliver 5v or "no connect" to P-mosfet gate. if "no connect" is delivered, then circuit operates as usual but if 5v is delivered then it switches the ideal diode mosfet regardless of pnp circuit. both should do reverse current blocking in active or inactive status.

is this also correct?
« Last Edit: May 26, 2025, 08:47:57 am by VEGETA »
 

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 8355
  • Country: fi
    • My home page and email address
Re: Reverse current blocking circuit
« Reply #7 on: May 26, 2025, 10:28:39 am »
by the looks of it, the p-mosfet with 2 pnps is the best solution so far.
I am assuming we are talking about the ideal diode circuit with a P-channel MOSFET pass transistor:

(Click to embiggen)
where VIN and GND is the power input, the device runs on VCC/GND, and Q2.1 and Q2.2 are a matched pair of BJT PNP transistors.  The simpler option, which protects from reverse polarity but not from reverse current, is to omit the PNP transistors and the two resistors, and simply connect the gate to GND.

but is my understanding of its operation (explained above) correct?
I'm not sure.  I just consider the two BJT PNPs a comparator.  In normal operation, when GND < VCC < VIN, Q2.2 does not pass much current, so Q1's gate is pulled close to GND, and assuming VIN is ≳ 3V or so, Q1's Vgs ≲ -3V and Q1 conducts.  Basically all of the load current passes through Q1, and the voltage drop over Q1 (VIN-VCC) is defined by Q1's Rds(on).  Whenever VCC ≥ VIN, Q2.2 passes enough current so that Q1's Vgs ≳ -0.6V (gate at most one voltage drop below source), and Q1 is high-Z.

I hope someone more betterer than I can explain the behaviour of this, I've never bothered to work it out myself!

I calculated 700-800 mA absolute max current usage which means for 7.5mOhm R is gonna be 0.0048v drop from 5v, which will be 4.9952v effectively 5v.
70P03 is about 10mΩ at 5V (see Figure 4 of the datasheet; title is above the chart), 50P02 about 6mΩ at 5V (see Figure 2 of datasheet), and XR25P01M between 6mΩ and 7mΩ at 5V (Figure 2 of datasheet).

In my experience, supplies aren't that precise, and if you use crappy power cables (especially with copper-clad aluminium wires) they can drop a bit of voltage (say, 0.05V or more); and I personally don't mind 0.1V drop at all, as long as the waste heat generation is in check.

At 5V supply, 1A current draw, and say a 50mΩ Rds(on), the drop is 0.05V, and 0.050W = 50mW = 1/20 W is turned to waste heat.  Not a problem at all, in my opinion; anything better is positive, but probably not significant for a wired device.  If you're doing battery-powered low-power stuff, then it might matter.
 
What I am trying to understand is if all ideal diode\Oring chips prevent reverse current or what? I mean if an ideal diode is used but put to off, will there be current in reverse direction?
There are two aspects here: reverse polarity, and reverse current.

Reverse polarity occurs when VIN < 0, i.e. the power supply has VIN and GND swapped.  This is what a single P-channel MOSFET protects against very well.

Now, consider a case where say VIN is from an USB connector.  USB devices must never try to supply power to the USB host.  Let's say the USB host is a laptop with say 4.9V VUSB (it is technically allowed to vary between 4.5V and 5.5V), and your separately powered device has 5V at VCC.  This is the reverse current case: GND < VIN < VCC.  If we only had the MOSFET for reverse polarity protection, its Vgs would be -VCC, so the MOSFET would conduct, and our USB device would try to backfeed power to the host!  Ouch!

When we add the two matched PNP diodes and the high-value resistors, we turn this into an ideal diode.  When VIN > VCC, you get only the voltage drop from the P-channel MOSFET Rds(on).  When VIN < VCC, the circuit does not conduct; it blocks any current.

Yes, an ideal diode (with "anode" at VIN, "cathode" at VCC), will only pass current from VIN to VCC, and only when VIN > VCC, just like a normal diode would.  The difference is that a normal diode has a "significant" voltage drop over it, 0.6V (or 0.3V for a Schottky diode).  An ideal diode uses transistors (and a pair of resistors) to perform in a similar manner, but with a lower voltage drop (at least with low currents).

but this also means the diode is forward biased.
Yes, but that body diode is not relied upon in the expected configuration when VIN ≳ VCC > GND - Vgs, where Vgs is negative and low enough for the MOSFET to conduct well.

Consider this: if you bypass a diode with a wire, does the diode drop matter anymore?  It is the same situation here, except that the diode is the body diode of the P-channel MOSFET, and the wire is the drain-source connection whose resistance is controlled by the voltage difference between gate and source.

on a side note, i believe i can use this circuit as Oring for 2 rails, 3.3v and 5v delivered to the same pin where user selects which voltage he needs.
For or-ing two supplies, I'd recommend you take a look at TI LM66200, although it is limited to 5.5V maximum supply voltage.  0.309€ apiece in sets of ten at Mouser,  $0.3575 apiece in sets of ten at LCSC (C3235556).  It has an /ON pin: when pulled high, the output is not connected to either input.  When /ON is low, the higher input is connected to the output (with reverse current protection).  You can use that to control the output.  It also provides an ST pin, which it pulls high when first source is used, and low when second source is used.

Because LM66200 exists and is cheap (and I mostly do max. 5.5V stuff myself), I haven't worked out how to best extend the ideal circuit for additional inputs.
« Last Edit: May 26, 2025, 10:37:42 am by Nominal Animal »
 

Offline VEGETATopic starter

  • Super Contributor
  • ***
  • Posts: 2292
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: Reverse current blocking circuit
« Reply #8 on: May 26, 2025, 12:01:56 pm »
Quote
In my experience, supplies aren't that precise, and if you use crappy power cables (especially with copper-clad aluminium wires) they can drop a bit of voltage (say, 0.05V or more); and I personally don't mind 0.1V drop at all, as long as the waste heat generation is in check.

At 5V supply, 1A current draw, and say a 50mΩ Rds(on), the drop is 0.05V, and 0.050W = 50mW = 1/20 W is turned to waste heat.  Not a problem at all, in my opinion; anything better is positive, but probably not significant for a wired device.  If you're doing battery-powered low-power stuff, then it might matter.
 

it will have a short ribbon cable to deliver 5v to the board, and then all circuit on board which is also small. i measured good 5v reaching the board without drop.

the mosfets I linked seems perfect and I have enough space to fit one of them, with this cheap price it can't go wrong. total max current of 800mA is probably too much, real number can be less.


Quote
Yes, an ideal diode (with "anode" at VIN, "cathode" at VCC), will only pass current from VIN to VCC, and only when VIN > VCC, just like a normal diode would.  The difference is that a normal diode has a "significant" voltage drop over it, 0.6V (or 0.3V for a Schottky diode).  An ideal diode uses transistors (and a pair of resistors) to perform in a similar manner, but with a lower voltage drop (at least with low currents).

there are many ideal diode ICs but not all of them has reverse current blocking, which is why I asked. the main circuit of a p-mosfet is always there but not reverse protection.

some efuses also has reverse current blocking too.

Quote
For or-ing two supplies, I'd recommend you take a look at TI LM66200, although it is limited to 5.5V maximum supply voltage.  0.309€ apiece in sets of ten at Mouser,  $0.3575 apiece in sets of ten at LCSC (C3235556).  It has an /ON pin: when pulled high, the output is not connected to either input.  When /ON is low, the higher input is connected to the output (with reverse current protection).  You can use that to control the output.  It also provides an ST pin, which it pulls high when first source is used, and low when second source is used.

Because LM66200 exists and is cheap (and I mostly do max. 5.5V stuff myself), I haven't worked out how to best extend the ideal circuit for additional inputs.

yes i know this device. it has big resistance if I want higher current like 3 amps, and it does not control individual channels.

what I want is to have 3.3v and 5v rails separately then deliver their output at one pin. the user selects which one he needs and it should be totally fine and isolated with minimal Ron (i can pay for a better p-mosfet).

the system in mind has output pins, one of them is constant 5v. while another pin can be either 5v or 3.3v depending on the user selection (the PSU i design should fit different device models). I solved this issue by having a big rocker switch which is the best solution as it breaks before makes and completely isolates the rails.

I am happy with current solution but wanted to get rid of the big physical switch if possible.

having the buck regulator feedback resistors change from 3.3v to 5v is ok and I did it elsewhere, but in target systems where 5v is required.... the constant 5v pin will be shorted to the 3.3v/5v pin and we will get 2 buck regulators output (and feedback network) shorted together which will cause issues according to TI and my expereience.

hence, i want a true isolation solution besides the big switch.

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 8355
  • Country: fi
    • My home page and email address
Re: Reverse current blocking circuit
« Reply #9 on: May 27, 2025, 06:16:36 am »
what I want is to have 3.3v and 5v rails separately then deliver their output at one pin. the user selects which one he needs and it should be totally fine and isolated with minimal Ron (i can pay for a better p-mosfet).
How about having a high-side switch for both rails, a P-channel MOSFET with its gate connected to source via a high-value resistor (say 10k to 100k) making it high-Z/non-conducting in the default case, gate pulled to ground via an N-channel MOSFET (like BSS138 or NX138AK) to enable the switch?  Then, optionally, have a single ideal diode on the output, preventing backfeeding power to the rails.  You might add a current spike limiting resistor (200 to 1k) on the N-channel MOSFET gate, to limit the maximum current draw; the MOSFET gate behaves like a capacitor, and the added resistor limits the maximum current draw during the transition, also slowing down the transition somewhat.

All you need to do, is to ensure you never enable (pull N-channel MOSFET gates high) for more than one output at a time.  When changing the output, always pull the enabled one down first, delay for a short time (milliseconds!) so that the MOSFETs have time to switch, before enabling (pulling high) the new one.  In microcontroller code, I do this by writing dedicated functions for the output selection, and always using those functions instead of manipulating the related GPIO pins directly; it is just as safe in practice as using external circuitry (like a 2-to-4 decoder), because of the delay needed between switching states due to MOSFET transition taking some time.

You can extend this to as many rails as you want (1.8, 2.5, and 3.8/4.0/4.2 might be useful, for example), by just adding more rails, one GPIO pin per rail.
 

Offline VEGETATopic starter

  • Super Contributor
  • ***
  • Posts: 2292
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: Reverse current blocking circuit
« Reply #10 on: May 27, 2025, 07:37:01 am »
what I want is to have 3.3v and 5v rails separately then deliver their output at one pin. the user selects which one he needs and it should be totally fine and isolated with minimal Ron (i can pay for a better p-mosfet).
How about having a high-side switch for both rails, a P-channel MOSFET with its gate connected to source via a high-value resistor (say 10k to 100k) making it high-Z/non-conducting in the default case, gate pulled to ground via an N-channel MOSFET (like BSS138 or NX138AK) to enable the switch?  Then, optionally, have a single ideal diode on the output, preventing backfeeding power to the rails.  You might add a current spike limiting resistor (200 to 1k) on the N-channel MOSFET gate, to limit the maximum current draw; the MOSFET gate behaves like a capacitor, and the added resistor limits the maximum current draw during the transition, also slowing down the transition somewhat.

All you need to do, is to ensure you never enable (pull N-channel MOSFET gates high) for more than one output at a time.  When changing the output, always pull the enabled one down first, delay for a short time (milliseconds!) so that the MOSFETs have time to switch, before enabling (pulling high) the new one.  In microcontroller code, I do this by writing dedicated functions for the output selection, and always using those functions instead of manipulating the related GPIO pins directly; it is just as safe in practice as using external circuitry (like a 2-to-4 decoder), because of the delay needed between switching states due to MOSFET transition taking some time.

You can extend this to as many rails as you want (1.8, 2.5, and 3.8/4.0/4.2 might be useful, for example), by just adding more rails, one GPIO pin per rail.

my idea was about using one ideal diode per rail, but was still not settled on how to enable and disable it.

you idea involves having the main p-mosfet where source is connected to the rail and drain is the output, right? this way the body diode is pointing from output to input and would conduct. unless you mean the other orientation, but now connecting gate to source won't make it off by default  but rather connecting source to drain will.

here you are using 3 main p-mosfets which should be nice and very low R... while having just 2 ideal diodes makes it 2 of these mosfets, while 4 pnps which are very cheap.

using a physical small slide switch is the way to go for me, these always break before make and my end usage is for configuring the output of a power supply. meaning, the user will turn it off completely and switch the desired voltage THEN power it up. if he needs to change stuff he should power it down first. but yes, fool-proofing it is a must, which makes me like ideal diode more.

investing into 2 very good p-mosfets is ok for me, it will somehow still free lots of board space.


just looking into a way to make it robust, what do you think of my solution mentioned?

Offline VEGETATopic starter

  • Super Contributor
  • ***
  • Posts: 2292
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: Reverse current blocking circuit
« Reply #11 on: May 28, 2025, 08:04:55 am »
one thing i was thinking about concerns me, which is when we have 2 of this circuit at the same output as discussed... however, the active one is 3.3v which means 3.3v is gonna be at the output while the inactive one has 5v at its input and the p-mosfet is off.

in this case, the diode is forward biased from 5v to 3.3v and would conduct! even if the pnps turn off the mosfet.

thus, maybe having another series p-mosfet but reverse orientation so that it's diode is blocking in this situation (back-to-back)... but both having the exact same or similar control signal (by having the right pnp to the output of the right mosfet).

can this work? or am i making a problem that does not exist?

but for one simple rail as in the first part of this thread, i believe one p-mosfet+pnp ideal diode is enough for reverse current blocking.

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 22531
  • Country: gb
  • 0999
Re: Reverse current blocking circuit
« Reply #12 on: May 28, 2025, 09:53:44 am »
one thing i was thinking about concerns me, which is when we have 2 of this circuit at the same output as discussed... however, the active one is 3.3v which means 3.3v is gonna be at the output while the inactive one has 5v at its input and the p-mosfet is off.

in this case, the diode is forward biased from 5v to 3.3v and would conduct! even if the pnps turn off the mosfet.

thus, maybe having another series p-mosfet but reverse orientation so that it's diode is blocking in this situation (back-to-back)... but both having the exact same or similar control signal (by having the right pnp to the output of the right mosfet).

can this work? or am i making a problem that does not exist?

but for one simple rail as in the first part of this thread, i believe one p-mosfet+pnp ideal diode is enough for reverse current blocking.
If one power supply is 5V and the other 3.3V, then there will be 5V, minus the MOSFET conduction loss, at the load and the 5V power supply will deliver all the current. The higher input voltage source always powers the circuit.
 

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 8355
  • Country: fi
    • My home page and email address
Re: Reverse current blocking circuit
« Reply #13 on: May 28, 2025, 11:15:20 am »
you idea involves having the main p-mosfet where source is connected to the rail and drain is the output, right? this way the body diode is pointing from output to input and would conduct. unless you mean the other orientation, but now connecting gate to source won't make it off by default  but rather connecting source to drain will.
Indeed, I forgot about the body diode.

If you use a large enough physical switch (as in capable of disconnecting the maximum DC current, and withstanding the maximum rail voltage), then you obviously only need one ideal diode: you connect the rails to the switch connect points, and the common to the ideal diode, and the ideal diode to output.  Only the currently selected rail will pass over the switch (the others just flapping in the wind, not connected to anything), and the ideal diode stops the backfeeding.

If we assume microcontroller control, the two options, as far as I can see, are
and
(Click to embiggen)
Q1 and Q3 are the pass transistors.  Note how they're oriented opposite to each other, so that at least one of the body diodes is always in blocking orientation.  R1 is a pull-up resistor, ensuring the gate is pulled up to source, so that the P-channel MOSFET(s) will not conduct.  It can be quite a high value resistor; anything between 10k and 100k should work.  (Remember, the gate acts very much like a capacitor.)  R2 is a peak current limiting resistor, so that during switching, the gate(s) won't draw too much current.  Since the switching occurs rarely, 1k should be a good value.  If you did PWM or something similar, then a smaller resistance would be in order here.  Q2 is a logic-level MOSFET, and will carry less than a milliamp of current.  I recommend BSS138 or NX138AK in SOT23 package for Q2, as it conducts well at 2.5V, and doesn't mind if gate is pulled to 20V; cheap and well suited for 3.3V to 12V logic stuff.  I prefer NX138AK, because it has slightly lower total gate charge, and thus switches a bit faster (useful when doing PWM, doesn't matter here).

In the ideal diode case, Q3, Q4, Q5, R3, R4 forms the ideal diode with reverse current protection.  It only conducts when Q3's drain has higher voltage than its source (i.e. left side has higher voltage than right side).  Q1 is then the high-side switch, passing current only when ENA is pulled high (so that Q2 conducts and pulls the gates to ground).

In the dual P-MOSFET case, Q1 and Q3 are connected source-to-source, and the common sources connected to their gates via the pull-up resistor R1.  This way, if there is a positive voltage on either VIN or VOUT, the sources are pulled to one (body) diode drop below that, and the weak pull-up pulls the gate to the source potential, making both Q1 and Q3 not conduct.  When ENA is pulled high, Q2 conducts and pulls the gate to ground.

The ideal diode case is better in the sense that if VOUT is connected to an external voltage source higher than VIN, the ideal diode blocks, protecting VIN from backfeeding.
The dual P-MOSFET case is simpler, omitting the dual PNP and two resistors.
« Last Edit: May 28, 2025, 11:19:37 am by Nominal Animal »
 

Offline VEGETATopic starter

  • Super Contributor
  • ***
  • Posts: 2292
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: Reverse current blocking circuit
« Reply #14 on: May 29, 2025, 02:25:02 pm »
one thing i was thinking about concerns me, which is when we have 2 of this circuit at the same output as discussed... however, the active one is 3.3v which means 3.3v is gonna be at the output while the inactive one has 5v at its input and the p-mosfet is off.

in this case, the diode is forward biased from 5v to 3.3v and would conduct! even if the pnps turn off the mosfet.

thus, maybe having another series p-mosfet but reverse orientation so that it's diode is blocking in this situation (back-to-back)... but both having the exact same or similar control signal (by having the right pnp to the output of the right mosfet).

can this work? or am i making a problem that does not exist?

but for one simple rail as in the first part of this thread, i believe one p-mosfet+pnp ideal diode is enough for reverse current blocking.
If one power supply is 5V and the other 3.3V, then there will be 5V, minus the MOSFET conduction loss, at the load and the 5V power supply will deliver all the current. The higher input voltage source always powers the circuit.

my case has 6 output pins: gnd - gnd - 5v - 3.3/5v - 9v/12v - 9v/12v. the 9/12v is easy since it has one regulator which can be controlled by changing the feedback resistors with a small switch.

however, 5/3.3v pin is different because i already have a dedicated 5v rail. my psu is going to be installed in different versions of the target device, some require 3.3v and some 5v.

the ones requiring 3.3v is very easy, but for those who require 5v i suspect that the dedicated 5v rail is internally connected to the 3.3v/5v pin... because both of them are the same rail and no reason to separate them. my psu would be adjustable to deal with different variations of the target device while the target device itself cares only about its own power supply which was designed to specifically fit it.

so assuming a 5v version, we will have the dedicated 5v rail working from buck regulator number 1 + the 3.3v/5v rail pin getting 5v from the same buck regulator number 1 but via a switch.

right now the solution i have working (tested to be working fine) is having a big rocker switch to switch between 3.3v (buck 2) and 5v (buck 1). it is not pretty and very big in the board hence the need to replace it. the latest posts of this topic was about this.

so if we got the p-mosfet ideal diode + protection blocking p-mosfet circuit installed to act as the switch, it will add small drop assume using like 2x 4 mohm p-mosfets.

this circuit to be installed like this:

buck 2 (3.3v) -> mosfet circuit block -> 3.3v/5v pin.
buck 1 (5v) -> mosfet circuit block -> 3.3v/5v pin.
switched via a small slide switch to control mosfet gates so that only one is active at one time.

while the dedicated 5v pin has the buck 1 output directly connected to it without anything.

so even if we got some drop via the mosfet circuit from 5v when choosing 5v, the end result will still be ok right? since eventually 5v must come from buck 1.

but if we choose 3.3v output, the target device will not have the 5v pin internally connected to 3.3v/5v pin, which means we get a clean 3.3v at that pin minus some small drop, making it 3.35v is a good measure to compensate.

is this analysis correct?

the concern is when 5v is selected and pins are shorted at target device, the buck 2 must be protected so that it does not get back-fed from 5v. i believe the mosfet circuit we managed here should take care of that. and the same thing when 3.3v is selected, the mosfet circuit must not allow any backfeeding of 3.3v voltage to buck 1 but rather completely isolating it.

what do you think?




Quote
If you use a large enough physical switch (as in capable of disconnecting the maximum DC current, and withstanding the maximum rail voltage), then you obviously only need one ideal diode: you connect the rails to the switch connect points, and the common to the ideal diode, and the ideal diode to output.  Only the currently selected rail will pass over the switch (the others just flapping in the wind, not connected to anything), and the ideal diode stops the backfeeding.

i have a switch right now and it does not need anything else since it is break-before-make type. once you choose a rail, it ensures the other is physically disconnected first.
the only danger is when the user is an idiot who did not choose the correct voltage for his target device, then it would hurt the device and power supply.

fool proofing in this case seems a good idea, and your suggestion of using the ideal diode (p-mos + 2xpnp) as a protection mechanism seems cheap enough. right now the design assumes user knows what he is doing but another version can get this extra protection step.





Offline VEGETATopic starter

  • Super Contributor
  • ***
  • Posts: 2292
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: Reverse current blocking circuit
« Reply #15 on: May 30, 2025, 03:27:31 pm »
i have another psu application where rails are constant, nothing changes. but i need a mosfet switch to switch the rail on or completely off.

i think the first portion of above pictures Q1 should be enough right?

connecting it to an external switch to activate it via sending GND to its gate rather than 3.3 or 5v input. thus either on or off while being off by default.

this other psu has 3.3v, 5v, and 12v rail... all constant, not interchangeable or adjustable. connector is fixed too, so that no one can switch the rails or something... thus i thought omitting the ideal diode portion (Q2 + 2xpnp) can save cost and space as well as less drop since it won't be needed to do reverse current blocking.

these are excellent mosfets to be used:

https://www.lcsc.com/product-detail/MOSFETs_HUASHUO-HSBA1119_C42376807.html
https://www.lcsc.com/product-detail/MOSFETs_HUASHUO-HSBA90P02_C22359240.html

HSBA1119 has about 2mohm max Rdson at -3.3v Vgs for the 3.3v rail, and less than that for 5v rail. drop is very minimal so that having 3.35v instead of precise 3.3v will do the job.


while for this psu with interchangeable pin, the ideal mosfet is a must.

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 8355
  • Country: fi
    • My home page and email address
Re: Reverse current blocking circuit
« Reply #16 on: June 04, 2025, 12:16:09 pm »
i have another psu application where rails are constant, nothing changes. but i need a mosfet switch to switch the rail on or completely off.

i think the first portion of above pictures Q1 should be enough right?
Q1 alone, with gate pulled to ground, only protects against when the source voltage is negative, below GND.
Also remeber the body diode; it will always pass current in one direction.

I don't really see how it would suffice for a rail with multiple switchable supplies.

The dual P-MOSFET one, on the other hand, is a real high-side switch.  With common low-Rds(on) P-MOSFETs, either side voltage can be between 0V and 20V, and the switch does not care.  Current can flow in either direction, but only when allowed by the switch.

To make it default off/nonconducting, add a 47k resistor between ENA and R1 to ground, so that when ENA flops in the wind, Q2 gate is pulled to the ground and the switch nonconducting.  Only when ENA is pulled to 2.5V – 20V (if Q2 is BSS138 or NX138AK for example), does the switch conduct.

For 5V and higher rails, consider a dual power P-MOSFET packages like IRF9358PbF or SQJ951EP for example.  Their Rds(on) isn't great at Vgs=-4.5V, but at -9V and above, is below 20mΩ even for several amps of current (so 0.04V drop over the entire switch at 1A of current).
« Last Edit: June 04, 2025, 01:47:48 pm by Nominal Animal »
 

Offline VEGETATopic starter

  • Super Contributor
  • ***
  • Posts: 2292
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: Reverse current blocking circuit
« Reply #17 on: June 04, 2025, 12:48:52 pm »
Quote
Q1 alone, with gate pulled to ground, only protects against when the source voltage is negative, below GND.
Also remeber the body diode; it will always pass current in one direction.

please check the image attached.

for this specific circuit i meant to use it for another power supply circuit, not the one discussed in this thread.

that PSU has fixed rails, no interchangeable rails, no changing voltage or even pins... all fixed. 5v is 5v, 3.3v is 3.3v. body diode is in reverse direction so it is blocking input current to output and only when p-mosfet is active there will be current flowing from input to output.

yes, output to input current will pass if exist but in this case it does not exist as explained.

more like a very low resistance and cheap enough power switch.


Quote
To make it default off/nonconducting, add a 47k resistor between ENA and R1, so that when ENA flops in the wind, Q2 gate is pulled to the ground and the switch nonconducting.  Only when ENA is pulled to 2.5V – 20V (if Q2 is BSS138 or NX138AK for example), does the switch conduct.

you mean put a pulldown 47.5k resistor from ENA to ground, so that Q2 base is 0v by default then give it 5v\3.3v to ENA it will be on dragging Q1 gate to ground activating it.


Quote
For 5V and higher rails, consider a dual power P-MOSFET packages like IRF9358PbF or SQJ951EP for example.  Their Rds(on) isn't great at Vgs=-4.5V, but at -9V and above, is below 20mΩ even for several amps of current (so 0.04V drop over the entire switch at 1A of current).

i guess the resistance specified in datasheet is per one single mosfet not the 2 combined, right?

yes, their Rdson is not good enough. single mosfets can reach a lot less, but also takes more size and area. i didn't search thoroughly but in my fast search i didn't find ones with lower resistance than previously mentioned single p-mosfets.

i agree with you that having the 2 mosfet solution is the best but it will cost more, plus have some dropout which can be compensated for but still annoying.

getting the very low R is gonna cost since for example 2.5m one for 2 rails = 4 mosfets x 100 boards = 400 units = ~113$ on LCSC -> 1.1$ per board. the 1.2m one is gonna be 1.82$ per board which i admit not that expensive but still some cost --> will have a bit more when pcb house buy the items due to internal tax...

on current design, if i want to protect the 5v independent rail, i would need to put those mosfets for it... PLUS, another 2 ones for a branched 5v for the interchangeable pin in addition of the 2 mosfets for 3.3v. unless you have a better idea.



Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 8355
  • Country: fi
    • My home page and email address
Re: Reverse current blocking circuit
« Reply #18 on: June 04, 2025, 02:03:09 pm »
that PSU has fixed rails, no interchangeable rails, no changing voltage or even pins... all fixed. 5v is 5v, 3.3v is 3.3v. body diode is in reverse direction so it is blocking input current to output and only when p-mosfet is active there will be current flowing from input to output.

yes, output to input current will pass if exist but in this case it does not exist as explained.
Right.  Just make left side/VIN the output, and right side the input, and it will indeed work just fine.

Quote
To make it default off/nonconducting, add a 47k resistor between ENA and R1
you mean put a pulldown 47.5k resistor from ENA to ground, so that Q2 base is 0v by default then give it 5v\3.3v to ENA it will be on dragging Q1 gate to ground activating it.
Yes; good catch.  I edited the post to fix the missing (to ground).  You want it before R2, because if put after R2, you'd have the two resistors in a voltage divider configuration, which we don't want; we want the full signal voltage to the Q2 gate.

With Q2 being BSS138 or NX138AK (in SOT23-3; small, cheap, NX138AK my favourite N-channel logic level MOSFET), you can safely give it anything between 2.5V and 20V to pull Q1 gate to ground to make Q1 conduct.  Even 2.0V will make it conduct reasonably well.

I keep a few dozen NX138AK in SOT23 always in stock (typically buying 100 from Mouser for a few euros!), because it is very similar to BSS138, but due to smaller total gate charge, switches slightly faster.  I use it in PWM outputs and open collector buses, and in 12V PWM fan tachometer inputs, so that if I goof up and connect the fan wrong, the tachometer input can handle ±20V without endangering my microcontroller input pin; mine tend to not like voltages above 3.6V or 5.5V at all.

Quote
For 5V and higher rails, consider a dual power P-MOSFET packages like IRF9358PbF or SQJ951EP for example.  Their Rds(on) isn't great at Vgs=-4.5V, but at -9V and above, is below 20mΩ even for several amps of current (so 0.04V drop over the entire switch at 1A of current).
i guess the resistance specified in datasheet is per one single mosfet not the 2 combined, right?
Correct.  There are single P-MOSFETs with much lower Rds(on), but they take more space on the PCB.  The dual packages have somewhat higher Rds(on), but with higher voltages, let's say 9V to 20V, many have just 10mΩ or so at up to several amps of current.  Which means just 0.02V drop per amp of current over the dual switch.

I, too, tend to pick the MOSFETs I use based on datasheet specs, what is available, and the specs versus price ratio; I don't really have any favourites other than for logic-level N-channel MOSFET in SOT23 footprint (NX138AK), and even that has a very common jelly-bean replacement (BSS138) and alternatives.
I'm just a hobbyist, but thus far this has worked well for me.

on current design, if i want to protect the 5v independent rail, i would need to put those mosfets for it... PLUS, another 2 ones for a branched 5v for the interchangeable pin in addition of the 2 mosfets for 3.3v. unless you have a better idea.
Have you checked if the regulator or DC-DC converter you use has an enable/disable feature, and reverse protection?  That would eliminate the need for the switch.
Perhaps there is a similar or even an equivalent IC/part you could use, that does have an enable/disable input?
 

Offline VEGETATopic starter

  • Super Contributor
  • ***
  • Posts: 2292
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: Reverse current blocking circuit
« Reply #19 on: June 04, 2025, 11:24:19 pm »
Quote
Right.  Just make left side/VIN the output, and right side the input, and it will indeed work just fine.

this will make body diode conduct from in to out without mosfet activation, please check the circuit.

Quote
Correct.  There are single P-MOSFETs with much lower Rds(on), but they take more space on the PCB.  The dual packages have somewhat higher Rds(on), but with higher voltages, let's say 9V to 20V, many have just 10mΩ or so at up to several amps of current.  Which means just 0.02V drop per amp of current over the dual switch.

i can be ok with the extra cost and space, but still prefer if there was a better choice. the mosfets i put links for are nice.

Quote
Have you checked if the regulator or DC-DC converter you use has an enable/disable feature, and reverse protection?  That would eliminate the need for the switch.
Perhaps there is a similar or even an equivalent IC/part you could use, that does have an enable/disable input?

i contacted TI and we both agreed it was a bad idea. having EN pin controlled is ok, but it won't' protect from reverse biasing or reverse current and no buck regulator protects against shorting 2 of it at the output.... unless it is a multiphase buck which is another topic.

protection must be done in hardware and externally from buck.

________

i checked the target device and found that the version with 5v rail actually have its 5v pins not shorted together! meaning i can use a 3.3v/5v buck to the specified pin, and have the buck itself change its voltage by changing the feedback resistors via a switch.

i can put the 2 mosfet protection for both buck regulators...

if i need 3.3v, then it gets it easily directly from the buck to protection to 3.3v/5v pin.
if i need 5v, then the same buck now outputs 5v through protection to the 5v/3.3v pin, while static 5v buck outputs to 5v rail.

even if 5v pins got shorted internally, i believe nothing bad will happen to the rails as they both output 5v through protection.

Offline radiolistener

  • Super Contributor
  • ***
  • Posts: 5747
  • Country: Earth
Re: Reverse current blocking circuit
« Reply #20 on: June 05, 2025, 05:23:14 am »
To protect against reverse polarity from the power supply, simply add a relay that keeps the device’s power circuit open until the correct polarity is applied. Once the correct voltage is present, a diode energizes the relay coil, closing the circuit and supplying power to the device only when the polarity is correct.
 

Offline VEGETATopic starter

  • Super Contributor
  • ***
  • Posts: 2292
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: Reverse current blocking circuit
« Reply #21 on: August 03, 2025, 05:27:23 pm »
I finished the circuit implementation, seen in attachments.

the "latch" is for a circuit that generates the activation signal for the ideal diode reverse blocking circuit. the latch is based on 2 commands: on and off separately but only one output.

what do you think? I guess it is good.


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

- - -
-->