# Bidirectional level swiching 5V <-> 3.3V

I am looking to interface a 3.3V device with a 5V one. This will require the shifting of the logic levels between the two devices.

Doing this in one direction is a trivial matter, but I need to do it in both directions (reading and writing - it's a data bus).

I know there are bus drivers that can do this but I'm a skinflint, so I'm looking to see if I can do it with the discretes I have at my fingertips.

I came up with this circuit:

I don't know if it will actually do what I want, but from reading other sources (including Is it possible to drive TTL inputs from 3.3v microcontroller and Bi-Directional Step up and Step down (3.3v <-> 5, etc) [the latter mentions a sparkfun tutorial that no longer exists]) it might.

My thinking is, data from 5v to 3.3v goes through D2 and the series resistor R2 to drop the voltage. Data from 3.3v to 5v goes through D1 and gets pulled up by R1.

Would this work? Is it complete gibberish?

Update

Ok, so we have agreed that circuit is total gibberish.

I have made some tweaks, and come up with this:

Playing around with my scope gives me levels of around 1V-4V on the +5V side, and 0V to 3V on the 3.3V side. Both sides default to a high level and connecting to ground on one side causes a low level on the other side.

The resistors are all 10KΩ, and I have had both ends feeding through 100KΩ resistors to simulate some form of load. The diodes are all Schottky.

Thoughts?

• How does the 3.3V side force the 5V side low, and vice versa? Jul 13, 2011 at 15:39
• The sparkfun tutorial is now at sparkfun.com/tutorials/65 Jul 13, 2011 at 15:52
• 1V is too high for a low level if you need TTL levels; low is 0.8V maximum. Jul 13, 2011 at 16:09
• @Brian - I rolled back because the original schematic is relevant, even if it's wrong. Answers refer to it, so you wouldn't know what they're talking about, and there's also something to be learned from a wrong circuit; why it doesn't work, for instance. Jul 13, 2011 at 17:03
• Do you have logic-level FETs available? I'm surprised you're not using some form of active level translation. Jul 14, 2011 at 0:09

I think the easiest circuit that does what you want would use a N channel MOSFET like the bss138 and two pull-ups, hooked in the following way:

Tell me if it doesnt fit your needs, and why.

Having said this, I have to recommend you to take a look at the MAX3000 series of level converters. I have used them before and they are great bidireccional converters that "simply work" (in apple terms).

Hope it helps.

edit: It seems like the image appears broken with some browsers, you can see it here

• Broken image - please may you reupload the image.
– Dean
Jul 13, 2011 at 21:04
• I have ordered a couple of MAX3000 series as samples, but they require 'business manager approval' before they can be sent... :L The only FETs I have are MOSFET power FETs - also :L Jul 14, 2011 at 7:34
• The MOSFET technique is explained in this appnote (I also reference to it in my answer) Jul 14, 2011 at 9:18
• @Matt-Jenkins Yes, obtaining samples or even trying to buy electronic components is a wild adventure lately. We are having many problems at work because we use many ON semiconductor and nippon chemicon parts... they seem to be manufactured near Fukushima... Jul 14, 2011 at 15:33

I vote gibberish :-).
You won't get much voltage drop over R2 since there will hardly be any current, and therefore the diode won't drop much voltage either. If your 3.3V device isn't 5V I/O compatible you may fry it this way.
Also if the 3.3V device outputs a low level we can ignore D1, and the level at the 5V input will be determined by R1, D2 and R2. R1 + R2 will lift the low level up to a certain level, and the diode will add another 0.7V, so the level seen on the 5V side may not be low at all.

Back to the drawing board?

edit
Have a look at this NXP appnote. Very elegant solution, without special level shifter IC.

• Hmmm... I am experiencing something like that on the breadboard. My 5V side low is ending up around 3V. Jul 13, 2011 at 15:50
• @Matt - what values are the resistors? Jul 13, 2011 at 15:51
• Undefined as yet ;) Jul 13, 2011 at 15:58
• See my edit.... Jul 13, 2011 at 16:05

That circuit is broken. Just for one, consider the case of the left side driving 5V and the right side high impedance. The right side will go to 5V minus the diode drop. It's also broken for other cases. Go thru all 4 possible cases you'll see the result isn't what you intended.

You are wasting time trying to play games with level shifting. If you really want to do it yourself, shouldn't you be starting with beach sand and refining your own silicon? At best you'll end up with something that's bigger and clunkier than a deliberate level shift IC.

Single line level shifters come in SOT-23 packages and include a direction line and resulting high impedance states depending on direction. If you need to translate multiple parallel lines with the same direction signal, then the integrated solution is even smaller per line.

However, the best way to deal with this is architect the system to need as few level shifts as possible. Sometimes that's impossible or impractical, but a whole bus requiring level shifts is a bit of a red flag. Also note that 5V inputs with TTL levels (like 74HCTxxx chips for example) work directly from 3.3V outputs since 3.3V is above the guaranteed high input threshold.