2021-07-01 12:01 AM
Hello,
I'm integrating the LSM6DSO32 into an MCU project and I'm using the example drivers from CubeMx.
The problem is that I don't understand how the gyroscope sensitivity is calulated into the drivers. The constants for the sensitivities at the various fullscale setting are the following:
#define LSM6DSO32_GYRO_SENSITIVITY_FS_125DPS 4.375f
#define LSM6DSO32_GYRO_SENSITIVITY_FS_250DPS 8.750f
#define LSM6DSO32_GYRO_SENSITIVITY_FS_500DPS 17.500f
#define LSM6DSO32_GYRO_SENSITIVITY_FS_1000DPS 35.000f
#define LSM6DSO32_GYRO_SENSITIVITY_FS_2000DPS 70.000f
However if I calculate them with the classical ADC sensitivity equation (that works for the accelerometers) I obtain slightly different values:
GYRO_FS=500;
GYRO_SENSITIVITY=2*GYRO_FS/2^16*1000; //=15.259
I noted that the ratio between the values that I calculate and those in the drivers is constant (1.1469), therefore I suppose I'm missing some scaling factor.
Could someone clarify why the equation isn't correct?
Thank you,
Davide.
Solved! Go to Solution.
2021-07-09 08:20 AM
Hi Eleon,
there was a problem in the data preprocessing in matlab and I was discarding half of the samples, therefore the sampling interval was doubled, that's why I had to multiply by two the sensitivity to get consistent results.
Now the gyroscope works as expected.
Thank you again,
Davide.
2021-07-01 12:49 AM
Hi Davide @Davide G_Oiovanelli ,
In these cases, when i.e. the FS LSB and the sensitivity are different, the sensitivity is the correct value to be taken into account.
The internal acquisition path of the device is more complex than a single ADC (but I cannot disclose the detailed structure).
The main reasons for this difference between the "nominal" and the "actual" value of the sensitivity are related to the fact that the sensitivity should be a little higher than the LSB value in terms of mdps/LSB, to overcome the limit of the smallest ADC step.
This mean that the Full scale will actually not be reached, or, better, it will be reached but with a decreasing slope in the neighborhoods of the FS value.
For this reason, if you are operating in the range of 500dps, you have to select the next F, i.e. the 1000dps.
If my reply answered your question, please click on Select as Best at the bottom of this post. This will help other users with the same issue to find the answer faster.
-Eleon
2021-07-01 02:39 AM
Ok thank you Eleon.
2021-07-01 03:12 AM
I'm going on with the testing, and there is still something that I don't understand.
To validate the setup, I rotate the device a by 360° round the z axis, while integrating the gyro. The integration is the accumulation of the gyroscope raw samples multiplied by the sampling interval. The integrated gyro should show a rotation of 360° and of course I expect also to see some drift because of the offset.
I'm using 200Hz sampling (sensor set to 208Hz), 500dps full scale and 0.0175 as sensitivity.
The result is shown in the image:
Looking at the yellow trace (which is the integrated Z axis of the gyro) it is clear that the measured rotation angle is closer to 180° rather than 360°. So it seems that the gyro is using a different FS setting.
I'm using this funtion to set the FS
LSM6DSO32_GYRO_Driver.SetFullScale(&lsm6dso32_obj_0,500)
Am I missing something else?
2021-07-02 08:07 AM
Hi @Davide G_Oiovanelli ,
>> So it seems that the gyro is using a different FS setting.
The FS setting is common for all the axis, so I don't thins this is the issue...
A general suggestion when using an algorithm that integrates the sensor outputs is to periodically run a calibration of the device, to minimize the error coming from the integration.
I'm not sure that the 180 deg jump is coming from an "overflow" of the sensor Full Scale... does you code take into account the sign of the rotation correctly?
-Eleon
2021-07-02 08:32 AM
Hi,
the problem here is not an overflow, I feel to exclude it since the device is set to 500deg/s and I was rotating the device with the hand (the full rotation takes 2-3s, it cannot be more than 500deg/s).
The problem is that when I rotate the device for 360deg, the accumulation/integration of gyroscope data returns aproximately 180deg (what you see in the yellow trace of the image in previous post) and not the expected 360deg.
In this test, the fullscale is set to 500deg/s using the provided drivers and the sensitivity is therefore 0.0175deg/slsb
2021-07-05 05:34 AM
Hi Davide,
ok it's clear, it looks a scale issue, effective.
But is the value on the other axis the correct one? And are you integrating with the correct time-base?
And what if you change the gyro FS, for example to 1000dps?
For completeness, let me past here below the LSB to mdps conversion formula (where the int16 cast acts as two's complement conversion):
float_t lsm6dso_from_fs500_to_mdps(int16_t lsb)
{
return ((float_t)lsb) * 17.50f;
}
-Eleon
2021-07-09 08:20 AM
Hi Eleon,
there was a problem in the data preprocessing in matlab and I was discarding half of the samples, therefore the sampling interval was doubled, that's why I had to multiply by two the sensitivity to get consistent results.
Now the gyroscope works as expected.
Thank you again,
Davide.
2021-07-12 12:49 AM
Hi Davide,
glad to see you solved the issue!
Thank you for having reported the solution.
-Eleon