2022-03-28 12:03 AM
Hi,
In one of our projects we have to use the accelerometer LSM6DSL, and magnetometer LIS2MDL. The tilt-compensated magnetic heading have to be computed in accordance with the values read from these sensors. We have the respective EVKs connected to our microcontroller for trying out and verifying this.
Basically, I am using the below equation for calculating the heading value,
heading = (atan2(y,x) * 180)/3.1415;
And with this, I am getting the heading value properly in a way such that the North is in the direction as marked in red arrow in the below figure.
So I would like to know,
1) the axes direction labeled in the Datasheet is to the -ve direction or not?
2) Do we have to do any calibration procedures other than factory calibration? If so how is that operation? (Because I have observed that, the sensor readings are not reliable when I placed it near to my bench supply[This supply have a thick metallic cover], when I moved it a bit away the values are okay)
Also, if there is any document available that we can refer to implement the tilt-compensated heading calculation, could you share that?
Thanks,
Have a nice day :)
2022-04-05 09:10 PM
1) I'm not sure what you're asking.
2) I'd recommend Magnetometer Calibration using MotionMC Middleware Library. You can use MagnetometerCalibration sample application in X-CUBE-MEMS1 package as a reference. Or you can even use combination of our MotionEC and MotionMC Middleware Libraries.
3) Some documents to study:
https://www.pololu.com/file/0J434/LSM303DLH-compass-app-note.pdf