Golf swing detection using accelerometers - Any suggestions?

Has anyone played with acceleromter functionality where they try detect a swing of something like a golf club. Not looking for stroke analysis, just that a swing occurred. Better yet if it can detect the difference between a practice swing and actually striking a ball. I'm guessing numerous sports would have similar results.

I have a golf app and it'd be really nice to detect the swing automatically. Way too easy to forget to push the button that indicates I just swung. I use this to automatically tell me how far I've hit.

I've just started playing with this and created a simple app that just graphs the the three axis of the accel object but have had a chance to analyze it yet. I'm graphing a 10 second section and grabbing the data accel data 10 times a second.

I'm curious if I'll be able to get away with looking at the magnitude of any accelerations or if I have to be smarter about pattern recognition. False positives aren't that big a deal.

If anyone has tried something similar and has any tips, I'd greatly appreciate it.
  • I've not really looked at it, but there is a "PitchCounter" sample in the SDK. Seems there would be similarities to counting pitches.
  • Thanks Jim (who knows all!), I hadn't seen that sample. I saw the AccelMag sample and started from there. Didn't dawn on me there would be a 2nd sample using the accel sensor.

    Just tried it out. I was hoping it would just work for golf, but it seems too smart. I think it has something to do with the timing of the back swing. With a golf club it is too quick. Looks like I'm going to actually have to understand how it works. Lots of math and stuff.

    only 24 posts to go for you!
  • Garmin already has their TruSwing sensor that does this in conjunction with the Approach watch series.
  • Garmin already has their TruSwing sensor that does this in conjunction with the Approach watch series.


    The Fenix 5Plus (and I assume others) already does this auto swing detection with the built in accelerometers but I've written my own golf app that works on my 935. Plus, I really like having the distance since last hit always showing, except I often forget to press the button before I'm halfway to the ball. On the Garmin app, you need to bring up the "measure distance" screen which is automatic on devices like the Fenix 5Plus, but it only stays visible for a few seconds, and hides the rest of the interface. I'm guessing the TruSwing sensors use a proprietary Ant or Ant+ signal so I probably couldn't take advantage of that. I haven't used it but either you have one that you move between clubs, or one on each club (not sure which) but either way it'd get tedious.

    At this point I have taken this on as an interesting project. I have it working where it graphs the last 10 seconds of x, y, & z accelermoter data on the screen (10 / second) and just implemented where it then sends this data to my server. Just starting on a Windows app to manage these "swing windows" so I can play with the data and try to come up with some good algorithms that minimize false positives and false negatives. It'll be much easier to analyze on the PC plus I can keep a catalog of good swing data for regression tests as I tweak the algorithm.
  • Thanks vald70. I just skimmed the article but quite interesting. The end result doesn't seem that different than what I did but much more scientific and thought out. Someday when I'm looking for a fun project...

    I've pretty much just started using the golf app on the F5+ or 935 instead of my own. But it was still a really interesting and fun exercise. I'll definitely be able to put what I learned through it into future projects.
  • Former Member
    Former Member over 5 years ago

    I've trained my swing on Vila Sol Golf Course

    Great weather and really good pros playing there!