LIS2DH12 acceleration data not stable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-05-30 7:29 AM
I am using the STM driver to control the LIS2DH12TR accelerometer.
The freeRTOS sensor task is as following (checks on return values and variables definitions are removed to simplify the code comprehension):
void MEMS_task(void)
{
lis2dh12_self_test(&dev_ctx);
result = lis2dh12_operating_mode_set(&dev_ctx, LIS2DH12_HR_12bit);
result = lis2dh12_data_rate_set(&dev_ctx, LIS2DH12_ODR_100Hz);
result = lis2dh12_fifo_mode_set(&dev_ctx, LIS2DH12_BYPASS_MODE);
result = lis2dh12_block_data_update_set(&dev_ctx, PROPERTY_ENABLE);
result = lis2dh12_temperature_meas_set(&dev_ctx, LIS2DH12_TEMP_ENABLE);
for (;;)
{
result = lis2dh12_xl_data_ready_get(&dev_ctx, &acceleration_data_available);
if (acceleration_data_available != 0)
{
/* Read accelerometer data */
memset(data_raw_acceleration, 0x00, sizeof(data_raw_acceleration));
lis2dh12_acceleration_raw_get(&dev_ctx, data_raw_acceleration);
acceleration_mg[0] = lis2dh12_from_fs2_hr_to_mg(data_raw_acceleration[0]);
acceleration_mg[1] = lis2dh12_from_fs2_hr_to_mg(data_raw_acceleration[1]);
acceleration_mg[2] = lis2dh12_from_fs2_hr_to_mg(data_raw_acceleration[2]);
}
}
}​
If I put my board on a table I would expect to read zero on X ands Y axes and 1g on Z axe, but instead read values that flickers around the expected ones.
Here a few samples:
X: 0
Y: -22
Z: 1016
X: -2
Y: -20
Z: 1024
X: -1
Y: -21
Z: 1017
X: 4
Y: -24
Z: 1019
Is this normal?
How do I define a position as stable, if acceleration values are so variable?
Solved! Go to Solution.
Labels:
- Labels:
-
Accelerometers
1 ACCEPTED SOLUTION
Accepted Solutions
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-06-03 3:13 AM
Hi @Manuel Ferrero ,
Yes, it is normal. You have to consider the impact of noise.
In addition, test them in controlled environment to minimize ambient noise as well.
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-06-03 3:13 AM
Hi @Manuel Ferrero ,
Yes, it is normal. You have to consider the impact of noise.
In addition, test them in controlled environment to minimize ambient noise as well.
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
