2x i2c devices + level shifter = issues...

I have two i2c devices and an arduino nano v3. One is an ssd1306 OLED display that is 3.3v. The other will work with either 3.3v or 5v(INA226), so I decided to use a mosfet level shifter like the link below. I'm using an i2c scanner and it just hangs up and won't do anything. I'm using two IRF8113's, which I had handy. Datasheet below.

I tried with pullups only on the level shifters themselves. That should be fine since both SCL/SDA lines are connected to Source and the Source is pulled up, right? I tried removing the pullup resistors on the OLED display as well as trying with them on.

If I wire the SCL/SCA lines directly to the INA226(with pullup resistors), the scanner picks it up no problem. That device is working just fine with 4.7k or 10k resistors.

So yeah, the real issue here is when I hook up the level shifter, the serial monitor just hangs up. I tried it with either one and both devices connected, as well as nothing connected. I did get it to work one time, but the display was displaying garbage. Tried again after swapping resistors and nothing. Pretty weird.

Any help would be greatly appreciated. Thanks!

mosfet level shifter diagram:


MOSFET I'm using:

http://www.irf.com/product-info/datasheets/data/irf8113.pdf

Can you post a link to this device? ssd1306 OLED display

I found one on Adafruit that is 5 volt compatible. Maybe you are going to too much trouble for a device that is already 5 volt tolerant.

Hi, thanks for the reply. The adafruit displays that say 5v on them have a level shifter and 3.3v regulator on board. They use two mosfets just like I am, iirc. The ssd1306 isn't 5v tolerant. I tried to connect it using 3.3v pullups and while the i2c scanner detects it, it won't display anything.

I just wired up the display to a teensy 3.1 and it worked first try, so it's not damaged or anything.

Here's the datasheet for the ssd1306.

I have already looked at that datasheet. That is the first thing I did before posting a response.

If you are using a "naked" ssd1306, then the inputs are not 5 volt tolerant. That maximum input voltage is 0.3v higher than the supply, which in your case is 3.6 volts maximum.

The ATMega328 has pullup resistors built into the IC. They are connected to the supply voltage, which is 5 volts.

I don't know why the specific MOSFET you are using doesn't work. But I do know it is not the MOSFET used in the level shifter diagram you posted. BTW, I did look at the datasheet for those also, but found no apparent reason why they would not be interchangeable.

Ok, so I believe the issue is that I'm on usb power. I measured 5v and it's reading 4.6v. I measured 3.3v and it's reading 3.2v.

If we go Vh-Vl = 4.6v-3.2v = 1.4v.

VGS(th) typical is even 1.76v and max is 2v. I'm 99.9% sure this is the issue. They're using this mosfet(BSS138). It says in the above link. VGS(th)MAX = 1.5v.