I want to design a circuit that can protect GPIO of the microcontroller from high voltages.the GPIO connects externally to mechanical switch.

So my approach was to use zener diode to clamp the high voltages to the low acceptable voltage.My microcontroller can accept maximum of 3.7V on the GPIO.

So the GPIO that i want to protect, has a function of detecting falling edge interrupt. below is my circuit that i have implemented.

zener implementation

In the above circuit D1 is the zener diode with R10 is being its current limiting series resistance. R45 and C36 are part of the denouncing circuit.

So the idea is when someone gives higher voltage like 12V at TP12 and TP13 by mistake, it should clamp it down to 3.0V safely.

here is the datasheet of this zener diode Link

NOTE: R44 was to limit the current flowing through the external switch connected to TP12 and TP13 whenever the zener circuit is not mounted (i.e. R10 0 ohm and D1 not populated).

questions i have is... Is this the correct way of protecting the GPIO? Have i implemented it correctly? what should i do to fix following problem?

problems i am facing...

  • The zener has leakage current and that's why when zener is in the circuit it draws 0.141mA through 10K and drops 1.4 V across 10k resulting in 1.9v on the GPIO, i want 3.3V ( VCC of the microcontroller) to appear on the GPIO. what should i do to fix this?
  • Also i selected 1K for zener so that it doesn't affect de-bouncing circuit much and also limits current through zener enough so doesn't exceeds its wattage limit.

    zener limit

    but if you look at the above image 5mA is what i should i allow through zener in order to get 3.0V. will i damage zener if i pass more current?

  • \$\begingroup\$ Instead of using a Zener diode and a bunch of resistors, why not just use 2 resistors and an opto-coupler? \$\endgroup\$
    – Ron Beyer
    Jul 25, 2019 at 12:25
  • \$\begingroup\$ Are your switch contacts connected to anything else? (If not, you already have isolation and don't need opto-isolation.) \$\endgroup\$
    – TonyM
    Jul 25, 2019 at 13:24

1 Answer 1


The MM3Z3V0T1G is designed to "regulate" to about 3.3v when 5mA is driven through it.

3.3v * 0.005A = 16.5mW typical quiescent dissipation. The package can dissipate a maximum of 300mW of power. 300mW/3.5v = ~86mA maximum sustained current.

To get 5mA to flow through it, R45 will need to be dropped from 10kΩ to ~0Ω because the supply voltage is the same as the regulation voltage... but then it will be impossible to drive the input pin low.

Try R45 = 220Ω and R10 = 0Ω. This should give >3v to the input when the switch is not active, and 3.3v/220Ω = 15mA through the switch when closed.

Reducing R45 and R10 will drastically negate the effects of C36 to "debounce" the switch. Either increase C36 or create a separate R-C filter after the zener.

  • \$\begingroup\$ thanks for your feedback. As you said R45 has to be droped to 0 ohms to get zener to regaulate, absolutely coorect. but that is not the case here, i want to regulate the voltage applied to the TP12 and TP13 pins. if they are higher i want to clamp them to 3V or 3.3V. Right now issue is , when switch is open (TP12 and TP13 open), there is arround 141uA of leakage current through zener diode dropping arround1.4 volts across it, which makes the GPIO voltage go to 1.9V instead of 3.3V. I think ill have to recalculate and change debouncing ckt values like reduce 45 and increase C36. \$\endgroup\$ Jul 26, 2019 at 10:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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