I2C SDA and SCL

Hello, I did some googling, but I never quit understand how the I2C work. Here is my project: I wired a 2.4" SPFD5408 screen to a nano, it works just fine. I wired up a MPU6050 Accel/Gyro to another nano, it works just fine. Now I want to display data to the 2.4" screen, however, both use the A4 and A5 (SDA and SCL pin.) Here is where I am stuck. As far as I understand, I can have multiple I2C components to communicate, In my reading, some say I need pull down resistor, some say I need pull up resistor, and some says none. I am very confused with the wiring. Can someone explain to me how it really works? Thanks.

You need pull-ups on an I2C bus, not pull down.

Just connect both devices to the same wires, they have different bus addresses so you can talk to them independently.

Is the display running at 5V ? And you are going to add pullup resistors to 5V ? Then you may not connect the 3.3V MPU-6050 sensor to the I2C bus, you have to use a I2C level shifter to create a 5V I2C bus and a 3.3V I2C bus.

Koepel: Is the display running at 5V ? And you are going to add pullup resistors to 5V ? Then you may not connect the 3.3V MPU-6050 sensor to the I2C bus, you have to use a I2C level shifter to create a 5V I2C bus and a 3.3V I2C bus.

Thanks all for the reply. Yes, both devices are using 5V, so is it necessary to have a level shifter?

rich1812: Thanks all for the reply. Yes, both devices are using 5V, so is it necessary to have a level shifter?

It is necessary to have a level shifter for any device that is powered from 3.3V.

rich1812: Yes, both devices are using 5V,

This says otherwise:-

MPU-6050

Supply Voltage Max 3.6V

So if you are feeding that with 5V you will kill it.

Maybe you have it on a board with a built in 5V regulator and level shifters, we don't know. Post a link to both devices you want to use together.

Grumpy_Mike: This says otherwise:-

MPU-6050 So if you are feeding that with 5V you will kill it.

Maybe you have it on a board with a built in 5V regulator and level shifters, we don't know. Post a link to both devices you want to use together.

I am using this I bought from ebay http://www.ebay.com/itm/262434588924?_trksid=p2057872.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT I put it on the Nano 5V pin not problem what so ever.

And I also bought the LCD on ebay http://www.ebay.com/itm/131833515695?_trksid=p2057872.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT Also on 5V, but the funny thing is this does seem to need the A5(SCL)

But when I try to use both devices together, the A4 (SDA) don't like to play together.

And another issue is the D2 interrupt pin, the two devices don't play well either. :(

rich1812: And another issue is the D2 interrupt pin, the two devices don't play well either. :(

You're not connecting them both to the same interrupt pin, are you?

aarg: You're not connecting them both to the same interrupt pin, are you?

aarg: You're not connecting them both to the same interrupt pin, are you?

I did connect them to he same interrupt D2. Can I open a new interrupt on D10 using the attachInterrupt(10,....) function without disabling D2, can arduino have more then one interrupts? Thanks again

Can I open a new interrupt on D10

No. Only certain pins can have interrupts on them. There are only two pins that act like that simple interrupt you have to use the other one because of how the hardware is wired inside the chip. This is D3.

Do you see now why we require this sort of information up front not 9 posts from the start.

Can the mpu-6050 not handle 5v logic inputs?

from the datasheet: Absolute maximums

"Supply Voltage, VDD -0.5V to +6V VLOGIC Input Voltage Level (MPU-6050) -0.5V to VDD + 0.5V REGOUT -0.5V to 2V Input Voltage Level (CLKIN, AUX_DA, AD0, FSYNC, INT, SCL, SDA) -0.5V to VDD + 0.5V"

Has anyone has had one die on them from 5v i2c lines? None of mine have.

Grumpy_Mike: No. Only certain pins can have interrupts on them. There are only two pins that act like that simple interrupt you have to use the other one because of how the hardware is wired inside the chip. This is D3.

Do you see now why we require this sort of information up front not 9 posts from the start.

In that case, is there any way to share interrupt with multiple devices? The 2.4" LCD aleardy occupied interrupt pin D2 and D3, and The MPU6050 needs D2 as well.

alka:
Can the mpu-6050 not handle 5v logic inputs?

Not and guarantee a correct function.

data1.png

Data2.png

Has anyone has had one die on them from 5v i2c lines? None of mine have.

Yet.

In that case, is there any way to share interrupt with multiple devices?

No, how would you know what device was causing the interrupts.

If you want to use other pins for interrupts then you have to use the pin change interrupt function. It is all in the data sheet.