Detect a tap using accelerometer

To save me re-inventing the wheel, can anyone provide algorithms for detecting taps on the watch using the accelerometer on the VA-HR?

I would like to be able to respond to a single or double-tap on the side (y-axiz) or the face (z-axis) of the watch to use as an alternative user input to a touch-screen horizontal or vertical swipe for when the watch is wet (dinghy racing can be a wet sport!) and doesn't respond well to the touch screen.

I have played with the AccelMag sample, so am encouraged that it's possible.

I can see that it'll need a timer with a pretty fast refresh rate, looking for a distinct variation from the background levels and look for distinctive patterns, and I'm sure there are folks out there who have done the hard yards to R&D some appropriate values.
  • There's some new stuff in the 2.3.0 beta SDK you may want to check out.
    (like https://developer.garmin.com/blog/category/connect-iq-sdk/ and action intelegence - but I've not looked to see which devices support it)

    I for one, might just look at a non touch device for your conditions, as the current generation of wearable touch devices are the va-hr and fr 630 (and the 630 is on CIQ 1.x), but all the others are all "button based", or maybe look at using an Edge - bigger display, and the 520 is button, while the 820/100 are touch.
  • There's some new stuff in the 2.3.0 beta SDK you may want to check out.

    where do I find that?
    (like https://developer.garmin.com/blog/category/connect-iq-sdk/ and action intelegence

    Can you give me a more specific reference, I can't see any relevant references there.
    I for one, might just look at a non touch device for your conditions,

    One of the main attractions that prompted our choice of the VA-HR was the touch screen. And it works really well most of the time - racing on big boats tends to be a fairly dry event. It's just that dinghys and racing in the rain present issues, s I'd like to stay touch with a backup for wet conditions, hence the current enquiry.
  • where do I find that?

    This blog post...
  • Interesting idea. Post back here if you get it working reliably. As I've now switched to a 935 from my 630, I'd love to have additional input options.
    Definitely miss the flexibility I had with the touch screen. Heck, something like this might even give a very rudimentary input to data fields.
  • To save me re-inventing the wheel, can anyone provide algorithms for detecting taps on the watch using the accelerometer on the VA-HR?

    I would like to be able to respond to a single or double-tap on the side (y-axiz) or the face (z-axis) of the watch to use as an alternative user input to a touch-screen horizontal or vertical swipe for when the watch is wet (dinghy racing can be a wet sport!) and doesn't respond well to the touch screen.

    I have played with the AccelMag sample, so am encouraged that it's possible.

    I can see that it'll need a timer with a pretty fast refresh rate, looking for a distinct variation from the background levels and look for distinctive patterns, and I'm sure there are folks out there who have done the hard yards to R&D some appropriate values.


    I developed a very similar app for apple watch to play/pause music while skiing.

    It worked, but it's very tricky because you have to classify a lot of data as either normal bumps or intended taps, which requires a lot of in the field raw data. It's also very processor intensive, so on the apple watch I only activated in when the watch was raised.

    Essentially my method was to use derivatives (3rd as I recall) and then use the raw field data in excel to work out the parameters required to classify each correctly
  • Need 10 ms sampling rate to detect a tap

    I have tried to "clear the fog" on Finite Impulse Response (FIR) and Infinite Impulse Response (IIR) but all sites seem to go straight into signal processing which doesn't lift the cloud for me.
    I have done a little research and sadly conclude that neither the current 2.2 nor the 2.3 Beta Connect IQ will allow us developers to detect a tap, because the sensor data needs to be analysed at intervals of 10ms or less to detect a tap, and the current Timer appears to have a minimum callback time of around 35 ms.
    The 2.3 Beta FIR is described as providing "25 Hz/3-axis accelerometer access", or 40 ms sampling rate, so that probably won't cut the mustard either.

    It seems that many accelerometer chips ( http://www.nxp.com/assets/documents/data/en/application-notes/AN3919.pdf )have a built-in capability to report "taps": I wonder if the chip in the VA-HR is of that class, and if so, why haven't we been given access to that?

    Which makes me wonder how the the watch can identify footsteps with such amazing precision? I suspect the IQ developers are getting much better access to the accel sensor that we are.

    Update:
    Actually the sampling rate has to be far, far shorter than 10 Ms to detect a tap. It seem the entire tap event lasts only around 10 Ms, so we need to sample at 400 to 2k Hz to detect a tap, which is patently out of the question for an MC app. We need to rely on the chip to provide the tap event.

    PS. The pebble watch SDK provided access to a tap and double tap, but the developer community was pretty unhappy with the implementation as it was far too insensitive and took a mighty bash to trigger the event.
  • This is a pretty interesting discussion, but I think RaceQs is correct that this is likely outside the capabilities of CIQ right now. Step detection is a little different in that we can analyze a pattern over time, whereas a tap is simply an impulse. I'm not a signal processing expert, however, and I'm not familiar with the details of our various algorithms. :)
  • this is likely outside the capabilities of CIQ right now.

    Brandon, your "right now" is intriguing!
    It would be great if we could hear whether the accelerometer chip (in the VA-HR for example) does natively report taps, giving us some hope of a tap callback being available in a future CIQ release, or if it doesn't and we have to abandon all hope.

    I could open up my watch and look for manufacturers identifications on the chips but don't have a spare one to destroy. :(
  • Have you looked at the onTap() and onHold() on the va-hr? There are 9 "tap regions" (3x3 grid). It still uses the touch screen, but in the rain, if a swipe up isn't working well, a hold in the upper right corner to do the same thing might be more reliable, for example.
  • Have you looked at the onTap() and onHold() on the va-hr?

    Yes, extensively, and they are increasingly compromised in wet conditions to the extent that they fail completely when submerged.
    There are 9 "tap regions" (3x3 grid).


    I think you have misinterpreted the doco. There are no "tap regions". It is just a recommendation that when designing a touch-screen UI, the touch areas be limited to a 3x3 grid.