# Tap detection with accelerometer?

**URL:** <https://f.ruuvi.com/t/tap-detection-with-accelerometer/6544>\
**Category:** 🇬🇧 Ruuvi firmware development\
**Created:** [8 January 2024 08:48 UTC](https://f.ruuvi.com/t/tap-detection-with-accelerometer/6544 "2024-01-08T08:48:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Haberler](https://f.ruuvi.com/user_avatar/f.ruuvi.com/michael_haberler/32/2116_2.png) [@Michael\_Haberler](https://f.ruuvi.com/u/Michael_Haberler)\
**Post date:** [8 January 2024 08:48 UTC](https://f.ruuvi.com/t/tap-detection-with-accelerometer/6544/1 "2024-01-08T08:48:48Z")

</div>

it seems the LIS2DH12 can do [single and double tap detection](https://www.st.com/resource/en/design_tip/dt0101-setting-up-singletap-and-doubletap-recognition-with-sts-mems-accelerometers-stmicroelectronics.pdf)

that sounds like an interesting input gesture  
anybody tried this? any code examples?

Michael

---

<div class="post-metadata">

**Author:** ![otso](https://f.ruuvi.com/user_avatar/f.ruuvi.com/otso/32/1651_2.png) [@otso](https://f.ruuvi.com/u/otso)\
**Post date:** [9 January 2024 11:31 UTC](https://f.ruuvi.com/t/tap-detection-with-accelerometer/6544/2 "2024-01-09T11:31:47Z")

</div>

I tried it once, but in the end I wasn’t happy with the reliability of detection.

I would take activity interrupt as a base and configure the double-tap register writes in there: [ruuvi.drivers.c/src/interfaces/acceleration/ruuvi\_interface\_lis2dh12.c at c84cf1c735cd4ae3491602a6a731b9c963f178f8 · ruuvi/ruuvi.drivers.c · GitHub](https://github.com/ruuvi/ruuvi.drivers.c/blob/c84cf1c735cd4ae3491602a6a731b9c963f178f8/src/interfaces/acceleration/ruuvi_interface_lis2dh12.c#L1123)

---

<div class="post-metadata">

**Author:** ![Michael\_Haberler](https://f.ruuvi.com/user_avatar/f.ruuvi.com/michael_haberler/32/2116_2.png) [@Michael\_Haberler](https://f.ruuvi.com/u/Michael_Haberler)\
**Post date:** [10 January 2024 19:46 UTC](https://f.ruuvi.com/t/tap-detection-with-accelerometer/6544/3 "2024-01-10T19:46:03Z")

</div>

thanks! will give it a try

Michael

ps: anything in the wings moving to Zephyr?

---

<div class="post-metadata">

**Author:** ![otso](https://f.ruuvi.com/user_avatar/f.ruuvi.com/otso/32/1651_2.png) [@otso](https://f.ruuvi.com/u/otso)\
**Post date:** [11 January 2024 15:28 UTC](https://f.ruuvi.com/t/tap-detection-with-accelerometer/6544/4 "2024-01-11T15:28:41Z")

</div>

We’re not looking into migrating to Zephyr as of right now, we’ll revisit the decision if we start building on Nordic’s newer chips.
