MMC5983MA -- Example2-I2C_Digital_compass

I’m running an MMC5983 magnometer with an unchanged Example2-I2C_Digital_compass with miserable results. I have the sensor mounted on a turntable so I can take accurate measurements on cardinal points. For the points 0, 90, 180, and 270, I get heading readings of 0, 119, 158, and 184, respectively. Obviously, something is seriously wrong.

The MMC5981MA data sheet references 1 degree accuracy using their “proprietary software algorithm.” Is, perhaps, the algorithm in the example incorrect? Does anyone know how I can find the propriety algorithm? Has any actually verified the algorithm in the example? Is it possible that I simply have a defective part?

Magnetometers don’t work out of the box, and need to be calibrated (for best results, in their final mounting place). The best tutorial and overview of the calibration process is https://thecavepearlproject.org/2015/05 … r-arduino/

Practical example at https://forum.pololu.com/t/correcting-t … eter/14315

There is no need for the “proprietary software algorithm”, the raw measurements are all you need, along with careful calibration in place, to get the full accuracy possible from the device.

Thanks!