cancel
Showing results for 
Search instead for 
Did you mean: 

LSM303AGR - how to remove raw data distortion?

Wojciech Jasiewicz
Associate II
Posted on July 02, 2018 at 12:44

Hello, erveryone

I have a question about raw data correctness. I read raw data from magnetometer. I reached following results after rotated this around Z axis in horizontal, flat plane, data are expressed in gauss:

Red - X data, Green - Y data, Blue - ellipse.

0690X0000060C8QQAU.png

I know that this data set isn't correct. I see that parts of data set are flipped. When I converted it (moved parts of sine and cosine), I reached following results:

0690X0000060C8aQAE.png

It looks more correctly than previous chart. What is the reason of data distortion from first picture? I used

https://os.mbed.com/components/X-NUCLEO-IKS01A2/

to collecting data from sensor. I assumed that this library is correct.

#magnetometer #lsm303agr #raw-data #distortions
3 REPLIES 3
Miroslav BATEK
ST Employee
Posted on July 09, 2018 at 10:26

I think the conversion from raw data into gauss unit is not correct. Not only the overflow but also the absolute size is not correct. The size of Earth magnetic field is hundreds of milli gauss (not tens of gauss).

Posted on July 09, 2018 at 13:15

Hello Miroslav

Yes, you are right. Correct data are expressed in mili gauss (necessary during yaw counting). I checked these distortions. They were caused by metal material, which was near (used to magnetometer's board handling). When I removed it, distortions disappeared. Before calibration, it looks like this:

0690X0000060LhDQAU.png

and after calibration:

0690X0000060LhSQAU.png

black - yaw ( expresed in radians)

blue - z data

red - x data

green - y data

It looks good for me. What is your opinion?

Posted on July 09, 2018 at 16:59

Usually we plot the magnetometer data in scatter plot (X-Y, X-Z, Y-Z) and the data should created circles with center in [0,0] when the sensor is rotated along third axis.

But from what I see on your picture it seems OK to me.