Skip to main content
Visitor II
July 2, 2018
Question

LSM303AGR - how to remove raw data distortion?

  • July 2, 2018
  • 1 reply
  • 1008 views
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
    This topic has been closed for replies.

    1 reply

    ST Employee
    July 9, 2018
    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).

    Visitor II
    July 9, 2018
    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?

    ST Employee
    July 9, 2018
    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.