cancel
Showing results for 
Search instead for 
Did you mean: 

How to make LIS2DW12 generate interrupt for major vibrations and not for small vibrations?

RVarg.1
Associate

I have LIS2DW12 connected to STM32L072RZT6 MCU. INT1 pin of LIS2DW12  is connected to PC13 (wakeup pin2) of MCU. I am trying to wake up MCU from standby using LIS2DW12  with the 6D orientation example in https://github.com/STMicroelectronics/STMems_Standard_C_drivers/tree/master/lis2dw12_STdC/example

But I can see that MCU wakes up even for small vibrations for example if I tap on the table where the set up is kept.

How can I improve the code so that the interrupt is generated only when there are major vibrations?

1 REPLY 1
Eleon BORLINI
ST Employee

Hi @RVarg.1​ , you can set the wake-up threshold and duration according to your application (in your case, you can increase the wake-up threshold) as described in the LIS2DW12 application note AN5038, p.20:

The unsigned threshold value is defined using the WK_THS [5:0] bits of the WAKE_UP_THS register; the value of 1 LSB of these 6 bits depends on the selected accelerometer full scale: 1 LSB = FS/64. The threshold is applied to both positive and negative data: for a wake-up interrupt generation at least one of the three axes must be bigger than the threshold. The duration parameter defines the minimum duration of the wake-up event to be recognized; its value is set using the WAKE_DUR [1:0] bits of the WAKE_UP_DUR register: 1 LSB corresponds to 1*ODR time, where ODR is the accelerometer output data rate. It is important to appropriately define the duration parameter to avoid unwanted wake-up interrupts due to spurious spikes of the input signal.

Regards