Golf is a fundamentally challenging sport. Hitting a ball with a stick into a tiny hole that can be hundreds of yards away with any degree of proficiency requires years of practice. It comes as little surprise, then, that those that have more than a passing interest in the sport are eager for methods to speed up the process of improving their game. And as a quick trip to any sporting goods store will tell you, the market is flooded with solutions that promise to take a few strokes off of your scorecard. These solutions do not come cheap — it would be easy to spend many hundreds or even thousands of dollars on training aids, many of which are of questionable practical value.
It was because of this current state of affairs in training aids that I recently created a device I call Golf Ace. The idea was to create a very low cost system that is simple to operate and has real potential to improve a person’s golf skills. I think one of the very best ways to learn a skill is to learn from someone who has a lot of experience in that area. So, with these basic guiding principles, I built Golf Ace, which uses an off-the-shelf development board and a machine learning model built with Edge Impulse to teach golfers to putt with the same technique as those with much more experience.
I chose an Arduino Nano 33 IoT board to power this system because of the low cost, tiny form factor, Arm Cortex-M0+ processor, and onboard accelerometer. For the prototype, I hot glued the Arduino near the head of a putter. I wired this board up to an RGB LED that I attached to the top of the putter head, such that it is visible to the golfer during use. A pushbutton was attached to the handle of the putter, where it can be reached while putting, and I also wired that to the Arduino. The entire system is powered by a rechargeable 400 mAh LiPo battery and a power boost converter.
To use Golf Ace, when the golfer is ready to putt, they tap the button on the handle of the putter. This triggers the Arduino to begin recording accelerometer measurements. At the conclusion of the stroke, visual feedback is given via the RGB LED. If it lights up green, your form closely matches that of the expert that the putter was trained to recognize. A red light means that something was off with your form.
In order to recognize what a particular golfer’s putting form looks like, a K-means anomaly detection model was built with Edge Impulse. I collected accelerometer data that was captured while putting with good form, and uploaded it using the data acquisition tool. Ideally, this dataset would be collected from professional golfers, allowing Golf Ace users to choose a putter that teaches them to putt like their favorite pro. Unfortunately that was not an option for me, so I had to supply the training data myself to prove the concept.
With model training complete, I used Edge Impulse’s deployment tool to package up the entire anomaly detection pipeline as an Ardunio library. I imported the library into Arduino IDE, then was able to include it in my own sketch that handled capturing accelerometer data and passing it into the analysis pipeline, in addition to dealing with button inputs and changing the LED colors.
Check out the video below to see Golf Ace in action. I was pleasantly surprised to see how well it worked for being a weekend project — the device consistently recognized my good putts that matched my carefully-performed training putts, and it flagged any putts with poor form as anomalies. I would love to have the opportunity to train this device with data from an actual professional golfer someday. Also, in principle, this same device and method should work just as well with other types of clubs, so I plan to eventually instrument drivers, and other clubs, so that technique can be improved in other areas of the game as well.
Take a look at my public Edge Impulse project and GitHub repo for the details you need to improve your golf game and have some fun with machine learning.
Want to see Edge Impulse in action? Schedule a demo today.