top of page
Blockchain Developer

Statistics Tracker

Inspired by my Macro Keyboard project, I was curious if I could turn the Macro Keyboard hardware into a mini computer for tracking specific statistics in various applications.

Background

The Macro Keyboard project I did contained a programmable micro controller, a keypad with 8 customizable buttons, an analog potentiometer, and a small LCD display.  This makes for the perfect mini computer setup that can be customized to perform very specific tasks associated with various data tracking applications.  In the Macro Keyboard Project ,while I completely customized the code I implemented, I was following a general approach to creating my custom macros.  I wanted to challenge myself to come up with a totally unique use case for this device and write all my own code from scratch

JPEG image 9.jpeg

My Application

While there are many different ways to implement a device like this, I have chosen to make my very own real time tennis match stat tracker for tracking 20 of, in my opinion, the most important player statistics during a match.  Tennis has been one of my passions for my entire life and I have both competed and coached at various levels throughout my athletic career.  As in all sports these days, match data and player statistics play a huge role in the development process of a tennis player and understanding certain patterns and tendencies along with strengths and weaknesses can dramatically accelerate the player improvement process.  Aside from me doing this project for fun and to continue developing my programming skills, I am the assistant varsity tennis coach for both the men's team and women's team at Carnegie Mellon University and I thought that this device could have potential to provide valuable insight on our players and how best to form individualized playing strategies to increase our probability of winning matches.  At this point I have just finished creating this project and have not yet had the opportunity to use it with the teams.

stat cartoon.jpg

Inspiration

During a professional tennis match there are usually about 10 different cameras located around the court tracking the movement of both the players and the ball at 50 frames per second.  There are sensors that range from court level within the net to the roof tracking various match and environment conditions.  There are multiple data entry systems constantly taking in statistics being sent via these cameras and sensors.  Most of this very sophisticated technology is hidden on tournament grounds but it is there and used by broadcasters, interviewers, players, and coaches to get the slightest edge during competition.  

Pro Tennis Stat Tracking.PNG

The margins in tennis are so small and the difference between being top 10 in the world making millions of dollars and being 1000 in the world struggling to cover the most basic costs can sometimes come down to only a handful of points.  This is why understanding the numbers and percentages is crucial to becoming the best player you can be.

There was a very interesting article I came across where college tennis matches were analyzed for the purpose of gaining more insight into how to win at the collegiate level and what areas are most important to focus on during practice.  Over 2,000 matches were analyzed and 230 different stats were tracked for each player.  The caveat to this experiment was that all the data was collected post match by spending hours and hours of time watching video recordings and manually entering point results.  While the experiment conclusions were fascinating, it took a significant amount of time to acquire the data and it would be impossible to do this style of tracking in a live environment due to the fact that a match just progresses too quickly.  This is how I came up with the idea of creating a device that would be easy and intuitive to use for coaches to track a tennis players statistics during a match in a live setting for immediate results without the need for hours of processing time or expensive camera equipment.

College Match Case Study:

Development

The first step in the development process for this project was to create logic so a computer program could understand the scoring of a tennis match.  Creating a scoreboard that would just display the current match score would be easy but in this case the computer would have no idea what the various numbers mean and what the current state of the match is.  My first goal was to create a startup sequence where the user would be prompted to answer a few initializing questions.  After this start up sequence is completed I wanted the user to be able to inform the computer who won the point and with this information alone the code would be able to accurately track the match score, automatically updating the points, games, sets, and even the player who is currently serving, just like you would see on TV.  Due to the scoring complexity of tennis this was no easy task, additionally there are multiple scoring formats that can be played in tennis adding further complications and creating the need for my initializing questions.  400 lines of code later I had a working "smart" scoreboard that could accurately track a tennis matches score with the only input being who won the point.  Additionally, this code is also able to automatically detect when the match is over and who the winner is.

​

The next step was to create all the variables necessary to calculate the stats I chose to target.  Unlike the Tennis Analytics study, I chose to focus on 20 important stats with the ability to continue adding more stats if necessary.  I have 30 different variables that get adjusted every point in order to keep track of the match score and to acquire the necessary information for the 20 stats I have chosen to focus on.  Every point the user is prompted to answer a few yes or no questions about the point, for example, "Was the first serve made?" or, "Was the return made?"  I have a dedicated Yes and No button on my keypad that the user can press to answer these questions.  Next, my program will ask for the point result.  I have 6 pre programed responses, each mapped to their own button, that cover all the possible outcomes of the point in a broad sense.  After the user inputs their response my stats are updated, the score is updated and shown to the user, and then the process repeats.  All information is entered from the perspective of your player, so if the point result was "Forehand Winner" for example, that would mean your player hit a forehand winner on their opponent.

​

Once the match is over, the LCD screen goes into stat display mode where it rotates between all the player stats for the match.  This mode will repeat over and over until the reset button is pressed to start tracking a new match.  The analog potentiometer can also be used to adjust the speed at which the stats are changed on the LCD.

Testing

The testing process for this project has 4 phases, 3 of which have been completed and I am waiting for the opportunity to perform phase 4.  The first phase was during the initial development of the "Smart Score Board System."  Due to the complexity of the tennis scoring system I had to perform about 4 different tests every time I implemented  a new element to ensure my code would accurately account for the various modes of play (an example of a mode of play is using or not using Ads).  These tests were performed in conjunction with the code development and helped me to identify many small bugs that would have been very difficult to diagnose if I tried to complete the entire code before doing any testing.

​

​

​

​

​

​

The second testing phase was after my "Smart Score Board" system was completed.  I sat through hours of matches just tracking who won every point and ensuring that in every situation my code was updating the score properly and also correctly identifying the end of matches.

​

The third phase of testing was after my entire device was complete and tracking match/player statistics.  I had to test that my tracking was accurate and to do this I again sat through hours of match play.  There are special events called UTR Pro Series for high level college players and introductory level pro players.  These events are recorded and some basic stats are tracked and displayed for the match.  I used these matches as test cases for my program and after the match was over I was able to compare my calculated stats with the events calculated stats and ensure that my numbers matched theirs, which they did.

​

​

​

​

​

​

The fourth and final testing phase would be with actual tennis players in real time at a tournament or competition.  Considering that I have only recently finished this project I have not yet had the opportunity to use this with any of the players I work with.  However, I hope the opportunity to do so will arise soon!

JPEG image 16.jpeg
JPEG image 13.jpeg
JPEG image 15.jpeg

Pictures

JPEG image 14.jpeg
JPEG image 11.jpeg

All the material associated with this site is considered the intellectual property of Sam Lapides and/or the companies and sponsors associated with particular projects. Unauthorized downloading, distribution, or usage of this material is strictly prohibited.

©2021 by Sam Lapides.

bottom of page