Arduino Forum

Using Arduino => General Electronics => Topic started by: pgmartin on Sep 28, 2012, 07:05 pm

Title: 5v to 3.3v level shifter IC in DIP format
Post by: pgmartin on Sep 28, 2012, 07:05 pm
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
Title: Re: 5v to 3.3v level shifter IC in DIP format
Post by: dhenry on Sep 28, 2012, 07:07 pm
Philips has an application note on this very topic. Google Philips i2c level shift.

The best level shifter is to not do it.
Title: Re: 5v to 3.3v level shifter IC in DIP format
Post by: Riva on Sep 28, 2012, 08:57 pm
Could you duplicate the Sparkfun version https://www.sparkfun.com/products/8745 (https://www.sparkfun.com/products/8745) using through hole components?
Title: Re: 5v to 3.3v level shifter IC in DIP format
Post by: Far-seeker on Sep 28, 2012, 09:30 pm

Could you duplicate the Sparkfun version https://www.sparkfun.com/products/8745 (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.  
Title: Re: 5v to 3.3v level shifter IC in DIP format
Post by: dhenry on Sep 28, 2012, 09:39 pm
Quote
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.
Title: Re: 5v to 3.3v level shifter IC in DIP format
Post by: pgmartin on Sep 28, 2012, 09:50 pm
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/ (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.

Title: Re: 5v to 3.3v level shifter IC in DIP format
Post by: Tom Carpenter on Sep 29, 2012, 01:43 am
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 .
Title: Re: 5v to 3.3v level shifter IC in DIP format
Post by: Osgeld on Sep 29, 2012, 02:11 am
Quote
If someone knows an IC that solves the problem, it would be much easier.


the 74HC4050 does exactly what you want

Quote
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.
Title: Re: 5v to 3.3v level shifter IC in DIP format
Post by: dhenry on Sep 29, 2012, 02:55 am
Quote
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.
Title: Re: 5v to 3.3v level shifter IC in DIP format
Post by: Docedison on Sep 29, 2012, 07:04 am
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
Title: Re: 5v to 3.3v level shifter IC in DIP format
Post by: pgmartin on Sep 30, 2012, 01:19 am
Thanks Docedison. I´ll be buying the 2N7000 to buils it.

Regards.
Title: Re: 5v to 3.3v level shifter IC in DIP format
Post by: Docedison on Sep 30, 2012, 05:32 am
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
Title: Re: 5v to 3.3v level shifter IC in DIP format
Post by: raschemmel on Jan 13, 2014, 08:43 pm
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. 
Title: Re: 5v to 3.3v level shifter IC in DIP format
Post by: Tom Carpenter on Jan 13, 2014, 08:46 pm
presumably the resistance of the ruggeduino protection circuits drag the logic level down to below the threshold of the pins.
Title: Re: 5v to 3.3v level shifter IC in DIP format
Post by: MarkT on Jan 14, 2014, 02:15 am


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).
Quote

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.
Title: Re: 5v to 3.3v level shifter IC in DIP format
Post by: raschemmel on Jan 14, 2014, 02:38 am
Very informative. (and comprehensive)
Thanks !
I was actually thinking of using this method (see attached).
Do you think I should use the 74LVC245 instead ?
Title: Re: 5v to 3.3v level shifter IC in DIP format
Post by: hydrocontrol on Jun 25, 2017, 11:34 pm
Quote
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

Quote
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?
Title: Re: 5v to 3.3v level shifter IC in DIP format
Post by: pmcamach on Jun 28, 2017, 06:57 pm
Can the 3.3v output be controlled by the microprocessor or is it always on? I need it to control a relay. Thanks!
Title: Re: 5v to 3.3v level shifter IC in DIP format
Post by: hydrocontrol on Jun 28, 2017, 08:14 pm
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 (http://cdn-reichelt.de/documents/datenblatt/C300/WGA%205-6D25.pdf)

The relevant info:
Quote
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 (https://www.arduino.cc/en/Tutorial/DigitalPins)

Thomas
Title: Re: 5v to 3.3v level shifter IC in DIP format
Post by: hydrocontrol on Jun 28, 2017, 08:21 pm
Here's some more information on level shifters from another conversation.
Quote
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.
Quote
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 (http://www.ebay.com/itm/5PCS-5V-3V-2-CH-I2C-IIC-Logic-Level-Converter-Module-Bi-Directional-for-Arduino-/401234225236)
Title: Re: 5v to 3.3v level shifter IC in DIP format
Post by: pmcamach on Jun 29, 2017, 02:34 am
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 (http://cdn-reichelt.de/documents/datenblatt/C300/WGA%205-6D25.pdf)

The relevant info: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 (https://www.arduino.cc/en/Tutorial/DigitalPins)

Thomas
Hi Thomas,

Thank you for your reply, I apologize I was not very clear in my question.


What I am trying to do is heat up a small, enclosed environment with a small heater. I plan on connecting a temperature sensor to the arduino (using the 5v out), but once the temperature reaches a certain point, I need the arduino to send a signal to the relay (which is where I would think it would connect to the 3.3v), which will allow power to be sent through to the heater and it will turn on.

Here are the specifications for the relay (PN: R10S-E2Y1-J1.0K): http://www.te.com/commerce/DocumentDelivery/DDEController?Action=srchrtrv&DocNm=1308242_R10&DocType=DS&DocLang=English

It looks like the last link you referred me to will lead me in the right direction, but please let me know if you have any other insight or information that may help. Thank you again!

Paige
Title: Re: 5v to 3.3v level shifter IC in DIP format
Post by: hydrocontrol on Jun 29, 2017, 10:55 am
Quote
I plan on connecting a temperature sensor to the arduino (using the 5v out)
The 5V out will only provide the power for your sensor. Depending on the type of sensor, there are different ways in which the sensor will transmit the temperature to the arduino.

Quote
I need the arduino to send a signal to the relay (which is where I would think it would connect to the 3.3v)
I (and also the contributors in the cross post) have explained in the previous post, why this will not work. Read the part with arduino output pins again.




R10S-E2Y1-J1.0K

The "E2Y1" specifies 1 pole.

the "J1.0K" part specifies the coil.

From the datasheet:

coil operating current: 3.2 mA
coil resistance: 1000 Ohm

U = R * I
= 3.2mA * 1000 Ohm
= 3.2 V

P = U * I
= 3.2V * 3.2mA
= 10 mW

There is no maximum operating current specified, and the datasheet footnote says for this type:
1) Suggested for 5VDC operation

So you can operate it directly from any arduino output pin (these will provide 5V).
You will also need a free wheeling diode to protect the arduino pin. https://en.wikipedia.org/wiki/Flyback_diode (https://en.wikipedia.org/wiki/Flyback_diode)

If you want to be on the safe side, you can add a series resistor to bring down the coil voltage to 3.2V.
I'll leave it to you to do the math.

Thomas
Title: Re: 5v to 3.3v level shifter IC in DIP format
Post by: pjaj on Feb 21, 2018, 03:49 pm
It may be worth taking a look at another member of the 74xxx245 family, the 74LVC8T245. I've not used it myself, but the data sheet
http://www.ti.com/lit/ds/symlink/sn74lvc8t245.pdf  (http://www.ti.com/lit/ds/symlink/sn74lvc8t245.pdf)
shows that it has two different Vcc inputs with a common ground. either of which can be as low as 1.8V, the other as high as 5.5V. It is made in a 24 pin DIL package. It is bidirectional. It is available on Ebay as a mounted smd component on a small board.