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

Thread: Appropriate Level Shifting IC to interface Teensy LC to 5V chip

  1. #1

    Appropriate Level Shifting IC to interface Teensy LC to 5V chip

    I'm looking to use a Teensy LC to controll an old 5V logic chip which is something I've never done before. The target chip has got 8 inputs and no outputs back to the Teensy (so I'm only 'writing' to the chip not 'reading' from it) so as far as I'm aware I need a uni-directional level shifter.

    Would the 74HC244N be an appropriate chip to do this, if I feed it 3.3V on the inputs and give it 5V in Vcc will it punt out 5V signal on the outputs? OR have I got completely the wrong end of the stick?

  2. #2
    Senior Member
    Join Date
    Dec 2014
    Posts
    299
    What chip actually is it?

    Many 5v chips are quite happy with 3.3v logic inputs. Have to check the data sheet to be sure.

  3. #3
    Quote Originally Posted by Cosford View Post
    What chip actually is it?

    Many 5v chips are quite happy with 3.3v logic inputs. Have to check the data sheet to be sure.
    Thanks for that, it turns out I am an idiot, you made me re-read the datasheet and I had overlooked a table first time round - min voltage for input high is 2V so I am good to go.

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    17,596
    If you do run into a 5V chip that requires more than 3.3V for logic high, the best unidirectional chips are the ones with the letter "T" in the part number. So 74HCT244, 74ACHT125, etc.

  5. #5
    Junior Member 3D Joy's Avatar
    Join Date
    Dec 2014
    Location
    Ste-Julie
    Posts
    10
    Not to go too much out of line with the thread but may I ask if these would work fine for Teensy 3.1 and APA102C LEDs ?

  6. #6
    Senior Member Constantin's Avatar
    Join Date
    Nov 2012
    Location
    In the yard with a 17' Dia. Ferris Wheel
    Posts
    1,408
    FWIW, I am waiting to run a APA102 based device with these translator chips in the near future. I'll try to remember to report back if it works! Constantin

  7. #7
    Quote Originally Posted by PaulStoffregen View Post
    If you do run into a 5V chip that requires more than 3.3V for logic high, the best unidirectional chips are the ones with the letter "T" in the part number. So 74HCT244, 74ACHT125, etc.
    Thanks for that info, I presume from reading this datasheet http://www.nxp.com/documents/data_sheet/74HC_HCT244.pdf that the T must stand for TTL level?

    If I did need to go in the other direction would a simple voltage divider work for going from 5V to 3.3V into the Teensy?

  8. #8
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    17,596
    Quote Originally Posted by Alistair Sheehy Hutton View Post
    If I did need to go in the other direction would a simple voltage divider work for going from 5V to 3.3V into the Teensy?
    Teensy 3.1 has 5V tolerant digital pins. You can connect 5V logic signals directly. Only the digital pin have this, so don't drive the analog only pins this way.

    For Teensy-LC or Teensy 2.0 at 3.3V, resistor dividers work if you can live with slow speed and wasted power when the signal is high. For high speed, a 5V tolerant logic chip is best. My favorite is usually 74LCX.
    Last edited by PaulStoffregen; 07-10-2015 at 11:40 PM.

  9. #9
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,438
    When Paul mentioned LCX some time ago, I googled a bit and found this selection guide:

    https://www.fairchildsemi.com/collat...tion-Guide.pdf


    (When i first used logic-chips, "LS" was common...later "HC" or "HCT".. then I had for a long time other hobbies)

  10. #10
    Member PaulS's Avatar
    Join Date
    Apr 2015
    Location
    Netherlands
    Posts
    83

    Another working levelshifter

    Being curious, I tested an NXP 74AHCT2G125/TSSOP8 levelshifter to connect an APA102 LED to a Teensy 3.1.
    Here is the datasheet: NXP 74AHCT2G125.pdf. Ordered a 5-pack at http://www.aliexpress.com/item/Elect...357109273.html.
    I mounted this levelshifter on a small adafruit breakout board: http://www.adafruit.com/products/1212.
    Here is the complete test setup:

    Click image for larger version. 

Name:	Teensy3.1 plus levelshifter plus APA102.jpg 
Views:	481 
Size:	192.1 KB 
ID:	4807.
    Red wire is +5V, black is GND, green is SCK, yellow is MOSI.

    Works like a charm, 24MHz SPI clock is no problem. I checked the signal waveforms on a oscilloscope: the outputs of the levelshifter actually have shorter rise/fall times than the SPI outputs of the APA102!

    Here is the code I used for testing:
    Code:
    #include <SPI.h>
    // hardware SPI on Teensy 3.1: MOSI pin 11, SCK pin 13
    SPISettings APA102(24000000, MSBFIRST, SPI_MODE1);
    
    void setup() {
      SPI.begin();
    }
    
    void loop() {
      SPI.beginTransaction(APA102);
      SPI.transfer(0); // 32bits start frame APA102 
      SPI.transfer(0);
      SPI.transfer(0);
      SPI.transfer(0);
      SPI.transfer(255); // upper 3 bits: 111, lower 5 bits: brightness 
      SPI.transfer(0); // blue
      SPI.transfer(0); // green
      SPI.transfer(192); //red
      SPI.transfer(255); // 32bits end frame APA102
      SPI.transfer(255);
      SPI.transfer(255);
      SPI.transfer(255);
      SPI.endTransaction();
      delay(500);
    }
    Paul

  11. #11
    Senior Member
    Join Date
    Mar 2013
    Posts
    641
    Quote Originally Posted by PaulS View Post
    Being curious, I tested an NXP 74AHCT2G125/TSSOP8 levelshifter to connect an APA102 LED to a Teensy 3.1.
    Here is the datasheet: NXP 74AHCT2G125.pdf. Ordered a 5-pack at http://www.aliexpress.com/item/Elect...357109273.html.
    I mounted this levelshifter on a small adafruit breakout board: http://www.adafruit.com/products/1212.
    Here is the complete test setup:

    Click image for larger version. 

Name:	Teensy3.1 plus levelshifter plus APA102.jpg 
Views:	481 
Size:	192.1 KB 
ID:	4807.
    Red wire is +5V, black is GND, green is SCK, yellow is MOSI.

    Works like a charm, 24MHz SPI clock is no problem. I checked the signal waveforms on a oscilloscope: the outputs of the levelshifter actually have shorter rise/fall times than the SPI outputs of the APA102!

    Here is the code I used for testing:
    Code:
    #include <SPI.h>
    // hardware SPI on Teensy 3.1: MOSI pin 11, SCK pin 13
    SPISettings APA102(24000000, MSBFIRST, SPI_MODE1);
    
    void setup() {
      SPI.begin();
    }
    
    void loop() {
      SPI.beginTransaction(APA102);
      SPI.transfer(0); // 32bits start frame APA102 
      SPI.transfer(0);
      SPI.transfer(0);
      SPI.transfer(0);
      SPI.transfer(255); // upper 3 bits: 111, lower 5 bits: brightness 
      SPI.transfer(0); // blue
      SPI.transfer(0); // green
      SPI.transfer(192); //red
      SPI.transfer(255); // 32bits end frame APA102
      SPI.transfer(255);
      SPI.transfer(255);
      SPI.transfer(255);
      SPI.endTransaction();
      delay(500);
    }
    Paul
    Pauls, please take another look at the spec sheet for that chip, the recommended minimum voltages for VIH is much higher then 3.3V logic at 5.5V(3.85V), if you use that to level shift 3.3V to 5V logic you may run into issues later on.

  12. #12
    Administrator Paul's Avatar
    Join Date
    Oct 2012
    Posts
    294
    Quote Originally Posted by Donziboy2 View Post
    VIH is much higher then 3.3V logic at 5.5V(3.85V)
    Perhaps you're reading the specs for 74AHC2G125 on page 4 ?

    This datasheet covers 2 different part numbers. The specs for 74AHCT2G125 (with the letter "T" in the part number) are on page 5. VIH is 2.0 volts.

  13. #13
    Member PaulS's Avatar
    Join Date
    Apr 2015
    Location
    Netherlands
    Posts
    83
    Donziboy2, you may looked at the wrong place in the datasheet; I'm using the 74AHCT2G125 [the T version]. On page 5, it states "min 2.0V at 4.5-5.5V".

    Paul

  14. #14
    Member PaulS's Avatar
    Join Date
    Apr 2015
    Location
    Netherlands
    Posts
    83
    Crossed

  15. #15
    Senior Member
    Join Date
    Mar 2013
    Posts
    641
    Ah ok, I hate when they combine multiple products into one spec sheet.

  16. #16
    Senior Member
    Join Date
    Jan 2015
    Location
    SF Bay Area
    Posts
    255
    this bidirectional level shifter from sparkfun works fine.

    https://www.sparkfun.com/products/12009

    or this
    http://www.ebay.com/itm/4-Channel-II...item27fc903bbb
    Last edited by doughboy; 07-29-2015 at 04:50 PM.

  17. #17
    Senior Member onehorse's Avatar
    Join Date
    Apr 2014
    Location
    Danville, California
    Posts
    920
    I don't doubt the 74..T.. is the best for unidirectional level translation but it is not the only; I have used this guy with success with PWM and tested it at 3 MHz with good results. The only possible advantage is eight channels in an appallingly small package. Otherwise stick with the 74...T...

  18. #18
    Administrator Paul's Avatar
    Join Date
    Oct 2012
    Posts
    294
    Quote Originally Posted by doughboy View Post
    this bidirectional level shifter from sparkfun works fine.

    https://www.sparkfun.com/products/12009
    These mosfet+resistor level shifters have terribly slow rise times. They really only work well for I2C, but sadly they are commonly marketed and misunderstood to be a "universal" level shifting solution. They're not!

    They not be used for SPI or any addressable LED protocols or other high-speed communication.

    For addressable LEDs like APA102 & WS2812 (Adafruit Dotstar & Neopixel), unidirectional buffers are the most appropriate choice for 3 to 5V conversion.

  19. #19
    Quote Originally Posted by PaulStoffregen View Post
    Teensy 3.1 has 5V tolerant digital pins. You can connect 5V logic signals directly. Only the digital pin have this, so don't drive the analog only pins this way.

    For Teensy-LC or Teensy 2.0 at 3.3V, resistor dividers work if you can live with slow speed and wasted power when the signal is high. For high speed, a 5V tolerant logic chip is best. My favorite is usually 74LCX.
    One question about the 74LCX, I had a quick look and none of them seem to come in" fat finger bad at soldering friendly" DIP packages, they all appear to be surface mount Have I missed an appropriate family member or do I have to look elsewhere?

  20. #20
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,438
    Quote Originally Posted by Alistair Sheehy Hutton View Post
    One question about the 74LCX, I had a quick look and none of them seem to come in" fat finger bad at soldering friendly" DIP packages, they all appear to be surface mount Have I missed an appropriate family member or do I have to look elsewhere?
    These SOIC Packages are easy to solder. If you can solder DIP you can solder SOIC too :-) Give it a try !
    Last edited by Frank B; 07-30-2015 at 12:19 PM.

Posting Permissions

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