2020-02-27 01:13 PM
Hi,
(Was: "I would like to use STMicro Motion MC and EC Middle Ware as a normal compass while the "pitch" is positive 90 degrees.")
I would like to use the STMicro Motion MC and EC Middle Ware with an LSM9DS1 sensor while the "pitch" of the LSM0DS1 is positive 90 degrees. That is, instead of the normal position (where Z points up away from the Earth) I would like the user to be holding it out in from of them (such as Z now points at the user).
Currently, I see the STMicro Motion MC and EC Middle Ware gives random bearings when the LSM9DS1 is in this position (Z pointing a the user & X pointing away from the Earth). I realize this could be interpreted as the expected behavior. But given that the STMicro MC and EC Middle Ware is provided with the accelerometer data, it may also be with in reason to expect the STMicro MC and EC Middle Ware to compensate for the (or any) position the LSM9DS1 may be in.
Specifically, is there a way to enable the STMicro MC and EC Middle Ware to use the LSM9DS1 as a Compass no matter what position it is in?
If it is still unclear what I want - I suspect I can get the feature I want if I swap the Z and X data for both the LSM9DS1 accelerometer and the LSM9DS1 magnetometer before passing it to the STMicro when ever the X acceleraometer is at maximum and the Y & Z accelerometer are near zero. However, I would much prefer it if the STMicro MC and EC Middle Ware had an API where I could turn such a feature on & off.
-thanks
2020-02-28 05:34 AM
I have been thinking about this. I can not exchange the X and Z accelerometer and magnetometer data submitted to the STMicro's Motion MC and EC Middle ware libraries. That would put the Hard Iron and Soft Iron calibration into a tail spin!
I am now wondering the following: The STMicro MC library, if I recall correctly, does the calibration and the EC library implements the compass. Perhaps, if I continue to use the MC library as I have been and perform the flip on the calibrated data before feeding into the EC library, I can avoid the situation where the compass appears to change its bearing randomly because the magnetometer X axis at a minimum (i.e. when the compass is pointing straight up).
Dose this sound feasible?