Does anyone have an algorithm to detect swim laps using the accelerometer data?

I'm a newbie and trying to create an app for myself that detects when I complete a swim lap in a pool by pushing off the wall.

Thx!

  • I don't think even Garmin has a good one. I guess that it won't be easy to write such Algo. Why the built in swimming features are not enough?

  • Thanks for the reply... the factory app does not record HR during a swim... I would like to have that feature added..

  • I've not tried it, but you might try using the compass to look for a direction change when you turn around.

    What device do you have and are you using an external HR band?

    Using the OHR on the watch, I see HR while running the app and in Garmin Connect.  An external band can be a bit tricky, as the signal doesn't travel well in the water.  With some watches/bands, the band saves the HR and send it to the watch when you save the activity..

  • I've got a vivoactive3 and use internal HR which works well as I trick the watch using run activity while I swim and record HR. I'm not familiar with the compass... can't use GPS since that definitely will not work in water...

    Thx

  • If I recall, with the va3 you can only use the watches OHR when swimming.  It won't use an external band.

    There is a compass in the watch itself and it doesn't need GPS.

    var currentHeading as Lang.Float or Null

    The true north referenced heading in radians.

    This provides compass orientation if it is supported by the device.

    Since:

    API Level 1.0.0

    Returns:

  • No matter what sensor you'll use (compass or accelerometer) it won't be easy to detect "swimming direction change". As an example when you swim (probably every possible stroke style) the compass will do an almost 360 degree spin for each stroke. Just check out how bad the built-in lap detection is, that will give you a good idea how hard it is to detect it.

  • Buy a HRM Swim, that's exactly for this purpose. It records the whole swim activity and stores it in it's memory, and at the end of the activity it syncs with your watch / Garmin Connect and you'll have the HR data.

  • But the HRM-Swim/HRM_Pro probably doesn't sync that info to older lower end devices like the va3 and that's what the OP has.

    There is no longer a forum for the va3, but looking at the one for the va4, the va4 doesn't support the "store and forward", and the HRM-Swim/Pro is treated like the base HRM-Run

  • Thanks... I'll give it a try...

    I know there is a way that works as I'm using an app that records my laps well in the pool built by a 3rd party however although it monitors my hr fine while I swim, as soon as I finish it zeros the hr data and does not get saved to fit.

  • Another related question...

    I'm using a fit file from a swim activity to enter into the simulator but for some reason the Sim only takes in the first 30sec and then repeats the same data... is this a limitation of the tool or am I missing a setting?

    Thx