Dear all,
I am working in im6xq board. We have connected mag3110 to the i2c1 line. A platfrom data we are given is 0. The problem is, we are not able to interpret the data output of the sensor. Our team calculated the angle as taninverse (My/Mx), where My and Mx are raw data obtained from magnetometer. But this angle is varying only between some 45 degrees, eventhough we tried full rotation. Any way is there for calibrating this magnetometer? Also it will be helpfull, if let us know any mistake in angle calculation we are doing. Data output we obtained while running magnetometer is included here.
Test Count = 11, Mx = 565, My = 1556, Mz = 1359
Test Count = 12, Mx = 566, My = 1559, Mz = 1363
Test Count = 13, Mx = 566, My = 1559, Mz = 1370
Test Count = 14, Mx = 569, My = 1562, Mz = 1372
Test Count = 15, Mx = 563, My = 1558, Mz = 1361
Test Count = 16, Mx = 561, My = 1559, Mz = 1356
Test Count = 17, Mx = 565, My = 1554, Mz = 1369
Test Count = 18, Mx = 569, My = 1555, Mz = 1360
Test Count = 19, Mx = 562, My = 1565, Mz = 1377
Test Count = 20, Mx = 567, My = 1561, Mz = 1367
Test Count = 21, Mx = 567, My = 1567, Mz = 1361
Test Count = 22, Mx = 567, My = 1558, Mz = 1372
Test Count = 23, Mx = 567, My = 1556, Mz = 1357
Test Count = 24, Mx = 568, My = 1555, Mz = 1358
Test Count = 25, Mx = 569, My = 1559, Mz = 1360
Test Count = 26, Mx = 568, My = 1555, Mz = 1362
Test Count = 27, Mx = 564, My = 1555, Mz = 1347
Test Count = 28, Mx = 566, My = 1560, Mz = 1369
Test Count = 29, Mx = 572, My = 1569, Mz = 1355
Test Count = 30, Mx = 565, My = 1556, Mz = 1355
Test Count = 31, Mx = 566, My = 1557, Mz = 1363
Test Count = 32, Mx = 566, My = 1553, Mz = 1362
Test Count = 33, Mx = 566, My = 1560, Mz = 1361
Test Count = 34, Mx = 568, My = 1556, Mz = 1355
Test Count = 35, Mx = 565, My = 1568, Mz = 1355
Test Count = 36, Mx = 570, My = 1558, Mz = 1365
Test Count = 37, Mx = 574, My = 1562, Mz = 1364
This output we obtained without any rotation, but in resting position. We need an complete angle rotation ie, form 0 to 360 on board rotaion, for our eCompass application. Any suggestion or comments are invited. Waiting for your valuable replies.
Thanks and Regards
Ajna
已解决! 转到解答。
Ajna,
A compass heading (yaw) can be determined by using just the x- and y-magnetometer measurements, but as you have noticed, these are offset from zero by the magnetic “hard iron” interfering field, which results from both permanently magnetized ferromagnetic materials on the PCB and from a zero-field offset in the magnetometer sensor itself. That is why it is necessary to do calibration. In addition to that, in case the device is not kept horizontal, the accelerometer is needed for tilt compensation.
Assuming that the device lies perfectly horizontal, you can rotate it in a figure of eight for a few seconds, record the minimum and maximum magnetometer readings, compute the corresponding x- and y- offset values by using the min/max averaging and then substract these offset values from the current magnetometer measurements. The heading then can be easily computed using the atan2() function.
Hope it helps.
Regards,
Tomas
Dear Tomas,
I am stucked up with another context. How we can calculate the effective magnetic intensity at a point, from 3 axis data obtained from mag3110 ? Looking forward to hear from you. Kindly help me.
Thanks and Regards
Ajna
Hello Ajna,
My first suggestion is to take a closer look at this article describing among others a simple hard-iron calibration technique.
For more information, please refer to both AN4246 “Calibrating an eCompass in the Presence of Hard and Soft-Iron Interference” and AN4248 “Implementing a Tilt-Compensated eCompass using Accelerometer and Magnetometer Sensors” and visit our eCompass website for additional C source code and details.
I hope this helps.
Regards,
Tomas
PS: If my answer helps to solve your question, please mark it as "Correct" or “Helpful”. Thank you.
Dear Thoms,
We are not combining accelerometer with our application. Only we need is the determination of angle in a range of 0 - 360, using magnetometer. It is possible to obtain the degree of rotation using magnetometer, right ..?
If so how it can be achieved...?? Please help me.
All related documents I have gone through. everywhre angle is given as taninverse (ratio of horizontal axes). But for this, we are not getting any meaningfull data. we think it's not meaningfull because, it is not ranging from 0-360 eventhough we are rotating that much. Why is it so..?? Please help.
Thanks and Regards
Ajna
Ajna,
A compass heading (yaw) can be determined by using just the x- and y-magnetometer measurements, but as you have noticed, these are offset from zero by the magnetic “hard iron” interfering field, which results from both permanently magnetized ferromagnetic materials on the PCB and from a zero-field offset in the magnetometer sensor itself. That is why it is necessary to do calibration. In addition to that, in case the device is not kept horizontal, the accelerometer is needed for tilt compensation.
Assuming that the device lies perfectly horizontal, you can rotate it in a figure of eight for a few seconds, record the minimum and maximum magnetometer readings, compute the corresponding x- and y- offset values by using the min/max averaging and then substract these offset values from the current magnetometer measurements. The heading then can be easily computed using the atan2() function.
Hope it helps.
Regards,
Tomas
TomasVaverka we are using the same calibration method.
Please let me know if there is any method to find the maximum and min values of x and y are reached while rotating,so that we can exit before the fixed timeout?
Dear Tomas,
Thanks for your kind reply. Now I am getting 0-360 degree variations in angle, once I did the calibrations. But the variation is not uniform, on rotation of the board. Whether I need to do some calibration for the uniform variation of angle ? Now for 180 and 360 degree rotation, we are getting, accurate angle. But thing is, for other range , an range of error is also producing. But the angle limit is 0-360 properly.
Also it will be good if you tell how to find the true north using this.
Thanks and Regards
Ajna