cancel
Showing results for 
Search instead for 
Did you mean: 

E compass library (LSM6DSLTR + IIS2MDCTR)

DineshBisen
Associate II

Hello 

I have my oven custom board in which I used accelerometer (LSM6DSLTR), magnetometer (IIS2MDCTR) and STM32L4 series controller. Initially I tried to get north heading through magnetometer but due to external noise some time I am getting proper north heading but some time getting wrong orientation. I tried soft Iron and hard iron compensation but due to variable soft iron some time I am getting wrong north heading. I was trying to use e-Compass library but still don't get proper orientation. I have following two questions.

1) Can we use e-Compass library for custom board in which LSM6DSLTR accelerometer and IIS2MDCTR magnetometer is used.

2) I am using my custom board in very noisy environment in which standalone magnetometer is not capable to calculate proper north heading. I also used hard iron and soft iron still getting wrong north heading. so is it possible to calculate proper north heading using accelerometer and magnetometer fusion using e-Compass library or any other library in noisy environment.

Please let me know the solution.

 

Thanks, and Regards 

Dinesh Bisen

3 REPLIES 3
Ozone
Lead II

> 2) I am using my custom board in very noisy environment in which standalone magnetometer is not capable to calculate proper north heading after applying hard iron and soft iron. so is it possible to calculate proper north heading using accelerometer and magnetometer fusion using e-Compass library or any other library in noisy environment.

"Proper north" is defined as a magnetic pole, so an accelerometer will be of no use in determining it.
The accelerometer is only useful in determining movement (actually, the differential).

> Initially I tried to get north heading through magnetometer but due to external noise some time I am getting proper north heading but some time getting wrong orientation.

This can be internal noise due to inadequate layout or other nearby components, or due to the external environment.
If the latter is the case, your magnetometer signal is swamped by noise, and your project is very likely to fail.

But since you mentioned a custom board, I think you can try to improve the hardware design.

Thanks Ozone

But can I use e-Compass library for custom boards, or I have to use standard board provided by ST like IKS01A3?

 

> But can I use e-Compass library for custom boards, or I have to use standard board provided by ST like IKS01A3?

That depends - but I don't know details.
The e-Compass library only provides the higher-level code, i.e. matrix/quaternion calculations. The low-level / HAL code to drive the MEMS sensors need to come from the board's BSP, Cube/HAL, or you.
Found a ST github repository, but the documentation seems lacking ...
https://github.com/STMicroelectronics/X-CUBE-MEMS1/blob/main/README.md