Lis3mdl & lsm6


I’ve bought a MinImu v5 with LIS3MDL & LSM6.
The LIS3MDL haven’t a Heading function. What is it ? I can use the LSM6 to calculate it.

PS : It’s too hard to extract it from the MinIMU9AHRS.

Thanks :wink:

The LIS3MDL calibration, minZ is in positive ans MaxY in negative :hushed:

min: {  -613,  -6645,  +1403}   max: { +5520,   -566,  +7205}
min: {  -647,  -6847,  +1221}   max: { +5766,   -416,  +7338}
min: {  -695,  -6714,  +1397}   max: { +5605,   -594,  +7340}
min: {  -616,  -6633,  +1343}   max: { +5542,   -786,  +7214}

Unfortunately, we do not have a tilt-compensated heading function for the accelerometer and magnetometer used on the MinIMU-9 v5. However, we are working on making a sketch for this and hope to have something available soon.

As for your calibration values, those should be okay. The minimum and maximum values that the calibration program prints show the amount of magnetometer bias for your particular unit. (The whole point of the calibration routine is to determine what this bias is for each axis, well as any sensitivity differences.) If the minimum and maximum values are equal in magnitude for a specific axis (e.g. -3000 as m_min.x and 3000 as m_max.x), then the values lead to an assumed magnetometer bias of 0. In your case, the bias for some of your axes is so large that the entire range for that axis is above or below zero, but that is not unusual.


I believe those are the same sensors that are used in the Balboa robot, in which case you can use the code I wrote for either a horizontal compass, or a tilt compensated compass, described in this post: Correcting the Balboa magnetometer

The sensor mounting orientation will probably be different, so pay attention to the definition of the vector “p”.