Today I had a luck to kill my STM32F3discovery through connecting pin to +18V and this trouble made me think about protection from such situation in the future. I've found this protection of inputs using diode and zener diode. enter image description here

So, I'm wondering about such protection for protection pins in such cases:

  1. Input pins, low spees(like a button)
  2. Output pins, low speed(like a led)
  3. Input pins, high speed
  4. Output pins, high speed(especially, PWM)

Maybe someone knows integrated solution?


1 Answer 1


The protection circuit you linked to should work fine for both high and low speed I/O. You might even get away with just a Zener diode and resistor, as the Zener will act as a diode for negative voltage. However there are a couple of caveats:-

  1. Low voltage Zeners tend to have quite high impedance and a soft 'knee', so the clamp voltage may vary significantly with sink current. To protect against +18V with a 100 Ohm resistor in series the Zener must pass ~140mA. The 1N5913B is a 3W 3.3V Zener with Izt of 114mA, which should be sufficient. However it still draws significant current at somewhat less than 3.3V, which might affect a sensitive analog circuit.

  2. If -18V was applied the Zener would have to pass about 170mA and could drop over 1 Volt. Putting a diode across the Zener relieves it from having to handle high negative current. A Schottky diode is best because it has fast response and lower voltage drop than a silicon diode.

An alternative to the Zener is a PNP transistor acting as an active clamp. The transistor would shunt over-voltage current to Ground, and clamp the I/O pin to about 0.6V above Vcc. (to protect against negative voltage you would still need a diode).

Transistor Clamp

For I/O that doesn't mind high series resistance you could simply use a higher value resistor and put clamp diodes to Vcc and Ground. Using a 2.2K resistor the application of +18V would inject less than 10mA into Vcc, which should be safe if the MCU etc. draws more than this (if not then you could put a 3.3V Zener across the 3.3V supply).

  • \$\begingroup\$ The Transistor solution is good for my case (a button input with pull-up resistors) since the Zeners tend to leak enough current to overwhelm a pull-up resistor. \$\endgroup\$ Oct 24, 2021 at 0:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.