MinIMU-9 v5

I’ve just purchased MinIMU-9 v5 in Amazon

How can I determine the tilt compensated heading of the compass using mag.m.x, mag.m.y?

I get the following values from the serial LIS3MDL example:

M: -1841 1020 -3557
M: -1807 1028 -3597
M: -1862 1020 -3635
M: -1850 1022 -3618
M: -1833 1026 -3661
M: -1826 1024 -3606
M: -1835 1044 -3593
M: -1791 1050 -3634
M: -1832 1025 -3534
M: -1850 1019 -3643
M: -1849 1027 -3624
M: -1801 1008 -3639
M: -1823 988 -3638

I never get positive values of the mag.m.x and i never get negative values of the mag.m.y

What are mag.m.x and y max and min values? Must I set them to a range of values?

Thank you
Jon

Hello, Jon.

Unfortunately, we do not have a tilt-compensated heading function for the accelerometer and magnetometer used on the MinIMU-9 v5. However, we hope to have an example sketch available in the future. In the meantime, you might consider adapting this tilt-compensated heading function for the LSM303, the accelerometer/magnetometer used on our older MinIMU-9 boards.

As for the values you are getting with our Serial sketch, not ever getting positive or negative values is not very unusual. The range of values that you might get for each magnetometer axis depends on the particular amount of magnetometer bias for each axis for your particular unit. If it is the case where an axis never outputs raw values that are negative (or positive), then the bias for that particular axis is so large that the entire range for that axis is above (or below) zero.

I recommend running our Calibrate sketch. The minimum and maximum values that the calibration program prints show the amount of magnetometer bias for your particular unit, and you can use those values to shift or offset your raw readings in a way that centers their output around zero.

-Jon

Hello again
Having the values of x, y, z of the magnetometer what is the heading formula?
Regards
Jon

You can look through our LSM303 Arduino library’s header file to see how we compute heading. Note that you also need readings from the accelerometer to compute a tilt-compensated heading.

-Jon