paint-brush
Getting High-Frequency Tennis Motion Data from Apple Watch [Part 2]by@pavelshadrin
459 reads
459 reads

Getting High-Frequency Tennis Motion Data from Apple Watch [Part 2]

by Pavel ShadrinOctober 9th, 2023
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Accruing real tennis motion data from Apple Watch and exploring insights, including acceleration, rotation, and more.
featured image - Getting High-Frequency Tennis Motion Data from Apple Watch [Part 2]
Pavel Shadrin HackerNoon profile picture

Part 2: Real Motion Data from Apple Watch and Quick Analysis

In the previous part, I demonstrated how high-frequency motion data can be collected during a tennis session using my sample app. In this part, I'll provide a sneak peek into the data and try to extract some high-level learnings from it.

How I Collected the Data

I play tennis once a week, so once I made the app, I was able to quickly take it to the real world to obtain the sensor data. I'm right-handed, so for better accuracy, I wore the watch on the right wrist even though I usually wear it on the left. As my simple iPhone sample app only keeps the data in memory and there should be an established connection between the counterpart apps, I had to keep my phone in my pocket.


Only during the session, I realized that the iPhone app has to be in the foreground, otherwise the WatchConnectivity messages are not delivered. I made several recordings, each of them represented a single rally. On average, the warm-up rallies were 6-8-shot long.

Accelerometer Data

For a typical rally, its accelerometer file would be about 1–1.5 Mb. Here is a sample file from that warm-up session that represents roughly a 19-second series with 15651 readings – remember, it's an 800 Hz sensor!


Here is a simple line-chart visualization of the acceleration measured in Gs across all three axes:

We can clearly see the spikes just before and after the shot, with the Z-axis showing the highest amplitude. The Z-axis is orthogonal to the watch screen surface. That's why it's no surprise that it gets the largest acceleration when the wrist moves toward the ball. I just didn't expect that the racquet acceleration could reach 30G! Y is pointing from the bottom to the top edge of the watch, and X is basically the continuation of the digital crown. That's why it shows the least amount of movement.


A single-shot close-up is also interesting (how acceleration is thrown back and forth over a tiny period of time):

Rotation Data

The gyroscope data is similar to the accelerometer one, but here, it's radians per second for each axis. It shows similar peaks around the same timestamps; however, its readings are 4x less frequent:

Interestingly, the X axis shows higher amplitude than Z here, and each axis has a distinct pattern. As X is the digital crown axis, higher values here may mean more spin that comes from the wrist.

Conclusion and What's Next

This was just my first tennis session with this app, and my main goal was to see if it actually worked as expected and if the data had some actual meaning, even if presented as a simple line chart. Now, I clearly see a correlation between the line and its corresponding shots – for example, higher amplitude seems to mean a higher ball speed. I plan to eventually extract more useful information from the raw data – such as shot frequency, time to contact, distinguishing backhand vs forehand vs volley, approximate ball speed, and so on. To start, I could try to apply a median filter and then find local peaks.


In addition, here are the ideas for improvements that I'm going to make to the app to be able to better analyze the data in future sessions (I am not sure if all of them are feasible and quick to build, but they should definitely help):


  • Persist data onto disk on the watch during the session and transmit it as a large file – to avoid having to keep the iPhone app nearby and active.
  • Preview the line charts right on the iPhone.
  • Put the accelerometer and the gyroscope data onto the same timeline.
  • Add a way to map the data recording to the actual rally – maybe by shooting the video of the practice on the counterpart iPhone and then synchronizing it with the motion data.


I'm curious about what you think can be done with this raw data. Please do share your suggestions in the comments!