2018-04-02 12:07 PM
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 #lsm303agr2018-04-04 07:56 AM
You have to compensate the tilt.
For the theory you can read application note
.if you don't want to develop it by yourself you can use our eCompass library (MotionEC) which is available in
package.2018-04-06 02:19 PM
Yeah, there was an offset in both readings; when the sensor was on it's side it did have a better performance though. When I centered the 'magnetic circle' around the origin I was able to get a great response from the sensor!
Thanks for your help!