2025-07-18 6:11 AM
Hi Everyone,
I'm currently migrating from LSM6DSM to LSM6DSO in my application and facing some issues with accelerometer accuracy in stable conditions.
MCU: STM32L4
Sensor Interface: SPI (3-wire)
Purpose: Reading raw accelerometer and gyroscope data, converting to physical units, and estimating roll/pitch/yaw using MotionFX.
Acc/Gyro ODR | 1.6 kHz |
FIFO Output Rate | 400 Hz |
Main Loop Rate | 100 Hz |
Averaging | 4 samples/frame |
I can successfully communicate with LSM6DSO via 3-wire SPI.
I’m able to read raw data from the accelerometer and gyroscope.
Sensor fusion (MotionFX) works and outputs roll, pitch, and yaw.
I'm trying to measure raw linear acceleration (after converting to g).
The requirement is that the noise level (in a static, stable condition) should be less than ±0.005g in all directions.
With LSM6DSO, the data seems noisier and less accurate, even though I'm using the same processing and averaging method.
The Register Configuration of LSM6DSM and LSM6DSO -
The flow to read the data from LSM6DSO is
typedef struct
{
int16_t acc[3];
}AccRawData_t;
AccRawData_t read_lsm6dso_data;
if((Mems_ID & MEMS_ID_LSM6DSO_ID) == MEMS_ID_LSM6DSO_ID)
{
number_of_words_available = Mems_get_available_samples();
number_of_samples_available = number_of_words_available;
Test_noOfwordsAvailable = number_of_samples_available;
for (int j = 0; j < number_of_samples_available; j++)
{
Mems_get_data_type(&pattern);
Mems_get_dso_raw_data(read_lsm6dso_data.acc);
switch(pattern)
{
case LSM6DSO_GYRO_DATA_TYPE:
gyro_raw_data[acc_raw_buffer_index].gyro[0] = read_lsm6dso_data.acc[0];
gyro_raw_data[acc_raw_buffer_index].gyro[1] = read_lsm6dso_data.acc[1];
gyro_raw_data[acc_raw_buffer_index].gyro[2] = read_lsm6dso_data.acc[2];
break;
case LSM6DSO_ACC_DATA_TYPE:
acc_raw_buffer[acc_raw_buffer_index].acc[0] = read_lsm6dso_data.acc[0];
acc_raw_buffer[acc_raw_buffer_index].acc[1] = read_lsm6dso_data.acc[1];
acc_raw_buffer[acc_raw_buffer_index].acc[2] = read_lsm6dso_data.acc[2];
break;
default:
dso_fail_count++;
break;
}
acc_avg[0] += acc_raw_buffer[acc_raw_buffer_index].acc[0];
acc_avg[1] += acc_raw_buffer[acc_raw_buffer_index].acc[1];
acc_avg[2] += acc_raw_buffer[acc_raw_buffer_index].acc[2];
gyro_avg[0] += gyro_raw_data[acc_raw_buffer_index].gyro[0];
gyro_avg[1] += gyro_raw_data[acc_raw_buffer_index].gyro[1];
gyro_avg[2] += gyro_raw_data[acc_raw_buffer_index].gyro[2];
}
Kindly help me to fix the acceleration data to get it's Noise level low.