5v to 3.3v level shifter IC in DIP format

I've been looking on the internet for simple through hole ICs for level shifting, from 5V to 3.3V, and I found lots of info but I'm pretty sure there is a lot of crap circuits and solutions around. I bought the 74HC245, just to find a couple of Google searches later that it is not the best solution. Now it looks like the 74HCT4050 is a sure thing, but I wasn't able to find it in local shops.

I want it to interface Arduino with SD cards, accelerometers and such stuff, using soething "better" than just a resistor divider. What are the bes solutions? Regards

Philips has an application note on this very topic. Google Philips i2c level shift.

The best level shifter is to not do it.

Could you duplicate the Sparkfun version https://www.sparkfun.com/products/8745 using through hole components?

Riva: Could you duplicate the Sparkfun version https://www.sparkfun.com/products/8745 using through hole components?

That shouldn't be difficult, the board is just an N-channel MOSFET and biasing resistors for each direction. Getting two of an appropriately rated transistor in through-hole packaging might require going to one of the larger electronics suppliers, but that's not a problem.

Edit: Sorry, I initially overlooked the implication that you wanted a local source. I don't know how it is in Argentina, but I imagine through-hole MOSFETs are still more likely to be available than specific ICs in the local shops.

Could you duplicate the Sparkfun version https://www.sparkfun.com/products/8745 using through hole components?

Yes. The sparkfun version is one implementation of the Philips bi-directional level shifter. It does have specific requirements on the devices - but none requires smt parts.

Thanks Riva, this is great. I'll have to do some research to find a suitable THT replacement for the BSS138.

Maybe the 2N7000 (like here http://husstechlabs.com/support/tutorials/bi-directional-level-shifter/). The Gate Threshold Voltage 0.8 - 2.1 - 3 (Min - Typical - Max). It's not as good as the BSS138 but it might work (if I can get them here, shouldn't be that complicated), is that right?

If someone knows an IC that solves the problem, it would be much easier. Don't now if the 74HCT4050 or the CD4050 are adequate.

I use the TXB0108 as it is very versatile. Granted this is in a tiny TSSOP package, but there are breakout boards which bring out the pins into what is almost a dip package (it is actually 0.5" across not 0.6" like a standard wide format DIP package, but for most cases this doesn't matter), such as this one: http://www.adafruit.com/products/395 .

If someone knows an IC that solves the problem, it would be much easier.

the 74HC4050 does exactly what you want

but I wasn't able to find it in local shops.

and thats why local shops suck, they are great to poke around, and maybe chit-chat, buts its guaranteed they never have what you want, go online, and find some other crap you need to justify the shipping charges and get what you need, rather than rolling your own out of transistors. Which btw, is better than resistors, but still not all that great.

is that right?

Yes. It will work. And even a regular mosfet will work; or a NPN transistor in place of the mosfet, plus another resistor and an optional diode, will work as well.

And if your signal is active low (aka i2c or rs232), a resistor + a diode will work as well.

The NXP (Phillips) app note AN10441 (attached) is a really great and simple/inexpensive Bi-Directional level shifter for IIC or SPI level shifting. The BSS138 is used in the adafruit level shifter… I’ve built 2 Level Shifters using a 2N7000 for the Fet (2 required) and 2 pull-ups each for the 5V and 3V3 sides are also necessary but those are necessary anyway you try it. I would also recommend 1K (3V3) and 2K2 ohm (5V) pull-ups as the small amount of extra bus current will help the noise immunity of the bus as well…

Bob

AN10441.pdf (52.4 KB)

Thanks Docedison. I´ll be buying the 2N7000 to buils it.

Regards.

There is an alternate method with some extra parts and NPN transistors (2 1n4148's and a 3K3 resistor) I simulated it after having given it a day's thought and it worked (Valid Simulation) when I ran it through Multisim 11, as did the Mosfets, the diodes take the place of the Mosfet's "Body Diode" and the resistor is to set the base bias. The level shifters are modeled after a TTL Gate input...

Bob

Thanks for the input. I need a 3.3V to 5V level translator from my Adafruit thermocouple breakout bd and my Ruggeduino because it doesn't work well with a 3.3V level input. My Genuine Arduino UNO and my Sainsmart UNO-R3 (has 3.3V-5V logic Select Switch !) both work fine but not the Ruggeduino. Don't know why.

presumably the resistance of the ruggeduino protection circuits drag the logic level down to below the threshold of the pins.

pgmartin:
I bought the 74HC245, just to find a couple of Google searches later that it is not the best solution. Now it looks like the 74HCT4050 is a sure thing, but I wasn’t able to find it in local shops.

HC series is not level shifting, they have full protection diodes on the
inputs - trying to feed them 5V signals whilst powered from 3.3V will pull the 3.3V
rail up to 4.5V or so and probably damage something…

HCT series can only be used to raise 3.3V signals to 5V, they must be powered at 5V.

The LVC family are 1.6 to 3.3V powered and 5.5V input tolerant, although I can’t recall
if they are readily available in DIP. 74LVC245 gives you 8 buffers from 5V → 3.3V, but
can’t map the other way (though you don’t normally need to, Arduinos should read 3.3V
as HIGH).

I want it to interface Arduino with SD cards, accelerometers and such stuff, using soething “better” than just a resistor divider. What are the bes solutions?
Regards

Better means what exactly? You do need fairly low impedance resistor dividers because
SDcards need fast edges, I’ve used 1k/2.2k before, but that’s rather marginal for 8MHz
SPI.

For I2C bus you just put pull-up resistors to 3.3V, it should just work (if the I2C
driver correctly uses open-drain). True open drain and open collector outputs will drive any voltage from any voltage, Arduino I2C bus isn’t true open-drain so you have to limit
the output to 5V.

Very informative. (and comprehensive)
Thanks !
I was actually thinking of using this method (see attached).
Do you think I should use the 74LVC245 instead ?

i2c-level-shift-mosfet.png

HC series is not level shifting, they have full protection diodes on the inputs - trying to feed them 5V signals whilst powered from 3.3V will pull the 3.3V rail up to 4.5V or so and probably damage something...

Even though the post is old, I want to clarify this information. I believe it is wrong or only partially correct.

From the ST Microelectronics M74HC4050 datasheet, July 2001

Input protection circuits are different from those of the high speed CMOS IC’s. The Vcc side diodes are designed to allow logic-level conversion from high-level voltages (up to 13V) to low level voltages.

so it IS level shifting.

Maybe other 4050 manufacturers have differenct specs?

Can the 3.3v output be controlled by the microprocessor or is it always on? I need it to control a relay. Thanks!

pmcamach: Can the 3.3v output be controlled by the microprocessor or is it always on? I need it to control a relay. Thanks!

The arduino board has a 3.3V voltage regulator on board. The pin is the output of this voltage regulator. Therefore this pin can not be controlled by the microprocessor.

However I doubt you need 3.3V to control a mechanical relay. What relay are you talking about? Please post a link to the technical specification of your relay. I am speculating here that you actually want to control a SSR relay. Here's a random SSR datasheet: http://cdn-reichelt.de/documents/datenblatt/C300/WGA%205-6D25.pdf

The relevant info:

Control Voltage Range 3 - 32 DC Control Current Max. 34 mA Input Resistance 900 Ohm

This means ANY voltage between 3 and 32 V will be okay to control the SSR.

With 5V (output voltage of an Output pin), the SSR will draw

I = U/R = 5V/900 Ohm = 5.6 mA

The Arduino can supply max 200mA alltogether, and max. 20mA per Pin (if I remember the datasheet correctly). So as long as you don't have other big loads on the arduino, you can connect this kind of SSR directly.

You need a microprocessor output pin to control your relay. More information:

https://www.arduino.cc/en/Tutorial/DigitalPins

Thomas

Here's some more information on level shifters from another conversation.

Project is based on an arduino mega, which has to run at 16Mhz, therefore 5V power supply is mandatory. At the same time, I want to use one of the 2.4 inch ILI9341 SPI displays, which come with a built in SD card reader, which is nice. These displays have a 5V to 3.3V power converter on board. However they are very cheaply made, and the signal level shifting is done with in series resistors. (implicitly relying on the built in clamping diodes of the display and the SD to do the level shifting) This didn't work on some SD cards for me. I had sporadic errors, and downright failing SD cards.

With a level shifter, everything is fine now. The in series resistor on the display PCB doesn't harm.

The LCD modules and SD modules from adafruit, sparkfun etc. all have level shifters on their PCB (either with the 4050 IC, or discrete with transistors), so I believe this is a tried and tested method to connect 3.3V peripheral equipment to 5V microcontrollers.

That certainly is the most reliable method, particularly if you are going to use the maximum speed with hardware SPI. For less than a Megahertz, the diodes and resistors (not resistive dividers) should work. And these "super diode" level shifters: http://www.ebay.com/itm/5PCS-5V-3V-2-CH-I2C-IIC-Logic-Level-Converter-Module-Bi-Directional-for-Arduino-/401234225236