2024-01-17 04:12 AM - last edited on 2024-01-17 05:36 AM by Federica Bossi
Hi.
I used LIS2DU12TR accelerometer IC on the PCB.
It's angle value was changing every sec. but my smart phone app indicated current angle is 0.0 degree.
current angle is -0.515648
[proc_bt_read_all] TX data (len=15)
00 00 02 00 00 00 00 00 00 7F 00 64 37 01 00
current angle is -0.865430
[proc_bt_read_all] TX data (len=15)
00 00 02 00 00 00 00 00 00 7F 00 64 37 01 00
current angle is -0.460660
[proc_bt_read_all] TX data (len=15)
00 00 02 00 00 00 00 00 00 7F 00 64 37 01 00
current angle is -0.688205
[proc_bt_read_all] TX data (len=15)
00 00 02 00 00 00 00 00 00 7F 00 64 37 01 00
---------------------------------
How can I set ODR and FS variables , more accuracy and more stable this IC ,
LIS2DU12StatusTypeDef LIS2DU12_Begin()
{
/* Disable I3C */
if (lis2du12_bus_mode_set(®_ctx, LIS2DU12_I3C_DISABLE) != LIS2DU12_OK) {
return LIS2DU12_ERROR;
}
/* Enable register address automatically incremented during a multiple byte
access with a serial interface. Enable BDU. */
if (lis2du12_init_set(®_ctx, LIS2DU12_DRV_RDY) != LIS2DU12_OK) {
return LIS2DU12_ERROR;
}
/* FIFO mode selection */
lis2du12_fifo_md_t fifo_mode = {
.operation = LIS2DU12_BYPASS,
.store = LIS2DU12_16_BIT,
.watermark = 0,
};
if (lis2du12_fifo_mode_set(®_ctx, &fifo_mode) != LIS2DU12_OK) {
return LIS2DU12_ERROR;
}
/* Select default output data rate. */
X_odr = 400.0f;
/* Select default ultra low power (disabled). */
X_ultra_low_power = LIS2DU12_ULTRA_LOW_POWER_DISABLE;
/* Output data rate: power down, full scale: 2g */
lis2du12_md_t mode = {
.odr = LIS2DU12_OFF,
.fs = LIS2DU12_2g,
};
if (lis2du12_mode_set(®_ctx, &mode) != LIS2DU12_OK) {
return LIS2DU12_ERROR;
}
initialized = 1L;
return LIS2DU12_OK;
}
2024-01-18 11:55 PM
Hi @LogosLEE ,
Welcome to ST Community!
Just to understand better your issue, which is your application? why are you trying to measure an angle with the accelerometer?
2024-01-21 09:02 PM
Hi. Federica .
My application is Solar Tracker , and i want to get exact angle value, but angle values are changing from -1 to 1 degree. i want to set 0.5 degree accuracy.
so, i thought my FW setting was wrong.
How can I set ODR and FS variables , more accuracy and more stable this IC ,?
00 00 02 00 00 00 00 00 00 7D 00 64 37 01 00
current angle is -2.193487
[proc_bt_read_all] TX data (len=15)
00 00 02 00 00 00 00 00 00 7D 00 64 37 01 00
current angle is -2.295314
[proc_bt_read_all] TX data (len=15)
00 00 02 00 00 00 00 00 00 7D 00 64 37 01 00
current angle is -2.535645
[proc_bt_read_all] TX data (len=15)
00 00 02 00 00 00 00 00 00 7D 00 64 37 01 00
2024-01-21 11:58 PM
2024-02-01 02:17 AM
Hi @LogosLEE ,
Have the Application note and design tip helped you?