So I've been reading a few threads here and on other forums. I understand there are various solutions for stepping down or up a voltage. What I have found are the LVC series shift regs that give a constant ouput, MCP1825 which will step down 5 to 3.3 (and other versions which have different increments) the 74LCX245 which will step 2.5 or 3.3 to 5v and perhaps some others I am forgetting. Then there are ready made boards such as the Sparkfun converters or this 8 pin to 8 pin converter. But all of these are one direction only, or bi-direction switched by a jumper.

How would I convert voltages down or up in both directions without requiring a pin select.

5--3.3

5--2.5

5--1.8

thanks

up vote 7 down vote accepted

Sparkfun has a tutorial on sensor interfacing/logic-level conversion that might be useful to you.

  • 1
    thanks. summarization of the tutorial: * Inline Resistor. Uni-directional. Step-down only. -- reduces current, IC's i/o clamping diodes can them limit max input. * Series Resistors Uni-directional. Step-down only, but granular. * Diode Uni-directional. Step-down. Safer. High from 5v blocks Diode; 3.3v side then ties to high. But, if you reverse diode configuration couldnt you also step-up? * Mosfet Bi-directional. Step-down or Step-up. From comments: * Optical isolation example: 4N25. high current. * Zener diode example: 1N4728A * 74HC244/125 Uni-directional – cyphunk Nov 24 '09 at 1:03
  • Ah, I didn't realize the mosfet works in both directions, from their page it looked like it only worked one way, especially the line about "This circuit will not work the other direction (high voltage to low voltage)". But after reading the PDF from Phillips Semi, it's clear to me. – davr Nov 24 '09 at 20:55
  • Davr, MOSFETs can be used to create one direction or bi-direction. A single MOSFET is one direction. A few MOSFETs and you can create a circuit with an Vin for each side of the shifter and is fully bidirectional. – Kortuk Nov 25 '09 at 6:01
  • davr. I read "will not work the other direction" as meaning that low voltage connection must be on the left of the MOSFET and high on the right and hence it is not directly related to the uni/bi-directionality of the schematic. After reading the Phillips PDF I assume that the single MOSFET layout at sparkfun is bi-directional, or Kortuk am I wrong? – cyphunk Nov 25 '09 at 11:11

Maxim has a bunch of Logic Level Translators, most of which are bidirectional. The speeds vary, the fastest supports 100 MBit/sec max data rate, which should cover pretty much anything you'd ever want to do at a hobby level. Voltages range from 0.9V to 5.5V.

You're working with an I2C bus, right? I'm going to call the lines on the 3.3 V side SDA3 and SCL3; the two lines on the 5.0 V side SDA5 and SCL5.

"MOSFET and two resistors"

As todbot and cyphunk already pointed out, the "MOSFET and two resistors" circuit described in the SparkFun "sensor interfacing" tutorial does what you want: The logical data flow is symmetric -- data flows in both directions on the SDA lines, from the low side to the high side and, milliseconds later, from the high side to the low side.

The "will not work the other direction" note points out the circuit is physically asymmetric: your 5.0 V I²C device must be connected to the "high side", your 3.3 V device must be connected to the "low side". Because the circuit is physically asymmetric, it's certainly not obvious that it is logically symmetric. (That tutorial links to a AN97055 application note that shows a "two MOSFETs and two resistors" circuit that is physically symmetric, and therefore is obviously logically symmetric).

The lines labeled "TX" on the SparkFun converters -- that the original poster pointed out -- implement that "MOSFET and two resistors" bidirectional circuit. So connect SDA3 to TX_LV, SDA5 to TX_HV, SCL3 to TX2_LV, and SCL5 to TX2_HV.

Then data flows in both directions: When your low-side device drives the SDA3 and SCL3 pins, the appropriate voltages are seen on the high-side SDA5 and SCL5 pins. Milliseconds later, when the high-side device drives the SDA5 and SCL5 pins, the appropriate voltages are seen on the SDA3 and SCL3 pins.

(Inconsistently, the lines labeled "RX" on that converter board will only transmit data in the high-voltage to low-voltage direction.)

Bi-directional optoisolator

Since you are using I²C, you might also be interested in a bi-directional optoisolator for I²C. The two-optoisolator circuit is more expensive and slower than the "MOSFET and two resistors" circuit, but it works when one side has signals that swing between 0 V and 5.0 V, and the other side has signals that swing between 500.0 V and 505.0 V.

The two-optoisolator circuit is also completely physically symmetric -- and therefore logically symmetric -- it doesn't matter which side is the high side and which side is the low side.

On one of our boards we use a TXS0104E to translate between 3.3V and 5V on an I2C bus (bi-directional).

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.