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

Thread: What is the difference between the 74HCT245 and sparkfun's logic level converter?

  1. #1

    What is the difference between the 74HCT245 and sparkfun's logic level converter?

    I'm still getting up to speed on making sense of schematic's and data sheets, so I'm having trouble understanding the difference between these two chips.

    1) is the 74HCT245, mentioned as a must have for communicating with 5v led strips such as the neoPixels from the teensy.

    2) is the "Bi-Directional Logic Level Converter" https://www.sparkfun.com/products/12009 from sparkfun.

    I know they aren't the same exact thing, but I would like to understand how they differ and are they interchangeable in regards to communicating with led strips from a teensy?
    They are a bit more practical in shape and size for use with out a breadboard.

    Thanks!

  2. #2
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    2,770
    This is the post that measured various logical level converters and found that the 74HCT245 was the only one to handle a a lot of WS2812 leds without problem. The TXS-0102 shifter appears to work for just a few leds, though there was one failure with a so-called grumpy strip. The two shifters from Sparkfun just cannot handle the 800 kHz signals that WS2812 lights generate: http://happyinmotion.com/?p=1247

  3. #3
    Yeah I saw this post a few days ago, I was curious if it was as simple as one just not being compatible. Seems like it is!
    I have a few of the 74HCT245's on the way.

    Thanks for the confirmation!

  4. #4
    Senior Member Jp3141's Avatar
    Join Date
    Nov 2012
    Posts
    455
    Quote Originally Posted by visualSound View Post
    I'm still getting up to speed on making sense of schematic's and data sheets, so I'm having trouble understanding the difference between these two chips.

    1) is the 74HCT245, mentioned as a must have for communicating with 5v led strips such as the neoPixels from the teensy.

    2) is the "Bi-Directional Logic Level Converter" https://www.sparkfun.com/products/12009 from sparkfun.

    I know they aren't the same exact thing, but I would like to understand how they differ and are they interchangeable in regards to communicating with led strips from a teensy?
    They are a bit more practical in shape and size for use with out a breadboard.

    Thanks!
    The Sparkfun product is a passive level shifter. It will be quite slow (especially on the rising edge fron a LV signal to a HV signal (the final pull up is 10k) -- delays coudl be in the 100's of ns range), and may not work well with widely varying votlages (such as 1.8 V to 5 V).

    It is capable of converting LV to HV signals, and HV to LV signals.

    The 74HCT245 is an active driver -- it converts from one level to the other and drives the line strongly; its delays will be in the 10's of ns only. You do need a control that sets which direction it is driving -- in the WS2812 case the signals are only from the Teensy to the LEDs, so this can be hard wired.

  5. #5
    That's super helpful, thank you for explaining.

    Do you know of any wiring diagrams or images that show how to set that up?

  6. #6

  7. #7
    Thanks again. Got it!

  8. #8
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,153
    PJRC now sells a 74HCT245-based level shifter. It also has the 100 ohm series line matching resistors, and RJ-45 jacks to plug in CAT6 cable which exactly matches the 100 ohm resistors and offers excellent signal quality.

    http://www.pjrc.com/store/octo28_adaptor.html

    Of course, this circuitry is pretty simple, so you can certainly build your own. For a large LED project, I highly recommend you follow the wiring advice on that page, especially locating the power supplies as close as practical to the LEDs and use short, large diameter wires for the LED power. The Teensy ground and LED power ground should meet at or near the LED data input.

  9. #9
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,153
    Those passive level converters, using a N-channel mosfet and 2 resistors, are really only good to use for I2C.

    Their big weakness is the high level output on either side is only due to the weak pullup resistor, so the low-to-high output is very slow. Because high-to-low is much faster, they result in a distorted waveform output, which is terrible for WS2811 LEDs where the width of the pulses matters. They're unable to source any substantial current into a load, so troubleshooting by connecting a LED to "see" the signal causes trouble. Even just connecting extra wire to the output, especially when experimenting on a breadboard, can really alter the low-to-high speed.

    Unfortunately, Adafruit, Sparkfun and others have sold that level convert circuit as a general purpose solution, which though it performs really well only with certain protocols like I2C. Adafruit revised their description a few month ago from an overly optimistic "good for everything" sales pitch to a much more conservative approach.

    Likewise, the active bi-directional converters, like TXB0108, have often been promoted to hobbyists with overly optimistic descriptions. Those TXB0108 chips work similarly to the passive approach, except a circuit detects any unexpected change at the "output" and very briefly drives the other side high very strongly for a brief moment. Thereafter, the output voltage is maintained with only a weak pullup. The momentary strong drive solves the slow low-to-high transition. But the detection circuit is a ticking time bomb, ready to go off and cause incorrect behavior. Those TXB0108 tend to work well when the signals are on short wires between digital chips on the same circuit board. When driving long wires to LED strips, where huge changes in current also happen along shared ground paths, those drivers can easily become a liability.

    A unidirectional buffer (or able to buffer with way, but hard-wired for the intended direction) is the right way to buffer WS2811 data signals. Since the first day I published OctoWS2811, the web page has recommended a 74HCT245 chip. It really is the right approach.

  10. #10
    Wow, thanks for the break down Paul,

    Yeah I will be investing in some of those adapters for the next project, right now I'm kind of keeping things small and getting educated on all this stuff as it's my first time playing with these led strips.

    I ordered a dozen of the 74HCT245's, so I should be in much better standing when those arrive!

    Thanks again!

  11. #11
    Senior Member
    Join Date
    Jun 2013
    Location
    Montréal
    Posts
    462
    A somewhat related question, is there a chip with less channels that would do the same job as the 74HCT245 ? I only need 2 channels...
    thanks !

  12. #12
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,153
    74HCT08 is a quad AND gate, which could be used for 4 channels.

    It's slightly smaller and maybe slightly less expensive, but still pretty similar.

  13. #13
    Senior Member Jp3141's Avatar
    Join Date
    Nov 2012
    Posts
    455
    Quote Originally Posted by PaulStoffregen View Post
    74HCT08 is a quad AND gate, which could be used for 4 channels.

    It's slightly smaller and maybe slightly less expensive, but still pretty similar.
    But that's not a level shifter -- it would be marginal with a 5 V WS2812 system and just 3.3 V from the Teensy.

  14. #14
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,153
    Why would an AND gate not function as a level shifter?

    It's got the same TTL level thresholds (worst case high > 2.0V, worst case low < 0.8V). The HCT08 output is specified at 4 mA currents instead of 6 mA, but it's still a true 5V push-pull drive that's plenty strong enough for a line (through a series termination resistor) to the LED strip.

    Both chips have the same TTL level logic input circuit (a specific ratio of mosfet sizes: an oversized N-channel so the logic threshold is nominal 1.6 instead of 2.5), some logic inside the chip involving multiple inputs which ultimately turns on a mosfet transistors connected to the output pin. Even though the '245 is depicted as a pair of buffers, inside the chip is it certainly implemented as several logic gates based on the 3 input signals which create 2 internal logic signals that drive the 2 big mosfet transistors connected to the output pin.

  15. #15
    Senior Member
    Join Date
    Jun 2013
    Location
    Montréal
    Posts
    462
    Thanks Paul !

  16. #16
    Senior Member
    Join Date
    Jun 2013
    Location
    Montréal
    Posts
    462
    And could something like an ULN2003 also work ? (I'm asking because I have a bunch of those chips around)

  17. #17
    Senior Member Jp3141's Avatar
    Join Date
    Nov 2012
    Posts
    455
    Quote Originally Posted by PaulStoffregen View Post
    Why would an AND gate not function as a level shifter?

    It's got the same TTL level thresholds (worst case high > 2.0V, worst case low < 0.8V). The HCT08 output is specified at 4 mA currents instead of 6 mA, but it's still a true 5V push-pull drive that's plenty strong enough for a line (through a series termination resistor) to the LED strip.

    Both chips have the same TTL level logic input circuit (a specific ratio of mosfet sizes: an oversized N-channel so the logic threshold is nominal 1.6 instead of 2.5), some logic inside the chip involving multiple inputs which ultimately turns on a mosfet transistors connected to the output pin. Even though the '245 is depicted as a pair of buffers, inside the chip is it certainly implemented as several logic gates based on the 3 input signals which create 2 internal logic signals that drive the 2 big mosfet transistors connected to the output pin.
    I apologize -- I Googled and checked the thresholds -- the NXP part ( http://www.nxp.com/documents/data_sheet/74HC_HCT08.pdf ) has the 74HC08 and 74HCT08 in the same data sheet, and I was looking at the HC version of the part. The HCT version does have a logic high threshold guaranteed at 2.0 V so it would work.

    Note however (because of the way the input circuit works) it could consume an additional 250 uA per pin if the inputs are not rail-rail. This is current that would be consumed from the 5 V supply. It's probably not an issue in LED applications, but could be a concern in other cases.

  18. #18
    Member
    Join Date
    Aug 2015
    Location
    Los Angeles, CA, USA.
    Posts
    22
    Quote Originally Posted by PaulStoffregen View Post


    A unidirectional buffer (or able to buffer with way, but hard-wired for the intended direction) is the right way to buffer WS2811 data signals. Since the first day I published OctoWS2811, the web page has recommended a 74HCT245 chip. It really is the right approach.

    Very interesting post, Paul. I got the Sparkfun "logical level converter ", it did not work with Teensy 3.1, now I know why. Question: So the OctoWS2811 is unidirectional? I believe is hardwired A-to-B, or 3.3V to 5V, am I right? Which means it will let pass data from the micro-controller to the external device, but not the other way around, correct? How about if I want to have data both ways?

    I just got the OctoWS2811, and together with Teensy 3.1 is working very well, I am working on some addressable LEDs Xmas lights project. I need to investigate a little more because I will use SPI addressable LEDs. I think I know how to solve this. I tested it with some WS2812.

    By the way, is there anyway to get the OctoWS2811 schematic? Thank you.
    Last edited by TechAlex; 08-29-2015 at 09:08 PM.

  19. #19
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,153
    Yes, OctoWS2811 is unidirectional.

    In fact, as far as I know, ALL addressable LEDs use only unidirectional signals. Ok, I'm not including microcontrollers+LED products like ThingM, which uses I2C as I recall. But all the LEDs like WS2812B, APA102, LPD8806, WS2801, etc are only unidirectional. Even the ones which emulate DMX protocol are unidirectional.

    If you want data both ways, first you need things that actually communicate both directions! Let's talk of this in terms of specific protocols or devices. Details matter.

    Whatever you do, don't believe the maker myth that you can buy a cheap bidirectional level shifter as a universal solution to all 3 vs 5 volt interfacing needs. Especially the mosfet plus resistors circuit in of limited use, mainly only for I2C, and nearly useless for high speed communication!

  20. #20
    Member
    Join Date
    Sep 2016
    Location
    NYC, USA
    Posts
    44
    Hi,

    I've used the quad 74HCT125 level shifter with T3.2 to drive a chain of 30 '595 shift registers (with 240 leds on the outputs) using SPI. Worked fine.
    https://www.adafruit.com/products/1787

    best,
    Michael
    Last edited by Michael Ward; 10-21-2016 at 09:06 PM.

  21. #21
    Junior Member
    Join Date
    Apr 2017
    Posts
    5
    Good info - this is the difference between buying parts and real engineering Thanks for the info!

    == John ==

  22. #22
    Junior Member
    Join Date
    Feb 2016
    Posts
    18
    Another thumbs up. I am using the CD74HCT245E to drive 12x5m of 12v ws2811 strips over 30 feet of cheap thermostat cable and it works great. This little chip solved a problem I have been having for some time. Also note - if you are running over very long distances you need to account for voltage drop. I am using 18ga with a starting voltage of 13v to end up around 12v at the strip. I will probably move to 16ga wire. Low voltage presents a lot like a degraded signal - so check!

Tags for this Thread

Posting Permissions

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