I need a SUPER simple, Bidirectional, Logic Level Converter for one pair of I2C connections. ((( 2x 5V I2C master connections, with 1x Data & 1x CLK pins. As well as 2x 3.3V I2C slave connections, with 1x Data & 1x CLK pins. )))However I have no idea how to do this, and that is why I'm here asking for help.

The only parts I have available during the vacation I'm on right now are are as follows:

Jshwaa

I need a SUPER simple, Bidirectional, Logic Level Converter for one pair of I2C connections. ((( 2x 5V I2C master connections, with 1x Data & 1x CLK pins. As well as 2x 3.3V I2C slave connections, with 1x Data & 1x CLK pins. )))However I have no idea how to do this, and that is why I'm here asking for help.

The Arduino board offers a +5V and a +3.3V supply pins, which can be used for your data voltage rails.

Use NPN transistors, and connect the collector(s) to the respective voltage level that you want to switch, via a pull-up resistor as shown in the pic. Connect the base(s) to the respective line that you want to switch(DATA and CLK) via a current limiting resistor, as shown in the pic. Connect the emitter to common ground of both the I2C devices and your arduino. Connect the receiving line of the I2C device(s) directly to the collector of the respective transistor switching either the 3.3V or 5V line. Keep in mind this will invert the signal, to which you will have to either correct in code or repeat the circuit to invert again, by connecting the base of the second transistor, to the collector of the first, then the receiving line to the collector of the second transistor. Kind of like the circuit in the pic below, without the extra caps and resistors, as this circuit is built for amplifying.

I2C interface should be using open-drain or open-collector drivers so the only problem is ensuring there is a high enough voltage from the pull-ups to register as logic high for the higher-voltage side (and simultaneously not damaging the low voltage side).

I would suggest using a pull-up network that is 1k to 3.3V, 10k to 5v (this provides passive pull up to 3.45V which won't damage 3.3V device but should register as logic high reliably on the Arduino pins - actually the 10k resistor probably isn't needed, it will make things go a little faster as the Arduino's high threshold isn't far below 3.3V.

The important thing is to never drive the SCL and SDA lines high from the higher voltage side. This means on the Arduino your code (or the I2C library code) must never simulateously set pinMode to OUTPUT while digitalWrite is HIGH.

I found this but I don't have 4 caps, nor do I have 4.7k-Ohm resistors, but I assume I don't need 4.7k exactly and two 10k's in parallel will work... and I also assume I don't need the caps in order for this to work right?

one problem I face in using the design from the schematic above is I don't know how to use it... meaning how to wire it up to my Arduino and the slave I2C device, and how to use the "Enable <= Vcc-" / "Enable <= Vcc"

This is another idea I have, I need some opinions on.

Also @ MarkT I'm going to use the wire library as I don't have enough experience to do any thing more complicated than understanding hexadecimal to decimal conversion using just my brain and nothing else (not even paper and pencil)

I2C is an open-drain bus so it needs pullup resistors, that circuit doesn't have any.

Also, the 3v3 signal is being reduced to ~2v5 by the single diode, IIRC that is right on the edge of a valid logic high and will probably be unreliable.

I think something similar to what you have may work but without redrawing I can't get my head around it.

______Rob

what if i cut the wire between the single diode and 5v pin. Then add a 2n3904 and connect the base to a 10k then the 10k get connected to the diode. Then connect the collector to 5v supply pin, and emitter to the other wire that i cut that is now unconnected/the anode closet to the 5v i2c pin... I would have the 5v needed and no longer 2v5

Jshwaa

Don't know if you guys were paying attention, but cyclegadget found the solution.

Quote

I have bought a couple of these logic level converters. I haven't tested them yet but, they are really small easy to setup.

http://www.sparkfun.com/products/8745

If you look at the schematic to the device, it uses a simple voltage divider to take 5 down to 3.3, and almost precisely illustrates the same scheme for stepping up the voltage as I suggested, but uses a JFET instead of a BJT. $2, done.

If you look at the schematic to the device, it uses a simple voltage divider to take 5 down to 3.3, and almost precisely illustrates the same scheme for stepping up the voltage as I suggested, but uses a JFET instead of a BJT. $2, done.