S1E1: How do Step Counters work in your fitness watch?

I decided to go on a solo trip to Miami for 5 days after graduation, in 2019. I was planning to walk around a bit and wanted to find out how much I will have walked by the end of the trip. But I don’t like charging my watch, so I got a Gshock that gave me the step counting capability without needing to charge it. By the end of the trip, I clocked 70000 steps and was wondering how this worked. Now I know, and so do you…

There are many variations of step counting algorithms used in gadgets and this one is from Texas Instruments.

Relevant components

Accelerometer

A 3-axis accelerometer is mounted inside your fitness tracker to measure acceleration data along the X, Y, and Z axis of your device. The acceleration along these axes keeps changing due to your hand motions, as you go about your day.

Microcontroller

A microcontroller (small computer) is used to filter the data measured by the accelerometer. After which, it runs the algorithm that counts the number of steps in real time.

Step counting Algorithm

Data collection and filtering

Figure 1 - Source: Patent US20130191069A1

  1. The accelerometer sends three streams of acceleration data (along the X, Y, and Z axis) to the microcontroller.

  2. The microcontroller filters the noise in each axis.

  3. Let’s say the microcontroller receives 100 values per time period for each of the three axes. The absolute value (modulus) of this data from all three axes is summed together to produce a single amplitude value for each of the 100 samples.

  4. It is then smoothened (filtered) again to produce an amplitude vs time graph as shown in figure 2.

Step counting algorithm

After data collection and the filtering steps, the resulting amplitude graph is here.

Figure 2 - Source: Modified from Patent US20130191069A1

Step detection is performed in the following manner.

  1. The algorithm aims to find a positive slope in the waveform. If the amplitude for this positively sloped portion (marked 0 in the figure) and its time duration (marked 1 in the figure) exceed a threshold, then the step count is incremented.

  2. Once such a portion is found, it tries to find a negative sloping region that exceeds similar thresholds (marked 2 and 3 in the figure). The thresholds for the positive and negative slope search can be different.

  3. Once this cycle is complete, the step counter algorithm attempts to find the next positively sloping region in the waveform to increment the counter again if it satisfies the thresholds. This cycle repeats.

A time duration threshold is essential for step detection because it can be discriminated against noise and non-step motion. Also, note that the sample window is dynamic and keeps changing with time as the microcontroller receives new data. This figure is an example, it shows approximately 10 steps.

Step counter

When the algorithm detects a step, a counter is incremented starting from 0 daily. It is stored in your device digitally for later reference based on the model of your fitness watch. Using the number of steps per unit time and the user's height, we can also estimate the distance traveled.

Thank you for taking the time to read my blog post. If you liked what you read, consider subscribing to my newsletter for exclusive content and understand how a gadget works in only 3 minutes, sent directly to your inbox every Wednesday. We'd love to have you as a part of our community. Also, if you found this post to be informative or enjoyable, please share this with your friends on social media. Thank you again!

Previous
Previous

S1E2: How do Electric beard trimmers work?