[Teensy4.1] INPUT_PULLUP with Zener diodes

tyzjames

Well-known member
I have a simple zener diode circuit to protect the pins from >3.3v:
Screen Shot 2022-06-09 at 1.29.16 PM.png

When i use pinMode(xx, INPUT_PULLUP), the pins only reads 1.6v, which is not ideal.
When i use pinMode(xx, OUTPUT) and then write it to HIGH, the pins reads 3.3v.

If I remove the zener diode, pinMode(xx, INPUT_PULLUP) will give 3.3v.

Anyone knows why is this the case?
 
Anyone knows why is this the case?

Zener diodes, especially the ones rated for lower voltages, are imprecise and fairly crude devices. To get an idea just how bad they are, put a 1K resistor between the diode and Teensy pin and measure the voltage across is to get an idea of how much current the output pin is sourcing into that diode.

Sadly, this is just fundamentally how zener diodes are. It's tempting to think of them as having essentially zero leakage current until the reverse voltage gets to the rated amount and then suddenly they become as good a conductor as ordinary wire. But the reality is the leakage current is pretty substantial and starts to gradually increase at reverse voltages well below the rated zener voltage. And even at the rated voltage, it's still not a great conductor and isn't capable of much current until the voltage gets quite a bit higher.

The real performance of a zener looks not like a flat line which stays near zero until the voltage gets to the rated amount and then suddenly goes to negative infinity, but rather something like this:

zener.png

The higher the diode's power rating, (as a general rule of thumb) the worse this non-ideal leakage current becomes. It can also vary quite a lot with temperature changes.
 
Thanks for the information!

Is there a tried and tested way to protect the 3.3v pin from external elements, where the pin needs to have analogRead, digitalRead or FlexIO output capabilities depending on how the user configures it? The issue is that the user might interface it with another device that is using 5v.

I've found this great resource (https://next-hack.com/index.php/2017/09/15/how-to-interface-a-5v-output-to-a-3-3v-input/) but can't find any solutions that work for the pin being using for input and output.
 
Back
Top