Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 13 of 13

Thread: Over voltage protection for analog input on Teensy 4.1

  1. #1
    Junior Member
    Join Date
    Jul 2020
    Location
    Melbourne, Australia
    Posts
    1

    Over voltage protection for analog input on Teensy 4.1

    Hello all,

    First time poster and a newbie to the Teensy range!

    I've recently picked up two Teensy 4.1 boards to work on a project where I hope to bring multiple 0-5V sensors on a car (temperature, pressure etc) into the Teensy and broadcast these over a CAN bus to other devices.
    Reliability is key for this application so I want to ensure that I do not accidentally supply more than 3.3V to any of the analog inputs and end up damaging the board.

    As I mentioned above, the signals I am dealing with are typically 0-5V, so I will need to use a voltage divider to bring the 5V input down to 3.3V at the analog input pin.
    My current approach is to set R1 and R2 to 2.4K and 2.2K respectively, meaning I can have Vin at up to 6.9V without Vout (to the analog input pin) exceeding 3.3V.
    I will connect a 10nF capacitor between Vout and GND to reduce noise.

    While the voltage divider will keep the expected input voltage range within safe limits, I need to provide some protection against accidental application of voltage in excess of the 0-5V (or 0-6.9V as described above).
    I've seen a few approaches to achieve this, the most simple of which appears to be use of a 3.3V zener diode between analog input pin and ground.

    Does this approach sound reasonable/sufficient or am I missing something obvious here?

    Really appreciate any advice which can be provided and apologies for my basic skill level!

    Regards,
    Cal

  2. #2
    Senior Member
    Join Date
    May 2015
    Location
    USA
    Posts
    560
    Input protection is important to avoid teensy damage. I would use a BAT54S diode to 3.3V and to ground.

    Or maybe SDM40E20LS for better protection.
    Last edited by jonr; 07-03-2020 at 02:46 PM.

  3. #3
    Member MorganS's Avatar
    Join Date
    Apr 2015
    Location
    Northern Nevada
    Posts
    63
    I'm moving away from using the BAT54S diodes. The microcontroller chips all have diodes inside them that are intended to damp voltages higher or lower than the supply rails. The specifications on those diodes are difficult or impossible to find. (I haven't looked in the Teensy 4 datasheets but older ones didn't have that data.) With that diode protection behind a voltage divider resistor, you are pretty well protected against almost all problems.

    So, what doesn't it protect against?

    1. A "5V tolerant" microcontroller doesn't have the diodes. Use a BAT54S for that. This applies to Teensy 3.5.

    2. There may be a fault which flows enough current into the power supply rail through the protection diodes that the voltage on the rail goes up and cooks something else. With reasonable voltage divider resistors in the kilo-ohm range this is unlikely but if you didn't have those resistors then this could be a problem.

    3. Extremely fast rise-time voltage spikes. This means static electricity. Like you walk on nylon carpet and then reach out to touch any cable or any part of the casing of your project, a spark can jump to any wire and that spark can be 10,000V.

    The best protection against #2 and #3 is a TVS diode. I use the SP4020-01FTG-C on all my 3.3V projects. This is absolutely magic at stopping static electricity. It can't handle sustained faults, like directly connecting 12V but you've got those voltage divider resistors there which will limit the fault current to a reasonable level. It's also a bidirectional device so it doesn't matter which way around you install it and it doesn't matter if the fault is plus or minus 12V.

  4. #4
    Since the analog inputs work best with a low impedance driver, I like to use a rail to rail op amp that is powered by 3.3V, so it can never output a higher voltage than the teensy can take. there are some precision op amps which are designed for driving SAR ADCs but at lower bit depth like the teensy, a popular one to use is the MCP600x.

  5. #5
    Senior Member
    Join Date
    Mar 2015
    Location
    UK
    Posts
    364

    iMX RT1060 Data Sheet

    A very interesting question - the protection of Analog inputs by NXP.

    Searching the NXP web site today, the iMX RT1062 is not listed (?), but the iMX RT1060 and iMX RT1064 are listed. Both have a Fig 35 in the data sheet (see https://www.nxp.com/docs/en/nxp/data...XRT1060CEC.pdf) and this indicates two internal diodes with a note of two current sources representing leakage current (presumably that leakage from the reverse biased diodes). It also shows three graphs for values of "Ras" in order to meet the settling time required.

    The diagram of Fig 35 shows a point in the input circuitry called VADIN (and marks this as plus and minus). I interpret this as being the point of the chip pin. Anything to the right hand side is inside the chip and anything to the left is outside the chip. So Vas, Ras and Cas are all associated with the SOURCE feeding the chip pin. So Ras is also OUTSIDE the chip.

    In Fig 38, the graph shows that a Ras of 8KOhms will provide for a settling time of less than 1.2 uS. I am assuming that HSC and LSC are register settings for high speed and lower speed conversions.

    Now if a series resistor is connected external to the chip, lets say for argument 10K, then the max voltage of Vas that can be applied to the "left side" of such a 10K resistor will be substantial and still able to keep the point VADIN "not above" 3.6 volts (the stated absolute maximum). It depends on what the diode voltage drop will be when the input is taken above the upper rail voltage of 3.3 volts. There is only a 0.3 volt headroom, so the current in the upper diode cannot be very much, but if this was a schottky type diode, then it could be as high as 1 mA before 0.3 volts was reached. If true, then for a 10K series resistor, this would allow 10 volts across the resistor making the allowed value of Vas be 10v + 3.6v = 13.6 volts in total.

    You cannot apply 5 volts directly to an analog input, for this will cause a lot of damage to the internal diode (and much more besides), so the chip is NOT 5v tolerant in any sense. But with a series resistor connected to an analog input pin, then maybe the chip will survive a high voltage less than 13.6 volts as the true input voltage?

    Has anyone got the audacity to test this theory in practise? :-)

    Edit: Be careful !!! Don't believe your digital voltmeter. Make sure you calibrate it against a known standard such as MAX6350 before you rely on its readings.
    Last edited by TelephoneBill; 07-15-2020 at 12:20 PM.

  6. #6
    Senior Member
    Join Date
    Mar 2015
    Location
    UK
    Posts
    364

    Stop press

    Woah - hold everything...

    It does NOT look like there are internal diodes such as Fig 35 suggests. The assumption that all to the right of point VADIN was internal is NOT correct as far as my experiment a few minutes ago has indicated. Either this, or if they are there, then they are not of a Schotty type.

    I have just done a few very precise measurements on Teensy 4.1. I connected a 10K series resistor to Pin23 (Analog A9) and fed the resistor with a variable source simulating Vas. I also put a very accurate digital voltmeter (calibrated against MAX6350) directly on Pin23 to make sure that the voltage never exceeded 3.600 volts.

    The highest voltage I could apply to the resistor was 3.626 volts and that gave a reading on Pin23 of 3.597 volts (very close to the absolute max permitted of 3.600). So if I had attempted to go any higher then I would have exceeded the permitted limit.

    So Fig 35 is actually suggesting what the configuration would be if you used your own external protection diodes.

    The moral of the fable is... don't take the diagram of Fig 35 literally. AND DO MAKE SURE you provide your own protection. Sad really, a schottky to the 3.3 volt rail on each analog input would have been soooo useful.

  7. #7
    Senior Member
    Join Date
    Apr 2020
    Location
    DFW area in Texas
    Posts
    116
    @TelephoneBill:

    Thanks much for sharing your test results. So, for general protection, should we go with earlier (@MorganS) recommendation for using a TVS diode (internal pair) for static protection, plus a pair of BAT54S for gross overvoltage protection ??

    Thanks,

    Mark J Culross
    KD5RXT

  8. #8
    Senior Member
    Join Date
    May 2015
    Location
    USA
    Posts
    560
    Building on what you said, I get ~100V of protection when using a SDM40E20LS, even with a 1K resistor (a better choice than 10K given ref manual recommendations for input resistance).

    Since the positive rail can't absorb 100ma, also adding a SP4020-01FTG-C TVS diode would be useful.

    So: input->1K->TVS->1K->SDM40E20LS->ADC

    Not clear to me if such protection would have any negative effect on the signal.
    Last edited by jonr; 07-15-2020 at 03:00 PM.

  9. #9
    Senior Member
    Join Date
    Mar 2015
    Location
    UK
    Posts
    364

    Sdm40e20ls

    This surface mount diode SM40E20LS looks like a real beauty. The "typical" graph in the data sheet shows less than 0.3 volt drop for even 100 mA at 25 degC. If you could employ 100 mA into a diode for the permitted headroom of 0.3v, then even a 1K would allow you 100 volts excess input. Take care here though, the drop increases when the temp is lower. Such figures need checking practically. And there is always the danger of the diode failing (for whatever reason).

    I just did another experiment with 10K series and my own 1N5711 schottky diode (to 3.3v rail), and I could take the input up to 5.260 volts before reaching 3.597 volts at Pin 23. If I add two 10K's (as a voltage divider with the second resistor to ground) then that improved it further to 8.890 volts.

    Yes, 10K is a bit high. But that might be a scaling issue.

    Will have to look into TVS diodes, but I suspect the limiting factor will be the amount of capacitance that every added device contributes at the input. In the data sheet for the iMX RT1060, those graphs of Fig 36,37 and 38 show how the settling time increases with capacitance.

    It will be worth doing some work on various resistor values for source impedance, just to see how the "linearity" of ADC conversion values against actual input voltage performs. Thats going to be a seperate exercise.

    I do recommend you look into the accuracy of your digital voltmeters. I got a bit of a surprise very recently when I bought a superb TENMA triple output power supply with dual Volts/Current displays. At first I though that these displays were a bit "off", but soon found out is was my two digital DVM meters that were in error, and the power unit displays were spot on.

  10. #10
    Senior Member
    Join Date
    Jul 2020
    Posts
    306
    Quote Originally Posted by TelephoneBill View Post
    It does NOT look like there are internal diodes such as Fig 35 suggests. The assumption that all to the right of point VADIN was internal is NOT correct as far as my experiment a few minutes ago has indicated. Either this, or if they are there, then they are not of a Schotty type.
    Protection diodes are implemented as simple pn junctions in the pad I believe. Schottky's would require more process steps I think (you need particular kind of metalization?), and its not necessary for ESD robustness. Schottky's would also be very leaky at full temperature (way more than pn).

    External schottkys are going to kick in before the internal diodes and protect them from any heavy currents that might be too much for the protection diodes. Pushing high currents through protection diodes is the classic method of sending CMOS chips into latch-up, so you don't want to risk this.

  11. #11
    Senior Member
    Join Date
    May 2015
    Location
    USA
    Posts
    560
    Looks like the amount of leakage current with schottky diodes will cause linearity errors that would be hard to calibrate out. More accurate to use a TVS followed by an over-voltage protected rail-to-rail op amp (eg, ADA4091-2).

    Perhaps this is the best low cost solution:

    input->200 ohms->6V clamp TVS->1/2 voltage divider (2K resistors)->ADC

    Very high brief and 20V (??) sustained protection. It will waste about 1/2 of the ADC input range. No concern about rail overload. Correct input impedance, almost no leakage distortion.
    Last edited by jonr; 07-15-2020 at 06:16 PM.

  12. #12
    Senior Member
    Join Date
    Mar 2015
    Location
    UK
    Posts
    364
    Thanks MarKT. That makes sense of the experiment results. Didn't realise that Schottky was so leaky (must remember that).

    Your comment on CMOS and latchup is valuable. Over voltage on any analog pin is undesirable so if we can hammer out a good, cheap, and simple defacto method, then this is going to be very useful to all Teensy users. I think a "sacraficial component", such as neutron7 suggests is excellent, but the cost is complexity and real estate.

  13. #13
    Senior Member
    Join Date
    May 2015
    Location
    USA
    Posts
    560
    Found a better Schottky diode. About the same leakage as a BAT54 but still protects to 50+V with a 1K series resistor. NSR05F20NXT5G

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •