Imu accuracy information

The procedure IS complex, and it will take some study on your part to go through it. That is the only way you will get accurate data out of the magnetometer.

I describe all the individual steps, and post ALL the code, for two different methods of calibrating the magnetometer in the second link, post #2 above.

There are twelve. Three offsets and a 3x3 matrix for the method described in the first link, post #2.

There are six for the simpler, "axial min/max" method discussed in the second link, post #2.