i2c with many devices

XD hi everyone…

question i wonder :can i connect two or tree sensors or i2c interfaces on sda and scl pin ? is it working?
cause i’d connected i2c real time clock and mpu6050 gyro together,parrallele on sda and scl, but rtc won’t return me good time…

if u ever use it ?..

Yes.

Each device has an 'address'. They can share the same pins.

ok..but i supose it's only possible if each one are correctly initialised in the sketch before running ?
:zipper_mouth_face: because i intialise only one device for the moment...may be it's because of that....

dr_no:
because i intialise only one device for the moment...may be it's because of that....

Maybe it doesn't work because you didn't initialize it?

It's a possibility, yes....

(boggle)

Are all devices on the bus the same voltage?
Have you got pull up resistors fitted?
Only one set 4K7 from each bus bit to +5V or the powering voltage. And remember to connect all grounds together.

yea..my mpu6050 is on 3.3v pin and my rtc is on 5v pin
ground arduino, no pull up resistors..i felt 't was not necessary...may be i'm wrong... :blush:

no pull up resistors…i felt 't was not necessary…may be i’m wrong.

Yes you are wrong. See:-

my mpu6050 is on 3.3v pin and my rtc is on 5v pin

AHGGGG
That makes it very difficult. Pulling up a 3V3 device to 5V can damage it. You have to isolate the 3V3 part of the bus from the 5V part. It is best to use a logic level translator chip or FET to get between the two levels. I think spark fun sells one or just connect two transistors back to back.

AN10441.pdf (52.4 KB)

:~ ouch..i gone make this rapidly to not burn my system...

your pdf and post were good , many thanks grumpy and fungus :wink: