cancel
Showing results for 
Search instead for 
Did you mean: 

Help with calculating heading with LSM303

PMerc.1
Associate II

Hi. I am evaluating the LSM303 and trying to get the device working as an Compass. I have the AN3192 application note to assist with calculating the heading, but doesn't seem to give me the correct results. The raw data coming back when facing north is x = -44, y = +1, z = -363. When facing East I get x = +45, y = +122, z = -300. With these figures I can't seem to achieve 0 degrees and 90. Please can you point me in the right direction.

10 REPLIES 10

Hi @PMerc.1​ ,

There are differences in terms of sensitivity of both accelerometer and magnetometer.

Moreover, the registers for the offset cancellation for the magnetometer are different...

You can compare the tho datasheets, LSM303DLH and LSM303AGR.

Please note that the above-mentioned arduino file is named "LSM303DLHC eCompass implementation", so it is intended (optimized) to work with this sensor.

-Eleon