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

Thread: Teensy 3.1 and "5V tolerance"

  1. #1

    Teensy 3.1 and "5V tolerance"

    So I was doing some searches & reading and came across this thread:

    Now I realize it is for the Teensy 3.0, not 3.1 but there was talk that the 3.0 was "5V tolerant" just like the 3.1 is and that doesn't mean you should always drive it at 5V like with an encoder, but use an inline 1K resistor to drop the voltage.

    Does the same apply to the Teensy 3.1? Or is it more tolerant?


  2. #2
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Ayer Massachussetts
    Reread Paul's answer on 8-28-2013, where he explains that the 3.0 is not 5v tolerant (though I think he meant to have the word not in the 2nd sentence). If you use a 1K resistor in series, it will drop the voltage to be safer.

    Since the 3.1 is 5v tolerant for the digital pins and A0-A9 (but not A10-A14), I would suspect you don't need the resistor inline, but it would still work with it.

  3. #3
    LOL. You're right. He clearly says " but Teensy3 is not 5V tolerant. " And clearly my ability to understand the meaning of 3 letter words is lacking.

    Thanks Michael!

  4. #4
    Senior Member Constantin's Avatar
    Join Date
    Nov 2012
    In the yard with a 17' Dia. Ferris Wheel
    Regardless how 'tolerant' an IC is of a higher voltage, I would always use a voltage translator for digital signals and a resistor divider/op-amp buffer or similar approach for analog signals.

  5. #5
    So I'm kinda new to this sorta thing, so I gotta ask, why? If it's within spec, it's within spec right?

  6. #6
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    It is ok to connect 5V logic signal to the digital pins on Teensy 3.1, labeled 0 to 33 in gray on the pinout card. All 34 of those pins have circuitry built inside the chip to handle up to 5 volts. The other pins (without digital I/O, A10-A14 & AREF, Program) should never be driven with more than 3.3V.

    Teensy 3.1 is 5V tolerant, but the older Teensy 3.0 is NOT 5V tolerant.

    Pin 33 has a "non-maskable interrupt" feature. It's best to use 33 as an output only. Future versions of Teensyduino will disable that NMI feature by default, but for now it's enabled.

  7. #7
    My apologies for digging up this old thread but I really need to understand this before committing to new hardware and abandoning a lot of code accumulated over the years.
    I've been using ATmega extensively and without problems for quite a long time. I was excited to get more power and interfaces when xmega came out. Well.. that did not last long.
    Level converters on input pins (from 5V devices) was bad enough, but removal of rail-to-rail ADC requiring extra components on all ratiometric sensors was the last drop.

    On the first glance it seems Teensy 3.2 is free from these problems. However I just realized that most references on "5V tolerance" are referring to INPUTS, not outputs.
    I am not an electrical engineer, so cannot be quite sure, but recent mishaps with xmega lead me to believe that the pins configured as outputs might have problems with 5V devices depending on the type of the input transistor in the device. Specifically, if the transistor is npn then the controller pin works as 3.3V source for the base. However if transistor is pnp then output pin becomes a sink for 5V emitter voltage. Even if current-limiting resistor is present in the device (which i am not sure about) the pin will exceed not current but voltage rating of the MCU input.

    I had spectacular meltdowns of several xmegas connected to serial inputs of MAX3232 (accidentally powered by 5V) and Sabertooth motor controllers .

    So, my question is this - can "5V tolerant" digital pins of Teensy 3.2 be used safely as outputs for 5V external devices? Assuming, of course that input currents do not exceed output drive capacity.

  8. #8
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    I don't understand some parts of your question, especially the stuff about NPN and PNP transistors. Maybe a schematic would help?

    I can tell you 5V tolerance is about inputs. That means you can connect some other device that sends a 5V signal to Teensy 3.2. Even though the chip is 3.3V, it will not be damaged if you connect a 5V signal to the digital pins.

    When the digital pins are used as outputs, they drive 3.3V output when high. The output is not 5V.

    The analog pins have a measurement range from 0 to 3.3V (when using VCC as your reference), or from 0 to 1.2V when using the internal 1.2V reference, or from 0 to your VREF, but VREF can not be higher than VCC (which is 3.3V).

    The analog pins which also have digital signal capability are 5V tolerant, which means analog signals up to 5V will not damage the chip. But voltages from 3.3V to 5V all measure the same, as the maximum.

    In general, when a chip is said to be "5V tolerant" (or 3.3V tolerant, in the case of newer 1.8V chips), that means it's been designed so it can withstand other chips driving it to those higher voltages. But it doesn't have the ability to output those voltages. When you see the term "tolerant" on any chip, you should understand that means the chip doesn't actually use that voltage. It merely means the chip is able to tolerate those voltages from other chips.

    When a chip is said to be not tolerant (or said to be "3.3V only"), that means it doesn't use the higher voltage and connecting those higher voltage signals could damage it. Today, only Teensy 3.2 is 5V tolerant. Teensy LC is 3.3V only. Teensy 2.0 and Teensy++ 2.0 are 5V only, or they can be configured for 3.3V by adding a MCP1825 regulator, but in that mode they become 3.3V only.

    On Teensy 3.2, the 5V tolerance is on the pins with digital I/O, even when used in analog mode. However, the analog only pins without digital features, A10, A11, A12, A13, A14/DAC, and VREF are *not* 5V tolerant. Applying 5V to any of those pins can destroy your Teensy.

    Hopefully this lengthy description clears up any questions about how Teensy works. Regarding circuits you wish to use with NPN and PNP transistors, maybe start a new thread with a schematic and clear description of what you're trying to accomplish.

  9. #9
    Quote Originally Posted by PaulStoffregen View Post
    Regarding circuits you wish to use with NPN and PNP transistors, maybe start a new thread with a schematic and clear description of what you're trying to accomplish.
    Hi Paul,
    Thanks for prompt reply. Since I am not building any fancy circuits I think there is no point in a new thread. I am simply connecting controller to off-the-shelf external devices, like servos, serial adapters etc. Ground to ground, output to input. So this is straightforward question of 5V compatibility, which is the topic of this thread.

    The controller is typical ATxmega based breakout. All pins are OUTPUTS. Some devices are 3.3V, some 5V and some have separate I/O voltage input which I am connecting to 3.3V from controller. My reasoning was exactly the same - as long as output levels are compatible with input thresholds and output drive capacity is sufficient for rated input current everything should work fine. And in fact it does work with most of the devices I tested. However just recently I toasted several controllers by connecting them to 5V devices. For example one was MAX3232 adapter accidentally powered from 5V.

    As I mentioned before, I am not an electrical engineer, so I have no explanation for this. My only guess is that the outcome depends on the specific schematics of the input circuit inside the device. I am attaching a drawing to illustrate the difference between npn and pnp inputs. As you can see the output of the controller driven high works as a source for npn-based input. No problem here, unless input impedance is too low. However output of the controller driven low will work as a sink for pnp-based input, grounding current from 5V device power. Even if input impedance is high and current is low, the output pin still will see 5V, which exceeds rated pin voltage (of xmega).

    That is why I posted a question here - even if I don't know exactly why xmega failed, I'd like to make sure it won't happen if I switch all my future projects to Teensy.

    Click image for larger version. 

Name:	outputs.gif 
Views:	429 
Size:	9.2 KB 
ID:	6544
    Last edited by wwwoholic; 03-03-2016 at 05:34 AM.

  10. #10
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Most of those cases will work.

    Of course, if you put 5V power to the VCC pins on 3.3V chips, they rarely survive. Teensy 3.2 can be instantly killed if you touch 5V power to its 3.3V power pins, so don't do that!

    The NPN circuit you showed will work.

    The PNP circuit may not. When the output is driven high, the PNP transistor will still have a base current, because current can conduct through the emitter-base junction, through the resistor, and then through the upper mosfet transistor to 3.3V. As long as the current is less than the amount of power all chips are consuming, the only consequence is some of the 3.3V power is supplied through that path. However, if you're running a very low power project and the base current is high (a low value resistor), if the base current is more than the total power consumption of all your 3.3V chips, then it will raise the 3.3V power up to a higher voltage, perhaps killing your 3.3V chips.

    With a 5V tolerant part like Teensy 3.2, you can turn the PNP transistor off by configuring the pin to input mode. Because the pin is 5V tolerant, it won't be damaged by 5 volts appearing on the pin because of the PNP and resistor. However, this is a very slow way (microseconds) to turn off a bipolar transistor, which may or may not matter to you. Normally you'd drive the resistor to 5V, which allows charge trapped in the base to escape through the resistor. Simply disconnecting will turn the transistor off too, but it takes longer to transition.

  11. #11
    Thanks for the explanations, Paul.

    I totally forgot about that additional possibility for current path - from 5V rail through upper mosfet to 3.3V rail. So, not only lower mosfet can be fried by attempting to drive 5V low, but the whole controller can be fried by 1.7 over-voltage on power rail when output driven high. Not very encouraging. Unfortunately most of the devices I have to work with have serial inputs. And usually hardwired to 115k baud. No way to use software serial, so any experiments with input mode are out of question.

    I guess the only thing I can do is try and see what happens with each particular device, since there is no way to know what kind of input circuit they use. Usually the controller survives about 10 sec of serial communication before giving up. If it getting hot it will be a hint to use level shifter.

  12. #12
    Senior Member
    Join Date
    May 2015
    I confirmed that a 2K pullup to 5V on a digital pin set as an input or a low output caused no apparent damage to a teensy 3.1. So I saved a transistor in the case of a teensy switching 5V with a high side, P channel mosfet .

    I agree with Paul - be aware of the current to the 3.3V rail issue with a high output (.85 ma with 2K).

    As a general statement, resistors on outputs prevent some accidents.

Posting Permissions

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