LSM303AGR - Magnetometer: Perpendicular Readings
Hi!
I had a previous post asking how to interpret the values being drawn from the chips registers and I was able to get that working. (
https://community.st.com/0D50X00009XkWYOSA3
)However, it only works as a 360 degree compass when it is perpendicular to the Z axis (right-angled to ground; almost operating/rotating in the X/Y axis). It works a treat when rotating around the X/Y axis but I need it to be rotating around the Z-axis (ironically when the chip is perpendicular to ground i.e. flat).
Any ideas? Is this common or am I missing a step such as calibration etc?
Datasheet:
http://www.st.com/resource/en/datasheet/lsm303agr.pdf
Calculation:

Edit:
For anyone with this problem, the sensitivity of the sensor is, for whatever reason, better on its side! This was just a slight offset that can be corrected by plotting your values and centering them around the origin (0,0).
#magnetic-sensor #ecompass #magnetometer #lsm303agr