I agree with the answer of using the two mpu6050 chips in parallel on the I2C bus.
BUT, I have the same question about using the I2C AUX pins on the mpu6050,
except with the Hmc5883L chip/board.
I am using the Gy521 mpu6050 and the Gy273 hmc5883L boards.
I need to have the hmc5883 on the I2C AUX pins XCL and XDA,
but the Arduino host does NOT see the hmc5883 on the AUX bus.
I can swap the Hmc5883 SCL and SDA onto the host I2C bus,
and it spits out the 5883 data (with the 6050 data),
but only zeroes when connected on the 6050 XCL & XDA pins.
I have the Arduino wired up to the 6050 and powered by 5V from the USB.
I also tried adding a 9V battery on the Raw pin - still no results from the I2C AUX 5883.
Pull-up Resistors were also tried on the XCL & SDA -> Hmc5883 pins - no luck with or without.
These additional Pull-ups should not be needed though - considering the XCL & XDA plus the Hmc5883 board are supposed to already have Pull-ups.
Below is part of the program that I used :
void setup()
{
// ...
// Mpu6050 :
Wire.begin();
Wire.beginTransmission(0x68);
Wire.write(0x6B); // PWR_MGMT_1 register
Wire.write(0); // set to zero (wakes up the MPU-6050)
Wire.endTransmission(true);
//
// (Mpu6050) :
// ENABLE AUX_I2C Port :
Wire.beginTransmission(0x68);
Wire.write(0x37); // INT_PIN_CFG register
Wire.write(0x02); // set 0x02 to one Enables AUX_I2C
Wire.endTransmission(stop);
//
// TEST HMC5883 CONNECTION : //
int Frspcnt;
for(Frspcnt=100; Frspcnt>0; Frspcnt --) {
Wire.beginTransmission(HMC_address);
Wire.write(0x0A); // REG_RA_ID_A
Wire.endTransmission(false);
Wire.requestFrom(HMC_address, 1);
if(Wire.available()) {
if(Wire.read() == 'H') {
Wire.endTransmission(stop);
break;
}
}
Wire.endTransmission(stop);
}
if(Frspcnt == 0)
{ Serial.println("* --- HMC5883 Connection FAILED ! --- *"); }
//Put the HMC5883 IC into the correct operating mode
Wire.beginTransmission(HMC_address); //open communication with HMC5883
Wire.write(0x02); //select mode register
Wire.write(0x00); //continuous measurement mode
Wire.endTransmission(stop);
//
//Tell the HMC5883 where to begin reading data
Wire.beginTransmission(0x1E);
Wire.write(0x03); //select register 3, X MSB register
Wire.endTransmission(false);
//Read data from each axis of HMC5883, 2 registers per axis
Wire.requestFrom(HMC_address, 6);
if(6<=Wire.available()) {
x = Wire.read()<<8; //X msb
x |= Wire.read(); //X lsb
z = Wire.read()<<8; //Z msb
z |= Wire.read(); //Z lsb
y = Wire.read()<<8; //Y msb
y |= Wire.read(); //Y lsb
}
// and Print them :
Serial.println(x);
Serial.println(y);
Serial.println(z);
Wire.endTransmission(stop);
//
// (Mpu6050) :
// DISABLE AUX_I2C Port :
Wire.beginTransmission(MPU);
Wire.write(0x37); // INT_PIN_CFG register
Wire.write(0x00); // set 0x02 to zero Disables AUX_I2C
Wire.endTransmission(stop);
// ...
}
This clip does not show the 6050 Read & Print code.
But it only prints zeroes for the 5883 when it is on the I2C AUX bus.
While it does print out valid 5883 Values if it is on the Arduino host I2C bus
(because the AUX bus becomes not important).
But I NEED this hooked on the AUX bus ! ... What could be the problem ?
- UPDATE: - Also added the TEST HMC5883 Connection Code ... but it Still just Fails repeatedly ...
-> QED: ALL I can Say is: the I2C_AUX on mpu6050 is a NONWORKING and Useless feature ...