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 Diode with Zener Protection Circuit Simulation
- Zener Diode BZX84-C5V1,215
- 300 Ohm Resistor RMCF2512JT300R
- Steering Diodes BAT54SW,215
- PIC Microcontroller PIC16F1718-I/MV
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:
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 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).