+ Post New Thread
Results 1 to 8 of 8
  1. #1
    Advanced Member level 3
    Points: 5,220, Level: 17

    Join Date
    Jul 2012
    Location
    Epping, Victoria, Australia
    Posts
    984
    Helped
    5 / 5
    Points
    5,220
    Level
    17

    Zener diode protection on MCU digital pins

    If I was to implement a small shield for an ESP32 MCU on which there were zener diodes on each pin in order to prevent over voltage (from a 5V logic sensor), then what properties in particular should I look for in the zener I choose. I was reading some where that if the zener can't pass enough current then over voltage can still occur. Is there a minimum Pd I should look for perhaps?

    •   AltAdvertisement

        
       

  2. #2
    Super Moderator
    Points: 79,227, Level: 68
    Achievements:
    7 years registered
    Awards:
    2nd Helpful Member
    betwixt's Avatar
    Join Date
    Jul 2009
    Location
    Aberdyfi, West Wales, UK
    Posts
    12,977
    Helped
    4332 / 4332
    Points
    79,227
    Level
    68

    Re: Zener diode protection on MCU digital pins

    I use ESP32s on mains detection circuits using nothing more than a potential divider to drop rectified 240V down to 3.3V. To protect the pins, I add BAT54 diodes between the divider junction and the ESP32 3.3V supply and a 10K resistor in series with the GPIO input pin. The diode prevents the voltage rising above about 3.7V, even if the mains voltage rises well above normal and the series resistor limits the current that can flow into the pin.

    The high impedance of the divider prevents very fast operation but if you are working with lower voltages the values would be lower and speed faster. If you want to use Zener clamps, I would suggest using 2.7V diodes and a series resistor from the source. My tests show the logic threshold on ESP inputs is almost exactly half VDD so anything above about 1.6V will be seen as a logic high.

    You may have to factor in the internal pull-up and pull-down resistors on some ESP32 modules, typically the reset line and GPIO0 pins have pull-ups and I think it's GPIO2 has a pull-down. Other inputs are very high impedance.

    Brian.
    PLEASE - no friends requests or private emails, I simply don't have time to reply to them all.
    It's better to share your questions and answers on Edaboard so we can all benefit from each others experiences.



  3. #3
    Advanced Member level 5
    Points: 38,991, Level: 48

    Join Date
    Mar 2008
    Location
    USA
    Posts
    6,302
    Helped
    1836 / 1836
    Points
    38,991
    Level
    48

    Re: Zener diode protection on MCU digital pins

    You want some series limiting resistance to "let the
    zener win". But series R and shunt C (zener, pin load,
    PCB) will also degrade signal edge rates, and there's
    probably a spec or a calculation of tolerable pin risetime
    to respect there.



    •   AltAdvertisement

        
       

  4. #4
    Super Moderator
    Points: 74,710, Level: 66
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    15,158
    Helped
    3448 / 3448
    Points
    74,710
    Level
    66

    Re: Zener diode protection on MCU digital pins

    Hi,

    Zener as protection device:
    https://www.edaboard.com/showthread....=1#post1628726

    Klaus
    Please don´t contact me via PM, because there is no time to respond to them. No friend requests. Thank you.



  5. #5
    Advanced Member level 3
    Points: 5,220, Level: 17

    Join Date
    Jul 2012
    Location
    Epping, Victoria, Australia
    Posts
    984
    Helped
    5 / 5
    Points
    5,220
    Level
    17

    Re: Zener diode protection on MCU digital pins

    Quote Originally Posted by betwixt View Post
    I use ESP32s on mains detection circuits using nothing more than a potential divider to drop rectified 240V down to 3.3V. To protect the pins, I add BAT54 diodes between the divider junction and the ESP32 3.3V supply and a 10K resistor in series with the GPIO input pin. The diode prevents the voltage rising above about 3.7V, even if the mains voltage rises well above normal and the series resistor limits the current that can flow into the pin.

    The high impedance of the divider prevents very fast operation but if you are working with lower voltages the values would be lower and speed faster. If you want to use Zener clamps, I would suggest using 2.7V diodes and a series resistor from the source. My tests show the logic threshold on ESP inputs is almost exactly half VDD so anything above about 1.6V will be seen as a logic high.

    You may have to factor in the internal pull-up and pull-down resistors on some ESP32 modules, typically the reset line and GPIO0 pins have pull-ups and I think it's GPIO2 has a pull-down. Other inputs are very high impedance.

    Brian.
    OK. So the schottky conducts excess voltage into the power supply.
    Assuming you have a 3.3V square wave going into a pin then what does the signal look like if you add a 3.3V zener diode to the pin?



  6. #6
    Super Moderator
    Points: 74,710, Level: 66
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    15,158
    Helped
    3448 / 3448
    Points
    74,710
    Level
    66

    Re: Zener diode protection on MCU digital pins

    Hi,

    OK. So the schottky conducts excess voltage into the power supply.
    Assuming you have a 3.3V square wave going into a pin then what does the signal look like if you add a 3.3V zener diode to the pin?
    it depends on series resistance/impedance.

    What about using a free simulation tool like LTspice?
    Then you can play around and get fastest results.

    Klaus
    Please don´t contact me via PM, because there is no time to respond to them. No friend requests. Thank you.



    •   AltAdvertisement

        
       

  7. #7
    Advanced Member level 3
    Points: 5,220, Level: 17

    Join Date
    Jul 2012
    Location
    Epping, Victoria, Australia
    Posts
    984
    Helped
    5 / 5
    Points
    5,220
    Level
    17

    Re: Zener diode protection on MCU digital pins

    Quote Originally Posted by KlausST View Post
    Hi,



    it depends on series resistance/impedance.

    What about using a free simulation tool like LTspice?
    Then you can play around and get fastest results.

    Klaus
    Might just have to do that - I am curious now.



  8. #8
    Advanced Member level 5
    Points: 14,504, Level: 29
    schmitt trigger's Avatar
    Join Date
    Apr 2013
    Posts
    2,414
    Helped
    784 / 784
    Points
    14,504
    Level
    29

    Re: Zener diode protection on MCU digital pins

    For starters; zener voltages are rated at a particular current (Izt), usually around 10 ma, but it will start conducting much earlier, feebly at first and then increasing until Izt has been reached.

    This is called the knee region. And it can create issues with in A/D ports.
    That is the reason schotkys are preferred.
    My batteries are recharged by "Helpful Post" ratings.
    If you feel that I've helped you, please indicate it as a Helpful Post



--[[ ]]--