CMOS TTL Level Converters: how to?

Hallo People :-) I'm toying around with an ENC28J60 Ethernet Module like this one http://www.geeetech.com/arduino-enc28j60-ethernet-module-p-263.html and I see here that some kind of level converting is needed, since the module uses 3.3v signals and arduino uses 5v signals.

Ok, I'm not a proficient electrician but I like understanding stuff. I see people using different techniques for converting logic levels, the above mentioned schematics shows an SN74HCT08D, I've seen people using tri state buffers, what else?

Any chance someone wrote a decent guide on TTL-CMOS Level Converting that I'm not finding with Google?!? (my bad!)

I'd really love to implement such a level converter in my Arduino-ENC28j60 wiring and I want to be able to choose the most appropriate one, not the first that pops out of a casual internet search.

I can't answer the question you asked about level converters, but I would remind you that the Arduino has a 3.3v volt pin in addition to the 5v pin. If you are using a standard breadboard to power rails on both sides, I could imagine plugging 5v into the left power rail, and 3.3v into the right (or vice versa). Then for things that need 5v, use the left power rail, and for things that need 3.3v, use the right rail.

There are many many ways to do this. A lot depends on what parts you have.

While there is no "best" way there are some sub optimal ways. If you just want to use FETs then this will work:- http://www.sparkfun.com/products/8745

You get different solution if you want a single direction or a bi-direction conversion. http://www.rocketnumbernine.com/2009/04/10/5v-33v-bidirectional-level-converter

Googling "3v3 to 5v level shifter" brings up a lot more.

ww1.microchip.com/downloads/en/DeviceDoc/01146B.pdf I like this guide, even its written for PIC's, but 99% of tip's are applicable for any 8-bits microcontrollers.

3V Tips ‘n Tricks Powering 3.3V Systems From 5V Using an LDO Regulator............................. 8-3 Low-Cost Alternative Power System Using a Zener Diode................................... 8-4 Lower Cost Alternative Power System Using 3 Rectifier Diodes. ............................ 8-4 . Powering 3.3V Systems From 5V Using Switching Regulators........................ 8-5 3.3V ? 5V Direct Connect.......................... 8-6 3.3V ? 5V Using a MOSFET Translator. ... 8-6 . 3.3V ? 5V Using A Diode Offset. ............... 8-7 . 3.3V ? 5V Using A Voltage Comparator. ... 8-8 . 5V ? 3.3V Direct Connect.......................... 8-9 5V ? 3.3V With Diode Clamp..................... 8-9 5V ? 3.3V Active Clamp.............................8-10 5V ? 3.3V Resistor Divider........................8-10 3.3V ? 5V Level Translators......................8-12 3.3V ? 5V Analog Gain Block....................8-13 3.3V ? 5V Analog Offset Block..................8-13 . 5V ? 3.3V Active Analog Attenuator...........8-14 5V ? 3V Analog Limiter..............................8-15 Driving Bipolar Transistors..........................8-16 Driving N-Channel MOSFET Transistors....8-18

The Fet level shifter in NXP APP Note AN10441 is both B-Directional and easy to implement, requires 2 2N7000 or Equivalent Mosfets and 4 pull-ups 2 to the 3V3 Source and 2 to the 5V source each 4K7 ohms and either one or both can be used. I had an issue with a Bosch BMP085 Sensor and this solution worked very well for me.

Doc

From the playground:

http://arduino.cc/playground/Main/I2CBi-directionalLevelShifter

EMI the page you referred him to is half correct... there is an issue with the 3V3 supply and that is that it cannot sink current, a 4K7 resistor connected between 5V and 3V3 will pull up the 3V3 source to about 4V7 or so with the potential of damaging the 3V3 components powered by the 3V3 source. The level shifters can be implemented easily and are a sure way of knowing that your measurements are correct.

Doc

There are SMD parts on breakout boards also http://www.sparkfun.com/products/10403 or parts like TI's TXB0102 http://www.ti.com/lit/ds/symlink/txb0102.pdf available in several package sizes depending on how many buffers you need: TXB0101, 0102, 0104, 0106, 0108

Magician: ww1.microchip.com/downloads/en/DeviceDoc/01146B.pdf I like this guide, even its written for PIC's, but 99% of tip's are applicable for any 8-bits microcontrollers.

That's cool! I didn't know about that. Nice lecture ... I will bring that with me on the shore ;-) No, really, impressive collection of tips! Thanks :-)

Grumpy_Mike: While there is no "best" way there are some sub optimal ways.

That's what I'm looking for ... a sub-optimal solution :-) Well, really, I understand what you mean and I'm fine with that, I'd like to know more about those sub-optimal ways, because I know I will have to use them and choose the most appropriate one from time to time.

I did read those two pages you suggested, but I'm not looking for a specific pre-made board/IC/schematics here. I'd really wish to learn about the basics first.

Btw, I'm mostly intrigued by the use of those Logic ICs (the tri state buffers and the AND gates). I see many use them in order to convert signal levels (with unidirectional signals at least). As you see, I started playing around with signals to/from an ENC28J60 which talks SPI ... that's no I2C, I don't need any bidirectional translators as of now.

Grumpy_Mike: A lot depends on what parts you have.

I have a bunch of logic gates at hand, shure I'd use them if needed :-)

One such method is to use resistive potential dividers, that is sub optimal or as we say in electronics, crap.

Also this translator from one of the forum members here in MA.

MichaelMeissner: I can't answer the question you asked about level converters, but I would remind you that the Arduino has a 3.3v volt pin in addition to the 5v pin. If you are using a standard breadboard to power rails on both sides, I could imagine plugging 5v into the left power rail, and 3.3v into the right (or vice versa). Then for things that need 5v, use the left power rail, and for things that need 3.3v, use the right rail.

Although this is true, the ENC28J60 ethernet chip the OP mentioned takes 150mA, and the 3V3 supply on many Arduino's can't produce more than 50mA. In general a separate LDO 3V3 regulator is a good idea as it will perform better than the built-in supply and take more abuse (and it you happen to damage it you can replace it without soldering).

Grumpy_Mike: One such method is to use resistive potential dividers, that is sub optimal or as we say in electronics, crap.

Well, I can do sub-optimal, that may be enough for me ... but "crap"? Really? I'd never tought you could suggest "crap" solutions :fearful: I'm willing to compromise between "perfect" and "just good enough to work sometimes" ... but not "crap"!!!!

MarkT:

MichaelMeissner: I can't answer the question you asked about level converters, but I would remind you that the Arduino has a 3.3v volt pin in addition to the 5v pin. If you are using a standard breadboard to power rails on both sides, I could imagine plugging 5v into the left power rail, and 3.3v into the right (or vice versa). Then for things that need 5v, use the left power rail, and for things that need 3.3v, use the right rail.

Although this is true, the ENC28J60 ethernet chip the OP mentioned takes 150mA, and the 3V3 supply on many Arduino's can't produce more than 50mA. In general a separate LDO 3V3 regulator is a good idea as it will perform better than the built-in supply and take more abuse (and it you happen to damage it you can replace it without soldering).

I've read that before elsewhere, nice for you to mention it again. That 3v3 Arduino pin is tempting sometimes :-)

I’m willing to compromise between “perfect” and “just good enough to work sometimes”

One man’s crap is anthers solution. It is a crap solution because it only “works” under very specific conditions, circumstances and values. In other words it is not a repeatable solution that can be applied in all, or a definable number of cases.

I’d never tought you could suggest “crap” solutions

I wasn’t suggesting it as a solution I was using it to illustrate a sub optimal solution that you seemed interested in.

Grumpy_Mike:

I'd never tought you could suggest "crap" solutions

I wasn't suggesting it as a solution I was using it to illustrate a sub optimal solution that you seemed interested in.

Yes, surely I was. So I appreciate the suggestion. Something more to consider.