I have a switch input that I need to protect from miswiring to 12V battery power, reverse wiring to power, ESD and transients.

I tried using a Zener diode circuit to handle the overvoltage:

Steering Diodes with Zener Protection Circuit Steering Diode with Zener Protection Circuit Simulation

The problem is that the "saturation" current of the Zener diode is high enough (3mA at 5.1V) that it "leaks" too much current for the 10k pull-up resistor to keep up with. So instead of being pulled up, the signal is stuck low: Zener diode pulling all the pull up current

Lowering the pull-up resistance enough that it could keep up with the Zener didn't work. It created a voltage divider with the 300 ohm reverse current limit resistor, so it wouldn't get a good logic high.

I noticed that the current always flows outward since this is a switch, so I tried using a regular diode on the signal line instead of the Zener:

Unidirectional Diode Protection Circuit Unidirectional Diode Protection Circuit Simulation

This seems to work in the simulation, but I haven't seen it done before. Are there any reasons not to use an inline diode to protect an input?

The diode shouldn't interfere with normal operation because current always flows from the pull-up resistor out to the switch. It is a Schottky diode so the voltage drop is small enough to not exceed the maximum for a logic low level (0.8V).

  • 2
    \$\begingroup\$ an open-drain input? \$\endgroup\$
    – Hearth
    Jul 28, 2021 at 1:12
  • 1
    \$\begingroup\$ There's some very confused terminology going on here... "open-drain input", "Current should only flow ... through the switch to drain", etc. Also your diagram is unclear as to how that zener is actually connected. \$\endgroup\$
    – brhans
    Jul 28, 2021 at 2:33
  • \$\begingroup\$ @Hearth I edited to use the right terminology. I thought "open-drain" could refer to any signal that uses pull-up resistor \$\endgroup\$
    – Luminaire
    Jul 28, 2021 at 2:57
  • \$\begingroup\$ @brhans yeah the circuit tool I use doesn't put the little wire bumps in. The way you tell is that intersections of 3 or more wires will have a white circle if they are connected, and no circle if they are not connected \$\endgroup\$
    – Luminaire
    Jul 28, 2021 at 2:59

1 Answer 1


If I get it correctly your issue is to avoid the input to be 'sensed' when the polarity or some other protection trips…

The diode approach is not wrong in itself but think about the breakdown voltage you would need in each condition.

Your approach is a good start. A good way to improve resilience to various kind of noise is to require some current in the terminal (if possible). The ultimate solution of course is the optocoupler (which sometimes can be cheaper than a complete protection network).

MCU inputs are CMOS based so they would have leakage on the nA order. This could cause issues with leakages, as you have seen. However if you put the cheapest PNP BJT before it, for example, you have solved two huge problems:

  • ESD and transients are way less problematic, a bipolar component as ruggedness is second only to a piece of wire;

  • Depending on the base resistor you will require some 100µA or some mA of current to actively flow to switch the input, so most capacitively coupled noise is defeated;

As a bonus the B-E junction is already the diode you wanted to use for protection.

Also be wary of the effective clamp rating of your zener/tvs: the very popular USBLC6 has a standoff voltage of 5V but a clamp voltage of 12-17V (depending on the severity of the transient). That could overstress the clamp diodes of the MCU (check the rating on the datasheet).

Another thing, more on the 'functional' side of the thing: using an RC filter produces a slow signal, check that your MCU handle that without oscillations or oversinking: CMOS inputs don't exactly like intermediate voltages, if you can configure a schottky trigger on the input that would be the best course of action


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.