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

Thread: 5V Teesny 4.1

  1. #1
    Junior Member
    Join Date
    Feb 2021
    Posts
    17

    5V Teesny 4.1

    Hello, the speed, pins and ram of the Teensy 4.1 is incredible. All of my peripherals are 5v though (LCD, Rotary Encoders with push switches, RGB LEDs + more. I'd happily make the jump from an Arduino Mega to a teensy 4.1 if only it was 5volt.

    Is there anyway to get something like the 4.1 but with 5v logic at the pins? Or some sort of piggy back giant level shifter shield?

    What's the best solution to this? Keeping 5v but getting speed/ram/pins of the 4.1?

    Keep up the amazing work, and thanks!

    Steve

  2. #2
    Senior Member
    Join Date
    Apr 2013
    Posts
    1,938
    The boring answer is to buy all new peripherals, on a practical front high performance devices are always going to be fussier on power supply, ESD, pin drive capability and all these similar things so moving from a mega to any current gen device is going to have some thought involved. On the practical front many devices do not care on the voltage (buttons and basic encoders), others will tolerate 3.3V operation (most LCDs, but not most 2/4 line character ones). As a general rule devices that are input only can be connected up 'just to see' and in many cases can be made to work, anything that outputs back to the micro controller needs some careful data sheet reading before being plugged into a Teensy and will probably need some form of voltage divider. I2C is a headache since bi-directional level converts are very hit and miss though in some cases you can setup the pullups to 3.3V only and have 3.3 and 5V devices connected to the single bus (since it is a pulldown bus). Not necessarily what you want in something mission critical without some research.

    The LED strips may be the biggest obstacle in switching. They need very fast swinging drive signals so right way involves devices like that included on the Teensy LC, the prop shield or the the OCTOWS 8 channel shield. The ugly method is the cut off the first pixel and power it with diodes at ~4V and use it as an intermediate step between 3.3 and 5v logic.

  3. #3
    Senior Member
    Join Date
    Apr 2014
    Location
    -
    Posts
    9,756
    The good news is, for most things, level shifters are not needed, and today most periphals can work with 3.3V. The rotary encoders you mentioned for example.
    There are many replacements for the old 5V LCDs, too - like OLEDs.

    I see 1.8V on the horizon.. so maybe it's the time to put 5V periphals away.

  4. #4
    Senior Member manicksan's Avatar
    Join Date
    Jun 2020
    Location
    Sweden
    Posts
    606
    Your could use simple levelshifters as this one
    https://www.sparkfun.com/products/12009
    There is also special ics that make that possible.

  5. #5
    Senior Member
    Join Date
    Apr 2014
    Location
    -
    Posts
    9,756
    Quote Originally Posted by manicksan View Post
    Your could use simple levelshifters as this one
    https://www.sparkfun.com/products/12009
    These are incredible slow, but work good for some things - a few 100kHz.
    For fast IO, they are not usable.

  6. #6
    Senior Member fdaniels's Avatar
    Join Date
    Oct 2020
    Location
    Ostwestfalen, Germany
    Posts
    117
    Encoders and Pushbuttons will work without any problem with 3,3V. Most LCD and almost all OLED work with 3,3V, too. LEDs work perfectly with 3,3V, you just need to adjust the current limiting Resistor. Although i never have seen this recently (OK, i just have experience with 4 different suppliers) some WS2812bs and the like are reported to need +5V level.
    So if you design something new, theres no problem at all. If you are looking for a drop in replacement, well you will need that giant levelshifter shield.

  7. #7
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    26,229
    Quote Originally Posted by StevenMartin View Post
    What's the best solution to this?
    The "best" solution is to get used to using 3.3V signals.

    Seriously, if you look around almost no microcontrollers other than old 8 bit AVR and PIC use 5V. Pretty much everyone switched to 3.3V a long time ago.

    Most of the newer generation addressable LEDs are designed to accept 3.3V signals, even though 5V allows better noise margin. Almost all modern displays use 3V only signals, and shields with those displays for Arduino Uno & Mega have 5-to-3V level shifters. The same is true for SD cards, motion sensors, ethernet chips and virtually every chip designed in the last 25 years (well, except 1.8V only is becoming a thing lately....) Most of those peripherals you mentioned probably can use 3.3V.

    A board Teensy 4.1 running at 5V just isn't ever going to exist. The modern silicon processes (65nm, 40nm, 28nm) that make fast microcontrollers run on lower voltages, because the transistor channel lengths and gate insulation are so small. On Teensy 4.1, almost all the logic inside the chip actually runs at 1.1V or 1.15V or 1.25V. It gets converted up to 3.3V or 1.8V inside the chip at the pins, but fundamentally these modern parts with excellent performance run on lower voltages. Supporting higher voltages increases cost and in many cases just isn't possible for over 3.3V due to the physical design of modern silicon processing.

  8. #8
    There is the detail: you come from the AVR-5V environment. The teensy 4.1 you must use it with another approach, you must use an intermediate chip if you want to continue using the components you already have.

    Shield way you wish won't find it, you have to create that path. A good chip is the SN74AHCT125N, you can connect servo motors, 5V addressable leds, 5V LCD. You will necessarily sacrifice some speed, but you can control them as usual.

    Consider some external source to handle the 5V power.

  9. #9
    Senior Member
    Join Date
    Mar 2016
    Posts
    360
    Yes, microcontrollers are all 3.3V these days. You've got to learn to live with it. While most peripherals can be had in 3.3V versions and a lot (almost all) new peripheral chips are 3.3V (or less) only, there are still some things that want 5V. In the machine control area, there are many devices that are spec'd for 5V or higher so learning to interface to them is part of the job. I like the AHCT and HCT logic families for output and LVC family (5V tolerant) for input.

    AHCT and HCT logic running at 5V will see a high on input of 2.5V or higher. You run it at 5V and it will accept 3.3V logic signals. The 74AHCT125 is a good one though I prefer the AHCT541 which is set up in a bus configuration with all 8 inputs on one side of the chip and all 8 outputs on the other. There are one input (1G) versions (74AHCT1G125, for example) of this if 8 is too many. SMD only and pretty small (get used to it, that's the world of 2021). Relatively fast, can easily handle 10 MHz.

    For input, LVC is nice because you can run it at 3.3V and is 5V tolerant. It is fairly fast too. The 74LCV1G125 is similar to the 74AHCT125. There 2 input versions - LVC2Gxxx - also.

  10. #10
    I'd have to agree with Paul. I made a similar switch from Arduino stuff some 3 years ago and never looked back. I never really understood how a goofy form factor of an UNO or Mega could be used for any production (or permanent) application. As you find memory, speed, etc. are just too limiting with Arduino stuff.

    Even though most of my projects are based on a 3.2 (5V tolerant), I still only use 3.3 devices. It will be a bit of a pain redoing projects, but once you are done, you will have a much better solution.

  11. #11
    Junior Member
    Join Date
    Feb 2021
    Posts
    17
    Thank you, everyone! The product/project I mentioned is my first venture into both electronics and programming. So I'm coming into it super fresh. I originally started with a Mega clone as it came as a hobbyist starter kit then kind of built my project around the controller.

    It does mean essentially starting again and replacing my hardware but from all of the great responses (thanks for those!) it looks like starting fresh from 3.3v will 'eventually' give me everything I want.

  12. #12
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    26,229
    Quote Originally Posted by StevenMartin View Post
    It does mean essentially starting again and replacing my hardware
    I believe you may have missed the part where some, possible most or maybe even all, of your hardware probably works perfectly fine with 3.3V signals.

    Even those ancient HD44780 small LCDs work fine with 5V power and 3.3V signals, if you use them in the simplest write-only way where the RW signal connected to GND (and Arduino's default LiquidCrystal library just keeps that pin at logic low if you do connect it - only the special "fast" versions of that library actually use it, for only rather modest speedup)

    Change is painful. But seriously, don't throw out perfectly good hardware before you even try to see if it would work!
    Last edited by PaulStoffregen; 02-09-2021 at 01:19 PM.

  13. #13
    I'm not experienced in electronic design, but I've been curious about using Teensy 4.x in retrofit applications with 5V devices, including SPI. NXP's latest level shifters support 5V to either 3.3V or 1.8V and operate up to 2 Mbps open drain or 20 Mbps push-pull. The 8-bit version is NTS0308EPWJ at $1.50 quantity one. Is this a simple solution or are there pitfalls in level shifting?

  14. #14
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    26,229
    There are always possible pitfalls with automatic bidirectional level shifting. Remember, every datasheet is a sales pitch designed to get you to buy the chip. They will almost always gloss over any gotchas, like noise or crosstalk falsely triggering the direction detection logic.

    For protocols like SPI and addressable LEDs, use unidirectional buffer chips (if translating the voltage truly is necessary).

  15. #15
    Quote Originally Posted by PaulStoffregen View Post
    For protocols like SPI and addressable LEDs, use unidirectional buffer chips (if translating the voltage truly is necessary).
    Thank you. I'm glad I asked.

  16. #16
    Senior Member
    Join Date
    Dec 2016
    Location
    Wales
    Posts
    131
    I think it's worth pointing out that the teensy 3.5 and 3.2 are 5V tolerant, that means while they output 0-3V3, they won't be damaged by a 5V input on their digital pins. Think of it as an input-only level shifter if that helps. Say after you look through your modules, some are happy with 3v3 logic, but some can only output (send to the teensy) 0-5V: then you can use the Teensy3.5.
    You might find that you can use a Teensy3.5 for this project, and move towards 3v3 logic so you can use a Teensy4.1 in the future.

  17. #17
    Senior Member manicksan's Avatar
    Join Date
    Jun 2020
    Location
    Sweden
    Posts
    606
    I would ask the threadstarter
    what specific devices are you gonna use?
    Just to clarify some things

  18. #18
    Junior Member
    Join Date
    Feb 2021
    Posts
    17
    Sorry for the slight grave dig on my own post. I did in fact go with the Teensy 4.1 (loving that by the way). And sorry to any questions I left unanswered.

    The KY040 encoders do in fact work great. I replaced the 16x2 LCD with a 3v version which seems to be working nicely. I have 14 of these WS2811 LEDs in a chain (https://www.amazon.co.uk/gp/product/...?ie=UTF8&psc=1) I've plugged power ground and data all into the teensy and to my surprise, even as 5V leds they seem to work perfectly fine and are even nice and bright on the 3.3v.

    My question is (as pardon my complete lack of electrical knowledge) is it safe for the Teensy if I continue to use them? I'm powering the Teensy from a laptop USB at the moment, but I will later find a way to power the Teensy from mains later down the line. I just wanted to check that as the LEDs allow 5v, there wasn't any magical electrical voodoo going on that would somehow allow the LEDs to create an increased voltage that's big enough to fry my new little friend

  19. #19
    Senior Member
    Join Date
    Jul 2020
    Posts
    1,748
    Quote Originally Posted by Frank B View Post
    These are incredible slow, but work good for some things - a few 100kHz.
    For fast IO, they are not usable.
    Depends on the strength of drive and the direction they are used in, driven from the low voltage end they are capacitive
    so switch faster with strong drive levels, driven from the high voltage end you have to deal with the reverse-recovery of
    the body-diode, which is often not quoted in MOSFET datasheets...

    These level shifters are routinely used for I2C/SPI, they ought to handle a few MHz OK in most situations from what I read,
    but that would be the upper limit I think - approriate application note here: http://cdn.sparkfun.com/tutorialimag...er/an97055.pdf
    [ Includes typical switching waveforms in section 4. ]

  20. #20
    Junior Member
    Join Date
    Oct 2019
    Posts
    1
    I love the digital 5V tolerance of the 3.5. I deployed a bunch of 3.5s on adapter boards to replace 40 pin PIC processors. The legacy systems are ~1990's vintage through-hole designs, a mix of 74LS and 74HCT logic. The 3.5 has no problem driving 5V logic reliably. In-circuit the Voh scopes just shy of 3.3V, so there is plenty of margin driving the TTL logic high. Vol is a no-brainer, even though that is where LS TTL requires the greatest drive current (into the source.)

    To be clear, these are not production systems. They are legacy model train RS422 to lots of I/Os used to drive switches, signals, and read occupancy detectors.

    Why replace the PIC processors? The proprietary code was buggy, exhibiting an exponentially growing error rate as the 422 baud rate increased. The protocol had no CRC either. The 3.5 lets me piggy-back a little two line status OLED, the excellent TeensyView from Sparkfun. The 3.5 firmware only uses 3% of program memory and 1% of RAM, but I needed lots of I/Os.

    Thanks for the great products! I eagerly await the next available batch of 3.5s.

    Bob

  21. #21
    Junior Member
    Join Date
    Feb 2021
    Posts
    17
    Quote Originally Posted by StevenMartin View Post
    I just wanted to check that as the LEDs allow 5v, there wasn't any magical electrical voodoo going on that would somehow allow the LEDs to create an increased voltage that's big enough to fry my new little [3.3v] friend
    Any thoughts on this?

  22. #22
    Senior Member
    Join Date
    Dec 2016
    Location
    Wales
    Posts
    131
    If you're supplying Vin as 3v3, then there's nothing to worry about, as the modules won't have a way of stepping the voltage up. You might want to check if 3v3 is within the safe operating range of the parts, as even though it runs now, you might be shortening the lifespan.

  23. #23
    Junior Member
    Join Date
    Feb 2021
    Posts
    17
    Thank you, Edward! I don't mind frying LEDs as I have plenty to work with and can try to solve that later if it becomes an issue. It was just frying the Teensy I was concerned about. So if that's not going to be an issue then happy days. Thanks!

Posting Permissions

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