cancel
Showing results for 
Search instead for 
Did you mean: 

LIS2DU12TR accelerometer

LogosLEE
Associate

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(&reg_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(&reg_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(&reg_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(&reg_ctx, &mode) != LIS2DU12_OK) {

return LIS2DU12_ERROR;

}

 

initialized = 1L;

 

return LIS2DU12_OK;

}

 

4 REPLIES 4
Federica Bossi
ST Employee

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?

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.
LogosLEE
Associate

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

Federica Bossi
ST Employee

Hi @LogosLEE ,

Have a look at AN5648 or DT0058.

Let me know if this helps :)

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.

Hi @LogosLEE ,

 

Have the Application note and design tip helped you?

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.