Output pin overvoltage protection

New Member
2012/04/11 17:25:41

Hello.  I'm working on some circuits that provide output to the user via some PIC digital out pins.  So there's a chance the user could connect an over or under voltage (worst case by design is +15/-15V to a 5V PIC) directly to the output pins.  Would a simple 1k current limiting resistor be adequate for damage protection?  Failing that, how about a 5.1V zener connected to the output pin?  Or will I have to consider something less simple like an opto-isolator or switching transistor?
Super Member
Re:Output pin overvoltage protection 2012/04/11 17:38:22
The best way to stop that is by using a header that can't be put in the wrong way, especially when the input could be +ve or -ve.

An example of one of these is:


New Member
Re:Output pin overvoltage protection 2012/04/11 17:49:15
Thanks for the reply.  I should have been more specific.  The PICs will be providing signals directly to several banana jacks in an instrument panel.  Thus, a user could mistakenly plug the output of some other jack (which could be +15/-15V) into the output pin of the PIC via this connection.
Super Member
Re:Output pin overvoltage protection 2012/04/11 22:31:57
In the case of an "instrumentation" pannel construction: use the transistor solution. These additional electronics will cost next to nothing compared to the bananajack's and pannel costs, and it will safe you the hassle of finding why the **%&** thing has broken down. Again. Twice. This day. You may not wish to protect against grid connection by accident, but don't limit yourself to the voltages you supply from your device, just because that's what you supply.
New Member
Re:Output pin overvoltage protection 2012/04/12 13:15:32
Indeed.  But you've got to draw a line somewhere as to what possibilities you're going to foolproof against and what not.  And the line I've drawn separates the unit itself from the rest of the world.  I think that's pretty reasonable considering I'll likely be the only user.

Specific question I haven't found a satisfactory answer for:  What happens internally when an over/undervoltage is applied to a I/O pin configured as an output?  

The consequence is more or less clear when the pin is configured as an input.  The protection diodes begin to conduct and the chip is safe (barring some unexpected behavior perhaps) if the current generated is less than about 20mA.  However, I've been led to understand that any over/undervoltage whatsoever, even if current-limited, will damage an output pin and probably the chip.  Is this correct?
Super Member
Re:Output pin overvoltage protection 2012/04/12 23:03:20

  "If you build a product that idiots can use, only idiots will use it"

  The maximum output current is 25 mA (for the 18F8722) - Connecting -15V to the input with 5V on the pin would cause a high output current. If the input you are sending the digital output has a high enough input resistance, you could get away with putting a 1k resistor on the output (so that a negligible voltage drop occurs during normal usage) - This would mean that you will get a maximum of 20mA being drawn from the I/O pin, which theoretically won't kill your PIC (make sure that the resistor is a half watt).    As for the +15Volts, I'm not sure what will happen, because I don't know enough about the architecture of the PIC in output mode.  I am thinking that you might get away with it, but be warned, it's only a guess... 15mA is a lot of current in the microcontroller world.

  The best solution would be to manage the problem on a mechanical level - This might mean that the cables are made too short to reach from the +-15V to the PIC; or having all the inputs on one side and all the outputs on the other;  Maybe physically connecting one side of the banana jacks; Maybe using a colour scheme...

New Member
Re:Output pin overvoltage protection 2012/04/13 19:19:47
Well, I'll be building this for just one idiot: me :)  From what I know, the PIC output architecture is basic CMOS: while the output is high a PMOS switch to Vdd is turned on with a low voltage at its gate and an NMOS switch to Vss is turned off with a high voltage at its gate, vice-versa while the output is low.  So would an adequate analysis of the situation be simply taking the worst case voltage difference (output high/-15V (accidentally) connected to output pin or output low/+15V connected) and the series resistance of the connection (in my case 2k, since all outputs will have 1k in series for protection) and making sure the current is less than the absolute maximum?  Or am I missing something?  I haven't found a definitive answer through considerable googling or, even, soul-searching, and I'm not sure I'm willing to trust such a seemingly clueless analysis without more insight.  But, one thing I do not want to do is over-design my little project.  Only over-think it.  So if a 1k series resistor will do, that's what I'll use.  Otherwise, well...  Anyway, shouldn't such a basic question have an answer that's more widely disseminated?  How do I protect my output pins from the world?  The answer eludes me.

BTW, a mechanical means of discouraging the wrong connection is pretty much out of the question.  There are over 100 jacks on this thing, all grouped together according to function.  The ability to route any output to any input is part of its flavor.  I have however color-coded the banana jacks: input or output.
Super Member
Re:Output pin overvoltage protection 2012/04/15 16:27:15
Ok, so let me explain my answer a bit more...

When your output is +5v and you have connected -15V to the input, and let's say you have a 1k resistor between the pic and the input pin.  The current will be:

V/R = (5-(-15))/1000 = 0.02 amps = 20mA going out of the PIC 

Power dissipation = V^2/R = 20^2/1000 = 0.4W = 400mW

This would be ok

The next problem is +15V -> With +5V on output, using Ohm's law again...

A = 0.01 = 10mA going into the pic -> And the fact that the current is going into the pic is the problem...

Likewise, when 0V is being applied to the output, A=15mA going into the pic.

If you wanted a solution to this, you can use a fuse and crowbar circuit.  This is a circuit that you see in industry all the time to protect devices from over voltage.  You can search the web for some examples, but the basic idea is using a SCR and a voltage divider circuit - When the voltage on the gate gets high enough, the SCR gets turned on.  This leads to the input current rising - When the current gets high enough, a fuse is broken.

Basically, when the input voltage gets too high, it triggers a circuit to break an fuse.

Dave Mueller
Starting Member
Re:Output pin overvoltage protection 2012/04/15 17:55:22
How about a Schottky diode in series with the output?  .5V or less drop, guarantees against current flowing into the pin if the applied voltage is higher than your logic state output.  If the applied voltage is lower, then the PIC sources current into the external device.  But if it's too high, you blow the diode instead of the PIC (pick one with a really low If).
Super Member
Re:Output pin overvoltage protection 2012/04/15 19:44:32

Diodes don't blow because of over-voltage directly - They pass something called the reverse break down voltage which causes very high current to pass through it - It's this current that makes it blow - And if your PIC is on the receiving end of this, it will be also damaged.  However, you should be ok at 15V (unless it gets very hot).  

From memory, Schottky's are known for their dodgy leakage current - Might be worth considering, as that is the direction that you want to stop the current flow...  Remember that "real" diodes and "ideal" diodes are different.

The forward voltage drop is at a rated current - It might be worth looking into how they behave in your circuit during normal operation (I've been stuck by digital level problems with digital signals through a diode). ie. The logic high voltage is no longer high enough...

Super Member
Re:Output pin overvoltage protection 2012/04/15 20:08:23
It would be useful to get more information before coming up with the idea solution. I understand that the signals go from the PIC to the output world but what and how are they used? Do they go into something with a high input impedance? Do they sink current? Do they source current? both? What are the logic levels for the device it is connected to? etc etc? Can you provide more information?
New Member
Re:Output pin overvoltage protection 2012/04/16 14:51:36
First off, thank you all for your help and suggestions.  

Now a newbie question: according to the data sheets the PIC I'm using is capable of sourcing and sinking up to 25mA on its I/O pins.  Wouldn't an overvoltage fall under the current sinking case?  I mean, if I apply +15 volts to an output pin at ground through a 1k resistor, why wouldn't the PIC be capable of sinking the 15mA or so of current generated? 

If there's a simple solution that works, and doesn't require the destruction and replacement of some sacrificial component (like a fuse) in case of a fault, I'd be very pleased with it.  With that in mind, there will be voltages between -15 and +15 available on the panel, so I'm expecting they'll find their way into the wrong place at some point.  But beyond these extremes, I'm not worried about protection.  As careless as that may sound.  So if the PIC outputs absolutely cannot handle the overvoltage in question, then David Mueller's suggestion sounds agreeable.  I'll be using some BAT43 schottkys elsewhere in my project.  200mA max forward current,  30 volts max repetitive peak reverse voltage, 1/2 microAmp max reverse leakage current at 25 Celsius (though much more as the temp increases) .  Would these do the trick?

Brick, this project is just a collection of electronic music circuits integrated together.  Basically a synthesizer.  One PIC is used as a MIDI interpreter and outputs, among other things, a GATE and TRIGGER signal.  They are meant to be input into various comparators (generally just TL071 type opamps configured as comparators with an arbitrary threshold) to set off events like envelope generation and what not.  But, like I mentioned, I don't want to limit the usability of any of the outputs.  So I'd like it if they could be routed to any input.  All I can specify really is that all inputs on the panel will be high impedence and will probably sink current from high level logic .  The other PIC is used to find the pitch of an incoming signal.  It outputs a logic high to the panel when the amplitude of the signal rises quickly and a logic low when a stable pitch is found.  So same deal there.  I realize this is all very general, which is part of the design, I guess, but I'm hoping I can find a solution of equal generality.

post edited by kvnrydberg - 2012/04/16 14:54:30
Super Member
Re:Output pin overvoltage protection 2012/04/16 16:24:38
Ok, if thats the case then I would add a resistor to the output of the PIC which goes to the outside world. Adding a transorb is always a good idea and low voltage drop clamping diodes would protect from overvoltage or reverse voltages.