I am trying to determine heading (either relative or absolute) using a Flora LMSDS0 9-DOF Accelerometer, a Particle Photon and the the Adafruit_LSM9DS0 and Adafruit_AHRS_Simple libraries.
The Pitch and Roll readings make sense. They give me +/- 90 degrees nicely as I tilt the sensor but the heading readings make no sense.
I’m getting inconsistent ranges for my readings, sometime -90 to -120 for 360 degree rotation, sometimes +20 to -160. It’s all over the map. If I rotate the sensor and then come back to the same orientation I will get +/- 20 degrees on my readings. And many times the whole thing just stops reading and gives me a random static value.
Is this a problem with the math in the library, the sensor, the I2C on the photon. The current Random results are not very helpful.
Is there a good way to calibrate the heading?