EEVblog Electronics Community Forum

Electronics => Beginners => Topic started by: theatrical scene on January 22, 2019, 12:05:03 am

Title: Logic Level Shifters?
Post by: theatrical scene on January 22, 2019, 12:05:03 am
I'm working on a project which uses 3.3V from a Raspberry pi with 5V peripherals. I only need to send/receive data in one way (so the logic level shifter wouldn't have to be bidirectional). I'm choosing between these two parts: http://www.ti.com/lit/ds/symlink/cd4050b.pdf (http://www.ti.com/lit/ds/symlink/cd4050b.pdf) and http://www.ti.com/lit/ds/symlink/txb0108.pdf (http://www.ti.com/lit/ds/symlink/txb0108.pdf).

Is the latter component overkill for simple digital IO conversion? I assume a standard buffer like the first component would be able to shift up signals if I supplied 5V to VCC with a 3.3V input signal but the data sheet has no mention of this and rather highlights the 4050B's use as a 'high to low' shifter as opposed to low to high. Is my assumption valid or am I missing something?

Cheers
Title: Re: Logic Level Shifters?
Post by: oPossum on January 22, 2019, 12:28:22 am
CD4050 is only for 5V to 3.3V (74AHC series can also be used). For the other direction 74HCT series parts can be used, such as 74HCT244 and 74HCT125.
Title: Re: Logic Level Shifters?
Post by: theatrical scene on January 22, 2019, 01:59:56 am
Low bandwidth (around 20KHz), delay budget not too critical, no restrictive cost requirements (within reason), bus width of 6-8.
Title: Re: Logic Level Shifters?
Post by: Mr.B on January 22, 2019, 02:04:44 am
When I am level shifting I2C (bus width = 2) I simply use a couple of cheap FETs and a few resistors.
Dead simple.
Google *FET level shifter*
Title: Re: Logic Level Shifters?
Post by: theatrical scene on January 22, 2019, 02:06:23 am
CD4050 is only for 5V to 3.3V (74AHC series can also be used). For the other direction 74HCT series parts can be used, such as 74HCT244 and 74HCT125.


Thanks for that, will have a look. The RPi has uses both inputs and outputs which means I would need to get both the 74HCT and 74AHC parts right (for low-high level shifting and high-low)? Would it make it easier to just use a single bidirectional converter like the TXB0108 even though my signals are unidirectional (i.e. either outputs or inputs)? 
Title: Re: Logic Level Shifters?
Post by: oPossum on January 22, 2019, 02:10:26 am
74LVC1T45 if you don't mind tiny SMD parts. That can go either direction.

I have not used the autosense level shifters, but have read that they can be twitchy.
Title: Re: Logic Level Shifters?
Post by: oPossum on January 22, 2019, 02:17:18 am
The RPi has uses both inputs and outputs which means I would need to get both the 74HCT and 74AHC parts right (for low-high level shifting and high-low)?

Yes. Forgot to mention the 74xxx541. That has a pinout that can be easier to work with than the 74xxx244.
Title: Re: Logic Level Shifters?
Post by: beanflying on January 22, 2019, 02:19:29 am
Have a read of this recent topic too https://www.eevblog.com/forum/beginners/best-way-to-drive-a-5v-ttl-line-with-a-3v3-gpio/msg2046028/#msg2046028 (https://www.eevblog.com/forum/beginners/best-way-to-drive-a-5v-ttl-line-with-a-3v3-gpio/msg2046028/#msg2046028)
Title: Re: Logic Level Shifters?
Post by: theatrical scene on January 22, 2019, 02:22:58 am
The RPi has uses both inputs and outputs which means I would need to get both the 74HCT and 74AHC parts right (for low-high level shifting and high-low)?

Yes. Forgot to mention the 74xxx541. That has a pinout that can be easier to work with than the 74xxx244.

Thanks, is there a version of this (or similar part) with 6-8 buffers built into a single package?
Title: Re: Logic Level Shifters?
Post by: mvs on January 22, 2019, 08:53:13 am
Low bandwidth (around 20KHz), delay budget not too critical, no restrictive cost requirements (within reason), bus width of 6-8.
In this case i would not work with GPIOs of raspberry pi directly. Have a look on SPI shift registers, 74hct595 for outputs and 74hct165 + one resistor divider for inputs. You can connect them in a chain to use only one SPI port.

I2C GPIO expanders (PCF8574) may also do the job if you level shift I2C bus.
Title: Re: Logic Level Shifters?
Post by: Zero999 on January 22, 2019, 09:39:06 am
The RPi has uses both inputs and outputs which means I would need to get both the 74HCT and 74AHC parts right (for low-high level shifting and high-low)?

Yes. Forgot to mention the 74xxx541. That has a pinout that can be easier to work with than the 74xxx244.

Thanks, is there a version of this (or similar part) with 6-8 buffers built into a single package?
Replace the xxx in those part numbers with HCT, for low to high and AHC for high to low. The 74xxx14 is a good hex inverting buffer and has Schmitt trigger inputs.
Title: Re: Logic Level Shifters?
Post by: FrankBuss on January 22, 2019, 09:51:49 am
The RPi has uses both inputs and outputs which means I would need to get both the 74HCT and 74AHC parts right (for low-high level shifting and high-low)?

Yes. Forgot to mention the 74xxx541. That has a pinout that can be easier to work with than the 74xxx244.

Thanks, is there a version of this (or similar part) with 6-8 buffers built into a single package?

74LVC8T245 has 8 buffers, and one pin to decide the direction control, which you can just tie to VCC(A) or GND for a fixed direction.
Title: Re: Logic Level Shifters?
Post by: Zero999 on January 22, 2019, 02:10:58 pm
There's also the CD40109B, which is slow but can come in handy, especially for higher voltages.
http://www.ti.com/lit/ds/symlink/cd40109b-q1.pdf (http://www.ti.com/lit/ds/symlink/cd40109b-q1.pdf)
Title: Re: Logic Level Shifters?
Post by: theatrical scene on January 22, 2019, 10:46:38 pm
The RPi has uses both inputs and outputs which means I would need to get both the 74HCT and 74AHC parts right (for low-high level shifting and high-low)?

Yes. Forgot to mention the 74xxx541. That has a pinout that can be easier to work with than the 74xxx244.

Thanks, is there a version of this (or similar part) with 6-8 buffers built into a single package?

74LVC8T245 has 8 buffers, and one pin to decide the direction control, which you can just tie to VCC(A) or GND for a fixed direction.

That looks very cool! I like the ability to control the DIR pin. Out of interest, is there a reason why I might use http://www.ti.com/lit/ds/symlink/txb0108.pdf (http://www.ti.com/lit/ds/symlink/txb0108.pdf) over a 74LVC8T245 or is the TXB more useful in a bidirectional application?
Title: Re: Logic Level Shifters?
Post by: Doctorandus_P on January 23, 2019, 12:29:03 am
Those TXB0108 are sort of overkill, but you can use them all the same.
Ali / Ebay / China sells breakout boards with them, and the price and size of these breakout boards is about the same as a postage stamp.

Often you can also use the good old 74LSxxxx logic as level converters. Those old transistor outputs can not deliver much current if the output gets above 3V3
Title: Re: Logic Level Shifters?
Post by: FrankBuss on January 23, 2019, 10:57:48 am
That looks very cool! I like the ability to control the DIR pin. Out of interest, is there a reason why I might use http://www.ti.com/lit/ds/symlink/txb0108.pdf (http://www.ti.com/lit/ds/symlink/txb0108.pdf) over a 74LVC8T245 or is the TXB more useful in a bidirectional application?

If you know the direction, it is always better to use a chip where you can set it. Look here for details:

https://www.eetimes.com/document.asp?doc_id=1231111 (https://www.eetimes.com/document.asp?doc_id=1231111)

Quote
Another implementation (Figure 4) does not require the direction control signal, but in turn has a restriction on the drive strength of the output transistors. In a DC state, the output drivers can maintain a high or low, but are designed to be weak, so that they can be overdriven by an external driver when data on the bus starts flowing in the opposite direction.

Depends on your application, if this works for you.