I2C Conflict with MPU-6050 and RTC Tiny

I am using both of these (RTC and accelerometer) with a gps module to create a data logger for my motorcycle. Using I2C, the MPU6050 works perfect. Disconnect it and then connect the RTC, works perfect. Connect them both and i get garbage data. I have put in 4.7k pull up resistors and no difference. I have changed the bus speed and no change. I'm a bit lost however i can go forward with out the RTC in the project. My intention was to use the RTC to create the file name on the SD card, I can find an alternative or wait for the GPS to get its signal lock and use the time data for that... More annoyed and frustrated now XD

Is the RTC the DS1307 ?

They both have I2C address 0x68 ! There are about 120 available addresses, and you happen to have two devices that have the same address.

On the breakout board of the MPU-6050 there should be a jumper or solder pads for the address select AD0. Use that to set it to 0x69. Change it also in the sketch and it should work.

Ok thanks for that I will take a look. When I run the i2c scanner I get the RTC at 0x50.

Yeah it is the ds1307

hmmm ok, bit confused now...

If i scan with just the MPU attached i get

I2C Scanner Scanning... I2C device found at address 0x68 ! done

which is fine

when i have both attached i get

I2C Scanner Scanning... I2C device found at address 0x50 ! I2C device found at address 0x68 ! done

when i have just the RTC i get

I2C Scanner Scanning... I2C device found at address 0x50 ! I2C device found at address 0x68 ! done

when i have neither

I2C Scanner Scanning... No I2C devices found

I found this, will try it next.

The problem was that the MPU6050_raw sketch uses I2C address 0x68 as default, but the SparkFun board I'm using has AD0 tied to Vcc which sets the MPU6050 address to 0x69.

AD0 low is shown as a default on the SparkFun breakout board schematic but it looks like there is a solder bump on my board that sets AD0 high. I don't know why it's there. I didn't do it!

Changing ...

MPU6050 accelgyro;

... to ...

MPU6050 accelgyro(0x69);

The 0x50 seems like a I2C EEPROM. Is there an extra chip on the RTC module ? So I think the result should be: 0x50 (EEPROM), 0x68 (RTC), 0x69 (Accel+Gyro).

Erdin: The 0x50 seems like a I2C EEPROM. Is there an extra chip on the RTC module ? So I think the result should be: 0x50 (EEPROM), 0x68 (RTC), 0x69 (Accel+Gyro).

You nailed it! Thanks for that. I did not know that it had an eeprom :). Thankyou

Ok I ended up solving my problem without the RTC, but if anybody stumbles upon this post in future this should help to solve the issue

// Default I2C address for the MPU-6050 is 0x68. // But only if the AD0 pin is low. // Some sensor boards have AD0 high, and the // I2C address thus becomes 0x69.

define MPU6050_I2C_ADDRESS 0x68

Hey Arduino Community,

i try to use the RTC 1307 and the MPU6050 together. I changed the i2c adress of the gyro to 0x69.

If i start uploading with the time_set sketch and then upload my Main sketch afterwards, everything works perfectly.

BUT if i remove power connection and plug it in again, the gyro doesnt answer.

Is there anyone who can help me, solving this Problem???

Thanks

Hey Everyone, I'am using the rtc1307 and the mpu6050. I changed the address of the mpu6050 to 0x69 by conecting AD0 to 3,3V. Everything is fine with rtc1307, but mpu6050 is showing to high values of data :/ Anyone can help?

will I2C bus work in power down mode? i am using RTC for my project. so i have to keep it running in any mode of controller and wants to wake up the controller after certain time by RTC.So is it possible to do so?

lets suppose i wants to send the data through UART pin after every 1hour. so i need RTC to calculate that time and when it reach at that time it has to generate interrupt to controller so controller will wake up and sends the data throgh UART pins.Is thisarrengment possible?

i am only concern that wheather I2C pin of atmega328P will work even in power down mode or not? or am i really suppose to concern about that?because i will use backup battery for RTC. so will it capable to generate interrupt after reaching certain time interval value?

and can i use PCF8563 RTC chip instead of DS1307??????????

this is working rtc + mpu6050
Ad0 high

MPU6050_DMP6_+ rtcds1307.ino (15.7 KB)