luisrodenas Posted January 30, 2014 Report Share Posted January 30, 2014 Hello, I am attaching an Arduino example sketch to show how to read a magnetometer (HMC5883L) while MPU's DMP is active. This is only useful if you have your magnetometer attached to MPU's I2C internal aux lines, like many 10DOF boards do, and you want to use DMP. If you can, I believe it is always best to connect your magnetometer to your main I2C lines directly and you won't need this sketch. This sketch does NOT fuse DMP + magnetometer. You will have to do it by yourself in your host processor. I would only try to fuse magnetometer if it is going to be used outdoors, as electromagnetic interferences caused by electronics indoor make it quite difficult. Besides, the DMP's yaw measure is very good if you don't need much precision or long running times, in these cases you should fuse magnetometer + DMP. Please read sketch comments, as many things are explained there. Remember to put your MPU's address (0x68 or 0x69) and to set your interruption pin. Please give feedback, wheter it works or you have trouble with it. If people find it useful maybe Jeff can add it to the library once it is bugfree. Thank you MPU6050_DMP_mag.zip Quote Link to comment Share on other sites More sharing options...
titous Posted February 4, 2014 Report Share Posted February 4, 2014 Interesting, I'm definitely interested in using the HMC5883L along with the DMP data, so I'll take a look at your sketch once my PCBs come in. Have you seen the following? http://franciscoraulortega.com/pubs/Algo3DFusionsMems.pdf Using their approach you could fuse the DMP data along with the magnetometer data (equations 7 - 9 in the paper), at a relatively cheap cost of a few trig function multiplications, to get an even more accurate response. Could be a good approach before the sensor fusion of all thee sensors is figured out. Quote Link to comment Share on other sites More sharing options...
luisrodenas Posted February 5, 2014 Author Report Share Posted February 5, 2014 I have those equations implemented in my project. It is true they improve yaw measure coming from magnetometer, in the way that it does not oscillate so much when you change pitch and roll. Anyway I reached the conclusion that magnetometer yaw measure shouldn't be used indoors, because of big electromagnetic interference. Or maybe it is just my lab, with cables running under the floor and inside walls. When I start to use it outdoors I will check its measure again and fuse them. Thank you for the info Quote Link to comment Share on other sites More sharing options...
Monax_111 Posted February 28, 2016 Report Share Posted February 28, 2016 Good afternoon! sorry for my English I have an Arduino Nano, 2 MPU6050, 2 HMC5883L I want to get the output array with 20 values (the first board {3, 3, accelerometer, magnetometer, 3, temperature}), the second board {3, 3, accelerometer, magnetometer, 3, temperature}) Now I'm trying to get it to work the first board (соединение серии MPU6050 + HMC5883L). I use your file " MPU6050_DMP_mag.zip ". 1) I set the address of MPU ( в 0x68) , because MPU6050-> AD0 is connected to ground through 4,7 кОм 2) I set Int interrupt_pin = 0, and I have the answer !!! But I have a magnetometer (0.00,0.00,0.00); What do you think, what's the problem? my circuit Quote Link to comment Share on other sites More sharing options...
Hadar Posted April 12, 2017 Report Share Posted April 12, 2017 On 1/30/2014 at 1:33 PM, luisrodenas said: Hello, I am attaching an Arduino example sketch to show how to read a magnetometer (HMC5883L) while MPU's DMP is active. This is only useful if you have your magnetometer attached to MPU's I2C internal aux lines, like many 10DOF boards do, and you want to use DMP. If you can, I believe it is always best to connect your magnetometer to your main I2C lines directly and you won't need this sketch. This sketch does NOT fuse DMP + magnetometer. You will have to do it by yourself in your host processor. I would only try to fuse magnetometer if it is going to be used outdoors, as electromagnetic interferences caused by electronics indoor make it quite difficult. Besides, the DMP's yaw measure is very good if you don't need much precision or long running times, in these cases you should fuse magnetometer + DMP. Please read sketch comments, as many things are explained there. Remember to put your MPU's address (0x68 or 0x69) and to set your interruption pin. Please give feedback, wheter it works or you have trouble with it. If people find it useful maybe Jeff can add it to the library once it is bugfree. Thank you MPU6050_DMP_mag.zip Hi, Can I make a "serial" connection with two MPU6050 in that way? Assuming the Master MPU is 0x68 and a Slave MPU is connected to the master MPU at XCL, XDA? As "Monax_111" posted but instead of Magnetometer connect at the same Pins the Slave MPU6050. Thanks Hadar Quote Link to comment Share on other sites More sharing options...
jauhar Posted October 2, 2017 Report Share Posted October 2, 2017 bad heading value, how to get a real heading value? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.