Hi there.
During the weekend we dedicated some time to
integrate the MPU-9150
with Arduino Mega board to access the compass data.
We needed to update the
firmware wrt the one provided by Sparkfun. However after solving some problem
we finally got the magnetometers measurements.
We ended up using the code from Pansenti (just take note not to ask for too high output rates from the magnetometer, 50Hz is a good value).
If you want you can use the code made available at Sparkfun, you will have to make some corrections. Unlike all the other sensors and respective registers, the magnetometer writes to its data registers in little-endian! To correct the code, just swap the byte order at the function that reads the magnetometer. In the file MPU6050.cpp, in function getMotion9, change the lines 1729-1731 to:
*mx = (((int16_t)buffer[1]) << 8) | buffer[0];
*my = (((int16_t)buffer[3]) << 8) | buffer[2];
*mz = (((int16_t)buffer[5]) << 8) | buffer[4];
Here below you can find a simple video with the main steps we
followed.
Stay tunned!
The Pansenti lib is no longer available on GitHub,
ReplyDeleteI think this is a fork or copy
https://github.com/richards-tech/MPU9150Lib
Sorry, forgot to post my name etc (above)
ReplyDeleteOh MPU-9150? Is that the first 9-axis motion tracking device designed for low power? Great attempt. The video was helpful too. And sure, we will stay tunned for the performance of HMC5883L compass! Looking forward for more news on magnetometer readings and new magnetometer applications in geology.
ReplyDelete