How can I combine MPU6050 + RTC DS1307 using i2c??

Hi there!

I need to combine two modules: MPU6050 and RTC1307). When I connect them together the project doesn't work...

How can I connect them using i2c??

Thanks in advance!!

How do you have the connection set-up? The MPU6050, according to will act as a slave but has a master I2C embedded for other attached peripherals.

What adresses did you assign the MPU6050 and RTC? If both are on 0x68 things won't work.

Thanks Leroy2007!

You are right, both are on 0x68, but I don't know how to change the MPU's address...

In MPU6050.cpp...

#include "MPU6050.h"

/** Default constructor, uses default I2C address.

    MPU6050::MPU6050() {
    devAddr = MPU6050_DEFAULT_ADDRESS;

/** Specific address constructor.

  • @param address I2C address
  • @see MPU6050_ADDRESS_AD0_LOW
  • @see MPU6050_ADDRESS_AD0_HIGH
    MPU6050::MPU6050(uint8_t address) {
    devAddr = address;

etc etc....

In MPU6050.h

#define MPU6050_ADDRESS_AD0_LOW 0x68 // address pin low (GND), default for InvenSense evaluation board
#define MPU6050_ADDRESS_AD0_HIGH 0x69 // address pin high (VCC)

Just as a guess...

// change this
// to this

But that would depend on the MPU6050 pinout on the breakout board and if you can change the level of AD0.