Electronic – i2c over gpio – level shifter

expandergpioi2clevel-shifting

I'm quite new to this. I have just basic background in electronics. So I would appreciate an advice from someone more experienced.

I would like to connect an i2c display to my tp-link wr703n (ar9331) router gpios. Router is running linux and uses kernel module to simulate i2c interface using gpios. The display is hd44780 connected to the pcf8574 i2c expander.

The display operates at 5V while gpios are probably 2.5v+-10% tolerant. I checked the datasheet of ar9331 but not sure what is maximal voltage for high level. There some reports of people having gpio pin pulled up to 3.3V and running it just fine. So I'm not sure about the pullup voltage on the gpio.

But anyway I probably need some level shifter. I tought I could do something like this.

Vc1 2.5V? ---------------       ------------ Vc2 5V
                 |      |       |   
                 X      |       X   
            4k7R X      |  4k7R X      
                 X      |       X   
                 |      |       |   
 gpio-7 --------------[FET]------------------ pcf8574

same for gpio-29

I'm not sure which N-FET to use for this. Usually people use 2n7000 which has typical Vgs threshold 2.1V but maximum is 3V. So I guess this one could not work properly if the threshold of used FET would be 2.5V or more.

And is this good thing to do anyway?

EDIT2: I've added better picture of the circuit.

schematic

simulate this circuit – Schematic created using CircuitLab

Best Answer

There are specialized ICs for I2C level translation. PCA9306 (down to 1.8V),TCA9517 (down to 0.9V), FXMA2102 (down to 1.65V). IC level shifter would be my choice.

@Laszlo had mentioned AN97055 by Philips (now NXP).
Excerpt from that app note (p.13).

3. CHARACTERISTICS OF THE MOS-FET’S.

The requirements for the most important characteristics of the MOS-FET’s, used as bi-directional level shifter in an I2C-bus system with max. 6V and min. 2.7V levels, are listed below. The values are intended as an indication and may be adapted for other supply voltages, other logic levels and/or other applications.

Type : N-channel enhancement mode MOS-FET.
Gate threshold voltage : VGS(th) min. 0.1V max. 2V
On resistance : RDS(on) max. 100 Ohm @ ID = 3mA, VGS = 2.5V
Input capacitance : Ciss max. 100 pF @ VDS = 1V, VGS = 0V
Switching times : ton toff max. 50 ns.
Allowed drain current : ID 10 mA or higher.