implement tap detection using Lis2hh12
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-06-16 11:41 AM
I want to implement double tap detection using LIS2HH12 accelerometer. It does not have in-built registers to implement it. Has anybody implemented it?
Solved! Go to Solution.
- Labels:
-
Accelerometers
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-06-17 12:50 AM
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:
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-06-17 12:50 AM
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:
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-06-22 10:54 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-06-23 1:43 AM
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.
Let me please know if this software solution is feasible for you.
-Eleon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-06-23 4:19 AM
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
