Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MPU6050 + HMC5883L not working together #422

Open
angargon opened this issue Jan 9, 2019 · 0 comments
Open

MPU6050 + HMC5883L not working together #422

angargon opened this issue Jan 9, 2019 · 0 comments

Comments

@angargon
Copy link

angargon commented Jan 9, 2019

Hello,

I'm trying to get the information from the magnetometer from the sketch MPU6050_DMP6.ino but I'm not succeeding.

I am using a GY-87 board that has MPU6050 + HMC5883L + BMP180 with an Arduino MEGA

I can satisfactorily read all the sensors separately, for example the MPU6050_DMP6.ino it works very well with the offsets I have previously obtained and visualize the Teapot processing sketch in a very stable way.
On the other hand, in sketch HMC5883L_raw.ino I can get the magnetometer values ​​that change as I move the device without problems. I had to add some lines to get to the magnetometer:

mpu.initialize ();
mpu.setI2CMasterModeEnabled (0);
mpu.setI2CBypassEnabled (1);
mag.initialize();
Serial.println(mag.testConnection() ? "HMC5883L connection successful" : "HMC5883L connection failed");
mag.setMode(0);

I verify that both devices are reachable and effectively they are.

The problem comes when I want to get the information from the magnetometer from the sketch MPU6050_DMP6.ino
I put the reading between lines 258 and 267, where it says:

// other program behavior stuff here
//.
//.
//.
// if you are really paranoid you can often test in between other
// stuff to see if mpuInterrupt is true, and if so, "break;" from the
// while () loop to immediately process the MPU data
//.
//.
//.
mag.getHeading(&mx, &my, &mz);
Serial.println(mx);
Serial.println(my);
Serial.println(mz);

I get the perfect readings of the mpu6050 but the readings of the magnetometer seem frozen, they are always the same as if I only read the first value and did not read any more.

Besides reading these two components I would need to read more things like the bmp180 or a gps encoder,...

I would need some help please.

Best Regards,

Tony

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant