cancel
Showing results for 
Search instead for 
Did you mean: 

implement tap detection using Lis2hh12

SK.16
Associate II

I want to implement double tap detection using LIS2HH12 accelerometer. It does not have in-built registers to implement it. Has anybody implemented it?

1 ACCEPTED SOLUTION

Accepted Solutions
Eleon BORLINI
ST Employee

Hi @Community member​ ,

even if the LIS2HH12 doesn't directly implement the tap detection, you can consider the DT0101 design tip, that suggest you how to implement this feature on accelerometer even in the absence of the direct digital feature, for example the LIS2DH12.

For single-tap recognition there are two parameters to set up – threshold and shock time window.

  • Threshold defines the intensity of the shock needed to generate a single-tap interrupt. The amplitude of the shock is proportional to the force that the user applies in either a positive or negative direction.
  • Shock time window sets the maximum allowed duration of a shock. During this window the acceleration has to fall below the pre-selected threshold. Figure 2. depicts functionality of the shock window parameter.

In the LIS2HH12 case, you can tune ACT_THS (1Eh) and ACT_DUR (1Fh) to define the shape of the single tap event, as shown in the picture below:

0693W00000BbDqIQAV.png 

If my reply helped you in answering your question, please click on Select as Best at the bottom of this post. This will help other users with the same issue to find the answer faster. 

-Eleon

View solution in original post

4 REPLIES 4
Eleon BORLINI
ST Employee

Hi @Community member​ ,

even if the LIS2HH12 doesn't directly implement the tap detection, you can consider the DT0101 design tip, that suggest you how to implement this feature on accelerometer even in the absence of the direct digital feature, for example the LIS2DH12.

For single-tap recognition there are two parameters to set up – threshold and shock time window.

  • Threshold defines the intensity of the shock needed to generate a single-tap interrupt. The amplitude of the shock is proportional to the force that the user applies in either a positive or negative direction.
  • Shock time window sets the maximum allowed duration of a shock. During this window the acceleration has to fall below the pre-selected threshold. Figure 2. depicts functionality of the shock window parameter.

In the LIS2HH12 case, you can tune ACT_THS (1Eh) and ACT_DUR (1Fh) to define the shape of the single tap event, as shown in the picture below:

0693W00000BbDqIQAV.png 

If my reply helped you in answering your question, please click on Select as Best at the bottom of this post. This will help other users with the same issue to find the answer faster. 

-Eleon

SK.16
Associate II

Hello Eleon,

Thanks for the answer. I have set ACT_THS=0x30 and ACT_DUR=0X18. along with the single tap if I move the device it detects as tap. I am still not able to detect only the double-tap.

Hi @Community member​ ,

I'm afraid that on LIS2HH12 the double-click cannot be implemented, since for this feature recognition you need to set up four parameters, so you would need additional registers that are available on LIS2DH12 or LIS2DW12. In fact, besides the threshold and shock time window which are the same as for single-tap recognition, there are also the quiet time window and latency time window parameters.

But you might implement the feature at software level: when you detect a single tap, you start counting the subsequent data (the timing is determined by the ODR), and if you detect another tap within a certain interval you can interpret the overall event as "double tap". This would simulate the quiet time and the latency windows.

0693W00000BblDFQAZ.png 

Let me please know if this software solution is feasible for you.

-Eleon

Thanks, Eleon for the reply.

Getting the exact time interval between 2 taps is a bit tricky. Even if I set a time interval, moving the accelerometer without tapping also detects the interrupt.

Thanks

-sk