Power injection protection on VDD output - Page 1
Forum section: electronics / projects

author: sebmadgwick
author_rank: Regular Contributor
timestamp: October 26, 2014, 03:26:25 pm
content: I would like my device to provide a VDD (3.3V) output pin for the user (max 500 mA). The user may mistake the pin for an input and attempt to inject power; The board may or may not already be powered when they do this. I would like to protect the board from this misuse.A diode is not desirable because of the voltage drop. I'm proposing the attached circuit.Does anyone see any problems with this?The circuit also includes a MOSFET so a microcontroller can enable/disable the user VDD but this is not related to the protection.

author: bktemp
author_rank: Super Contributor
timestamp: October 26, 2014, 03:34:31 pm
content: A bipolar transistor does not work as a diode replacement:- It conducts current in reverse direction (but with a much lower current gain)- The base-emitter diode breaks down at about 9V

author: sebmadgwick
author_rank: Regular Contributor
timestamp: October 26, 2014, 04:01:34 pm
content: Quote from: bktemp on October 26, 2014, 03:34:31 pmAre you saying that current will flow from C to E? Can you elaborate on this? Is this characteristics normally documented in datasheets?Quote from: bktemp on October 26, 2014, 03:34:31 pmI am not attempting to protect from reserve voltage injection so this is not a problem. I only want to prevent current flowing from USER_VDD into VDD.

author: Fraser
author_rank: Super Contributor
timestamp: October 26, 2014, 04:02:29 pm
content: My HP LogicDart logic analyser uses a series diode to protect its Voltage output pin. If its good enough for HP, its good enough for mebut I understand your concern over voltage drop.Output protection can be difficult when dealing with a direct access pin on a SBC, micro or similar....it is better to buffer it in some way such as a DC to DC converter.The user can accidentally inject a voltage, inject a high voltage or inject a reverse polarity voltage....all not nice for a micro that is trying to output a certain voltage and polarity.Aurora

author: bktemp
author_rank: Super Contributor
timestamp: October 26, 2014, 04:20:01 pm
content: Quote from: sebmadgwick on October 26, 2014, 04:01:34 pmYes, current flows from C to E. Since this is not intended for normal operationen, it is typically not mentioned in datasheets. But it is well known:http://en.wikipedia.org/wiki/Bipolar_junction_transistor#StructureQuoteWhen somebody appies 12V at the output, the C-B diode is forward biased. The E-B diode now is reverse biased at about 8V, but it is only rated for typically 5V.

author: sebmadgwick
author_rank: Regular Contributor
timestamp: October 26, 2014, 05:06:24 pm
content: Thanks for the explanation, bktemp. I built the circuit and have seen this for myself. I've been thinking and Googling for a while and I'm beginning to think that is no quick fix for protecting a VDD output from injection. Solutions involving DC-DC converts or similar are a little too complex/costly for my liking.Quote from: Aurora on October 26, 2014, 04:02:29 pmIf there was a quick fix, I assume HP would be using it. I guess I'll have to put up with the voltage drop.

author: Fraser
author_rank: Super Contributor
timestamp: October 26, 2014, 05:50:24 pm
content: Use a suitable Schottky diode for lower forward voltage drop of only 0.2VAurora

author: T3sl4co1l
author_rank: Super Contributor
timestamp: October 26, 2014, 09:14:16 pm
content: You can use an active diode-OR circuit; many devices are available, I don't have a part number handy to suggest.There are also USB/etc. power switch devices, though they usually allow backflow for much the same reason your MOSFET switch will do so.You could also use a flipped MOSFET so it normally feeds the output with the body diode, then gets enhanced by biasing the gate so the voltage drop is small. Then if current reverses (you'd need some sort of sensor to detect that), the gate is turned off and current goes away. This can be combined with your power switch by using two MOSFETs back-to-back.Tim

author: Alex Eisenhut
author_rank: Super Contributor
timestamp: October 26, 2014, 10:02:36 pm
content: Quote from: T3sl4co1l on October 26, 2014, 09:14:16 pmThey're called ideal diode controllers, but I recall a particular part that also monitored over and under voltages. I'll post it if I find it again.

author: sebmadgwick
author_rank: Regular Contributor
timestamp: October 27, 2014, 12:08:28 am
content: Quote from: T3sl4co1l on October 26, 2014, 09:14:16 pmQuote from: Alex Eisenhut on October 26, 2014, 10:02:36 pmTheseseem to bethe same thing. Given that the MOSFET would have a voltage drop for current in either direction, could a simple ideal diode controller be created from just comparator on the drain and source?

author: David Hess
author_rank: Super Contributor
timestamp: October 27, 2014, 12:44:25 am
content: It may be a little more complicated than you want but check out the input protection that they included with the Raspberry Pi B+:https://learn.adafruit.com/introducing-the-raspberry-pi-model-b-plus-plus-differences-vs-model-b/power-supplyhttp://robotics.ong.id.au/2014/07/30/raspberry-pi-b-power-protection-circuit/The same may be done with more accuracy using a comparator or operational amplifier and the MOSFET.

author: sebmadgwick
author_rank: Regular Contributor
timestamp: October 27, 2014, 02:19:21 am
content: Thanks for sharing the link, David. This is very helpful. Is their use of current mirror type circuit simply more cost effective, or does it have other advantages over the op-amp or comparator alternatives you have suggested?I anticipate an op-amp would run into problems if power is being injected while the op-amp is not powered. A pull-up and open collector comparator would be more reliable. I've attached a schematic.

author: Riotpack
author_rank: Regular Contributor
timestamp: October 27, 2014, 03:08:45 am
content: Drive a mini relay with a transistor to switch the output? you can add a 0R fuse resistor and zener + reverse bias diode to protect the supply rails if reqd.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: October 27, 2014, 04:57:27 am
content: I drew this up quite some time ago,if you're into that discrete kind of thing. It would have to be rearranged for the present case, but that's a simple PNP/P-channel inversion.Note that comparator offset acts as positive feedback (it stays off for small positive voltage drops (and oscillates), or stays on for small negative voltage drops), and delay acts as forward/reverse recovery.Tim

author: sebmadgwick
author_rank: Regular Contributor
timestamp: October 27, 2014, 09:22:27 am
content: Quote from: T3sl4co1l on October 27, 2014, 04:57:27 amAre you referring to your circuit, my circuit, the Pi circuit, or all three?The comparator offset could be an issue in my circuit. Injecting power on VOUT when VIN is is not powered would not be an issue. If only VIN is powered then the voltage drop across the MOSFET may be too low relative to the comparator offset for the comparator to stay on and it would oscillate. The same oscillation would occur if both VIN and VOUT were powered.

author: David Hess
author_rank: Super Contributor
timestamp: October 27, 2014, 12:57:39 pm
content: Quote from: sebmadgwick on October 27, 2014, 02:19:21 amI think their decision was based on cost and simplicity. As you point out, using an operational amplifier or comparator requires attention to powering the IC and common mode input requirements also need to be handled. An operational amplifier or comparator would be the best choice for lowest power operation.QuoteOscillation can be prevented by either adding hysteresis or proper frequency compensation. I have not checked it in detail but in the Raspberry Pi circuit shown, I think the later is handled by the high output impedance of the comparator and the large input capacitance of the MOSFET.The offset voltage and MOSFET Rds(on) issue is interesting and one of the reasons that a comparator or operational amplifier might be better because of their lower input offset voltage. I wish monolithic or matched transistor pairs were more available. The DMMT5401 shown does not really count but the similar NXP PMP5201, PMP5501, BCM856, and BCM857 do; their 2mV maximum offset makes the discrete version very workable.One change I would consider in the discrete implementation is using a current mirror as an active load which would both raise the switching gain and lower the quiescent power requirements.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: October 27, 2014, 01:00:56 pm
content: Quote from: sebmadgwick on October 27, 2014, 09:22:27 amAll three. They're all based on the same concept, of course. The difference is, in mine the comparator is implemented with a couple transistors, and optimized somewhat for speed and voltage range; in Stephen Ong's case, using a modified current mirror circuit that will give reasonable voltage accuracy (taking a current mirror and driving a voltage between the emitters will act as a low input impedance differential amplifier, so the on/off range is not much beyond +/-60mV), slow speed (depending on how big the gate capacitance is, it will be pokey at best) and minimal parts count. It's noteworthy that, if the reverse bias exceeds about 5V, U14a's B-E junction will avalanche and dump current back into the supply -- a fragile place to dump a voltage source, so D5 is kind of... not optional. (My circuit addresses this by operating the sense transistors in inverted mode, which gives poor gain, hence the higher parts count.)QuoteIf the voltage change is quick, it will cross the threshold region quickly enough that it's not able to oscillate more than a fraction of a cycle, i.e., it doesn't. A comparator is guaranteed to oscillate, because it is not unity-gain stable, let alone with whatever gain and phase shift a MOSFET may exhibit (which needn't be much, since we're talking triode region here -- low gain, resistive characteristic -- that tends to make it easier to stabilize).My circuit isn't made for gradual changes, and though I don't think it will oscillate at a large amplitude, it will probably bump around a little. A resistor from B-E across the complementary emitter follower could help that, or by adding two diodes between the bases (biasing the follower). (In other words, it's simply not made to be linear for small signals, but that can be fixed easily.)As for how much range you get incorrect behavior, that's simply the comparator offset, and the current is Rds(on) * Vos. With typical being a few milivolts, that's not much. The crossover range of these discrete solutions will be much wider (~60mV as I said before), which depending on where it's biased, will look like forward or reverse recovery, except at DC (as little sense as that makes).Tim

author: sebmadgwick
author_rank: Regular Contributor
timestamp: October 27, 2014, 03:57:25 pm
content: Oh dear, it feels like I'm moving further away from a solution.As I said, an op-amp would not work because it would need to be powered. Now it seems that an open-drain comparator will not work reliably because the non-linear feedback loop will cause oscillations (due input offset voltage). I would not have enough space for a discrete solution. This means I'm left with a circuit like used on the Pi (using matched transistors as suggested by David Hess).Quote from: T3sl4co1l on October 27, 2014, 01:00:56 pmGood point. I'm currently using anIRLML6401PBFwhich indicates a Drain- Source Voltage of -12 V. The Zener could be avoided so long as the injected voltage does not exceed 12 V.I'm struggling the understand the details of how the Pi circuit (attached) operates.If Vin is 0V and Vout is 5V, then the base of U14b is pulled low by R2, which saturates U14b so that the gate voltage is ~5V and the MOSFET is off. Current therefore cannot flow from Vout to Vin.If Vin is 5V and Vout is <5V, then the mirror will try to adjust U14b so that the current through R3 is equal to R2. The only way the current can be matched is if the Vout reaches 5V, this cannot happen but U14b saturates in attempting to do so.... oh dear, this means the MOSFET is off again but we want it to be on.Clearly, I've misunderstood something.

author: bktemp
author_rank: Super Contributor
timestamp: October 27, 2014, 04:39:25 pm
content: Since both base pins are connected, the transistor with the most positive emitter voltage switches on: Under normal conditions Vin is a little bit higher than Vout, therefore U14a is switched on and U14b is switched off and R3 pulls the gate to GND. Since the voltage gain of the transistors is limited, there is a transition region where both transistors are equally conducting leaving the mosfet half switched on. But a voltage drop across the mosfets leads to either completely on or off state.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: October 27, 2014, 05:23:13 pm
content: Quote from: sebmadgwick on October 27, 2014, 03:57:25 pmWell, it doesn't have to be much. R2R amps with 10uA current draw are available (if slow). That can be sourced from either side -- but really, you have a built-in diode in one direction, so the output side will never not be powered when operating normally (Vo < Vin), and is powered in the overdrive case (Vo > Vin) independent of the input. So, it can draw from the output and everything's happy.QuoteIt's not bang-on-bang-off oscillation, more of a theoretically bothersome nitpick. Unless time constants are severely mismatched, the output ripple amplitude should never be more than 10s of mV. You get worse DC performance in the discrete case (maybe 60mV "maybe still on or off" range either side of zero). Which is still better than a diode (300mV+), so it's still a win.QuoteIt's only a mirror if the difference is zero, i.e., the bases and emitters are tied. In that case, part B will nearly saturate and you'll be in the sweet middle range where it's just starting to turn on (for Vo <= Vin).In the extreme case, say for more than 200mV mismatch in either direction, the opposing transistor is essentially completely off, and either the 47k draws base current from part B as a saturated switch (Vo >> Vin), or part A shunts that current into the Vin supply and part B remains off (Vo << Vin).It's a physical consequence that semiconductors near room temperature do their thing give-or-take 25mV or thereabouts. If you have a transistor that's linearly biased, then if you change the base voltage by 25mV up or down, the collector current will about double or halve, respectively. And so on. So that by 200mV down, the collector current is < 2^8 times lower (<1% of what it was). For this reason, you can figure what's going to happen to a current mirror for small emitter offsets: it behaves just like a differential pair (i.e., two transistors with the emitters shorted and a small difference at the bases), so that an emitter offset of maybe 25mV will give you about a 1:2 or 2:1 mirror, depending on polarity.Tim

author: sebmadgwick
author_rank: Regular Contributor
timestamp: October 29, 2014, 02:20:40 am
content: Quote from: bktemp on October 27, 2014, 04:39:25 pmAhh, its obvious now. The emitters and bases of the PNP transistors effectively form a pair of common-cathode diodes; current will only flow through the diode with the highest anode (emitter) voltage.Quote from: T3sl4co1l on October 27, 2014, 05:23:13 pmYou are right, I was analysing the comparator as a bang-bang controller. I would be interested to understand a more detailed analysis of the comparator closed-loop response but I expect this would end up having little practical relevance.I'll order some parts and test these circuits. Thanks for your help.

author: David Hess
author_rank: Super Contributor
timestamp: October 29, 2014, 09:14:52 pm
content: Quote from: sebmadgwick on October 29, 2014, 02:20:40 amSome comparators can be externally frequency compensated for linear operation to replace operational amplifiers. For example this is sometimes done with the LM339 quad or LM393 dual comparator when they need a low performance operational amplifier and have a spare comparator.The same thing can be done with operational amplifiers when driving capacitive loads which would otherwise cause oscillation. A large aluminum electrolytic or solid tantalum capacitor directly on the output can be used for compensation.

author: sebmadgwick
author_rank: Regular Contributor
timestamp: November 04, 2014, 03:22:22 am
content: I built thecomparator circuit I suggestedand now see that this design fails to account for the comparator's internal clamping diodes on the V+ and V- inputs.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: November 04, 2014, 03:36:13 am
content: Quote from: sebmadgwick on November 04, 2014, 03:22:22 amHmm, the inputs are also reversed... didn't spot that earlierYeah, you'll need input divider resistors or an "Over-The-Top" (Analog TM I think?) or similar type to do the job, or an aux supply.Tim

author: David Hess
author_rank: Super Contributor
timestamp: November 05, 2014, 08:42:55 pm
content: Quote from: T3sl4co1l on November 04, 2014, 03:36:13 amI have occasionally seen zener diodes or shunt references used to do the level shift but offset voltage suffers as it does with mismatched resistor dividers. The loss of gain when using resistor dividers can be overcome by using transistor cascodes.Linear Technology has the Over-The-Top trademark with their LT1716 being a good match for this application. I did not find any comparators from Analog Devices like that. They have high input voltage tolerant ones but their common mode input range is still restricted.

author: sebmadgwick
author_rank: Regular Contributor
timestamp: November 10, 2014, 11:01:30 pm
content: The parts finally arrived and I'm playing with the circuits. I thought I'd start by making an 'ideal OR diode' to allow two power supplies to be connected to a device simultaneously without risk of current 'going the wrong way'. Rather than build two of the previously posted circuits, I tried to create the same functionality with fewer components. See attached.The circuit seems to work as intended except that if both supplies are at an approximately equal voltage (within a few tens of mV), both FETs switch off. I can see that this is to be excepted if both voltages were exactly equal but I did not think the circuit would be this sensitive.I would be grateful for some tips on how to better understand the circuit. How can I determine this voltage difference analytically (i.e. from datasheet characteristics)?EDIT: oops, it doesn't work. Current does go the wrong way. Back to the drawing board.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: November 11, 2014, 03:50:52 am
content: The difference is, no collector is tied to base, so it won't mirror the current; you're in beta=1 saturation, so there will be a huge dead zone (+/-30mV?).Tim

author: sebmadgwick
author_rank: Regular Contributor
timestamp: November 11, 2014, 04:03:27 pm
content: For those interested, I have put together a simple PCB for the previously posted ideal diode circuit. It is available to purchase (unpopulated) from OSH Park viathis permalink. The price is $1.25 for 3 boards.All the design files are available ongithub. I've attached some images.