Aruino Mega2560 + MPU6050 +HMC5883L +BMP085

Post Reply
guru2018
Posts: 9
Joined: Fri Aug 14, 2015 7:20 am

Aruino Mega2560 + MPU6050 +HMC5883L +BMP085

Post by guru2018 »

Hello,
I am building my first QuadCopeter. For Flight Controller board I have Arudino Mega2560 + MPU6050 module +HMC5883L module +BMP085 modules.
Got successful in connecting MPU6050 module +HMC5883L module to Arudino using SAD, SCL and Auxilary SAD and SCL of MPU6050 and its working.

Now i need to connect BMP085 modules. How to connect it. ? Can any one share the connection diagram for this.

Guru

QuadBow
Posts: 532
Joined: Fri Jan 04, 2013 10:06 am

Re: Aruino Mega2560 + MPU6050 +HMC5883L +BMP085

Post by QuadBow »

guru2018 wrote:Now i need to connect BMP085 modules. How to connect it?
Connect it to the same I2C wires as the MPU6050.

guru2018
Posts: 9
Joined: Fri Aug 14, 2015 7:20 am

Re: Aruino Mega2560 + MPU6050 +HMC5883L +BMP085

Post by guru2018 »

Thank you QuadBow.
Yes connected all the SDA lines from three sensors together and connected the line to SDA input of Mega 2560. Same for SCL. I think I2C communication is capable of reading the sensors based on addresses. (New for I2C)

May be helpful for some one:
In config.h enabled "#define GY_88" and in def.h commented "#define MPU6050_I2C_AUX_MASTER" and "#undef INTERNAL_I2C_PULLUPS" under #if defined(GY_88).

Every thing worked fine expect the YAW readings of the Magnetometer fluctuates too much.
Commented this lines in the sensors.cpp under #if defined(HMC5883) in Mag_init function, after commenting its stable.
#if 0
Commented this part, as yaw value was fluctuating
if (!bias_collect(0x010 + HMC_POS_BIAS)) bret = false;
if (!bias_collect(0x010 + HMC_NEG_BIAS)) bret = false;

if (bret) // only if no saturation detected, compute the gain. otherwise, the default 1.0 is used
for (uint8_t axis=0; axis<3; axis++)
magGain[axis]=820.0*HMC58X3_X_SELF_TEST_GAUSS*2.0*10.0/xyz_total[axis]; // note: xyz_total[axis] is always positive
#endif

QuadBow
Posts: 532
Joined: Fri Jan 04, 2013 10:06 am

Re: Aruino Mega2560 + MPU6050 +HMC5883L +BMP085

Post by QuadBow »

guru2018 wrote:in def.h commented "#define MPU6050_I2C_AUX_MASTER"
That works when all devices are on the same i2c bus.
However, there is room for improvement by connecting the compass to the second i2c bus of module MPU6050. Then you have to uncomment the definition mentioned above.

Post Reply