Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Microcontroller Output protection

Status
Not open for further replies.

Andy_123

Member
Hello,

I am looking for some ideas, so I will try to give as many details as possible even some may be irrelevant to the issue.

We have a simple device based on PIC18F24K40. It produces six 5V frequency square wave signals in the range of 10Hz-30KHz.
Outputs are connected directly to the terminal block (via 0 Ohm resistors).
Device is powered by a 24V power source with a simple converter to 5V.
24V is on another the terminal.
The issue is that user sometimes accidentally connects 24V to output terminals killing the microcontroller.
In some cases it kills regulator too.

I was looking to have two diodes from the output (to GND and +5V), but I think this will just take 24V and apply it to 5V line via upper diode. I will have to somehow protect 5V too.

I was thinking to add TVS diode between output and ground, but I am not sure if this will actually be a solution, and having hard time finding one with 5V working voltage and relatively low breakout.

I can add a buffer or another IC and/or components to get protection if necessary.
PCB room and cost is not the issue as devices made in very low volume for lab use.

Any ideas appreciated.
Thank you
 
5V TVSs are rare. Stick a series resistor (ferrite bead also works) next to the pin, and then a TVS diode to GND on the side closest to the load. You don't need strictly need a 5V in this case because the resistor provides some protection and extra voltage drop while the TVS does the heavy lifting.

You can also use clamp diodes between pins and power rails to clamp to the within 0.7V of the power rail, but your supply (or decoupling caps) have to be able to handle it. These types of diodes are reverse biased during normal operation and FORWARD biased when clamping (unlike TVSs which are in reverse breakdown when clamping) You can then place a TVS between the power rails so that the power rails will try and handle it and if they can't then the TVS kicks in.

But take it from me this kind of thing only protects from spikes and surges. It won't protect against someone actually connecting a 24V source. You can't design to outwit someone who doesn't know how to use the hardware. You should just change your mechanical design (connectors etc) to prevent this from happening if it is really such a common and fatal problem.
 
Last edited:
The Pic18 series have built in clamp diodes (that can handle up to 20mA) so you just need to limit the current. Replacing the 0Ω resistors with 1800Ω will limit the current to 10mA. If you can add a suitable resistor across the 5V rails (to absorb 10mA or more) it may be adequate to protect the 5V reg as well.

Mike.
 
Thank you for ideas.
I actually need up to 20mA output with at least 4V, so 1.8K resistor will have too much voltage drop during normal operation.
But I can add 47 Ohm, will it help?
Can I add external diodes that can handle more than 20mA?
This specific PIC can handle up to 6.5V on Vdd, so will 5V TVS on Vdd combined with two diodes help?
I think I saw some 6 or 8 channel TVS that us used for USB lines.
 
A diode instead of the 0Ω resistor will give you 4.3V out and protect the circuit. Run the pic at 5.7V and you'll have 5V out.

Mike.
 
A diode instead of the 0Ω resistor will give you 4.3V out and protect the circuit. Run the pic at 5.7V and you'll have 5V out.
I have to check it, it may not work because outputs are working as push-pull (sink/source) differential pairs
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top