cancel
Showing results for 
Search instead for 
Did you mean: 

Erratic results from magnetometer

PRebo.1
Associate II

I have an application using a LSM9DS1 with the purpose of accurately measuring the rotational speed of a platter spinning at about 33 rpm.

I measure the speed by taking readings from the gyroscope every 10ms. I did an initial calibration for offset and slope before that, but I would like to increase the accuracy by correlating the initial calibration with data from the magnetometer also.

So I added an initial calibration step by reading the X,Y measures from the magnetometer every 30ms, calculating a heading using atan2(Y, X)*180/PI +180 , and measuring the time it takes to go from heading 50º back to heading 50º again.

However, when I look at a log from the headings obtained, I see a not completely linear sequence of values, sometimes going back for 1,2 steps, before going forward again. Something like: 34, 36, 38, 33, 39, 40, 50, 45, 55, 60.....

Any idea of what may be causing this ? Maybe I'm trying to take readings too fast ?

I've set ODR at 80Hz

1 ACCEPTED SOLUTION

Accepted Solutions
Eleon BORLINI
ST Employee

Hi @PRebo.1​ ,

>> Any idea of what may be causing this? Maybe I'm trying to take readings too fast?

You could try to reduce the reading speed, of course (especially if you set 80Hz ODR but you are reading the gyro at 100Hz).

For the magnetic sensor calibration, how are you performing it? Are you periodically setting the user offsets (OFFSET_t_REG_w_M registers)? I suggest you to check this guidelines for the magnetic sensor calibration, especially the procedure for the hard iron compensation.

-Eleon

View solution in original post

1 REPLY 1
Eleon BORLINI
ST Employee

Hi @PRebo.1​ ,

>> Any idea of what may be causing this? Maybe I'm trying to take readings too fast?

You could try to reduce the reading speed, of course (especially if you set 80Hz ODR but you are reading the gyro at 100Hz).

For the magnetic sensor calibration, how are you performing it? Are you periodically setting the user offsets (OFFSET_t_REG_w_M registers)? I suggest you to check this guidelines for the magnetic sensor calibration, especially the procedure for the hard iron compensation.

-Eleon