Hi, I'm using the NXP FXOS8700 and a FXAS21002C on a Adafruit breakout board that uses I2C comms. Each device can be configured and the status read using single and multi-byte transfers as shown in the attached document. However the magnetometer gives an output that seems odd that is to say it doesn't make sense to me.
I have tried degaussing the sensors too try and get rid of any residual magnetic field. One of my boards has a massive offset.
I was expecting the magnetic sensor to give and out similar to the accelerometer, i.e. the output when pointing:
Hi Michael,
Yes, the magnetometer requires calibrating not only for its own offset but usually also against spurious magnetic fields resulting from any nearby ferromagnetic components on the PCB. The AN4246 discusses it in more detail.
A simple software calibration of magnetic hard-iron offset is to rotate the board in a figure of eight twisting motions for a few seconds, record the minimum and maximum magnetometer readings, and compute the hard-iron calibration from their average. Have a look at my simple example code where I illustrate it.
Hope it helps.
Best regards,
Tomas