How does my device's accelerometer know how far I ran on the treadmill?

The home screen and tutorial opening for the "Zombies, Run!" app
Screencaps by HowStuffWorks staff

I'm exhausted, but I have to keep running. I have to warn the Brunswick settlement that a horde of zombies is on its way to attack them. The song I'm listening to ends, I hear a crackle over the comms channel, and then Sam relays the bad news: The zombies are closer to the settlement than I am, and I'm going to have to pick up the pace to get there in time to deliver the warning. With human lives at stake, I have no choice. I have to find a burst of speed.

Never mind that all of this happens in the safety of my home, on my treadmill. The running and resultant exhaustion are very real. And the dire survival scenario? That's courtesy of "Zombies, Run!" -- an app designed to gamify running and walking workouts by layering an apocalyptic storyline over your training. I love being able to lose myself in these fictional missions while I run, but the reality is that I'm training for a half marathon. I need to achieve certain goals in my running workouts to ensure I'm prepared for my upcoming event. I need to know how far I've run, and at what pace.

Advertisement

There are abundant running apps for iOS and Android phones to track your distance and time for you. Almost all of them have GPS tracking built in, which nearly all runners and developers will agree is the most accurate way to monitor your stats. But sometimes, schedules and location make it impossible to run outside, and then your app has to rely on your device's accelerometer to track your pace and distance. But how can it do that, and are those measurements accurate?

Can an Accelerometer Calculate Its Own Limitations?

Enter "running" into the Apple App Store's search bar, and you will discover more running apps than you can shake a stick at -- but some only calculate distance in GPS mode.
Screencap by HowStuffWorks staff

The motion sensors of an accelerometer measure changes in direction and velocity -- acceleration. If you have a mobile device in your pocket while you run, the accelerometer constantly assesses and calculates your movement and cadence as you accelerate into each stride and decelerate slightly after foot strike.

There are dozens, if not hundreds, of running apps available for smartphones on the Apple App Store and the Android Marketplace, but not all of them offer indoor distance tracking. Why is that? It turns out that while using GPS to determine the ground you've covered while running outside is relatively easy, calculating the imaginary distance you cover while running indoors on a treadmill is a little bit tricky.

Advertisement

Alex Macmillan, lead developer for the "Zombies, Run!" app, explains that one of the challenges inherent with using an accelerometer to track a runner's distance on a treadmill is the accelerometer itself. He says that "Accelerometer data can be very 'noisy,' which makes it difficult to interpret. You need to be able to tell the runner's motion apart from the motion of the phone simply rattling around in the runner's pocket."

Another challenge cited by Macmillan is the sheer data load involved in calculating distance statistics. This is tricky because, as he puts it, "You need to read new data (or 'sample') from the accelerometer very frequently in order to get good results. This means you have to write code fast enough to perform all of your calculations in the space between one sample and the next."

Add to those issues the fact that you're not actually going anywhere on a treadmill, and it becomes clear that teaching the tech in your phone to determine your indoor distance is no small feat. So how do developers work with these limitations?

Advertisement

You've Just Finished a 5K ... Maybe

There is a relatively easy way to calculate distance using an accelerometer: Program it to track steps just like a pedometer, and then multiply the number of steps by the runner's stride length to get your distance total. Voila! Distance calculated. Well, sort of. That's how many apps handle treadmill running, but the problem with this approach is that there's a potential for a huge margin of error.

First, there needs to be input from the runner. That means you'll need to tell your app your height and weight so it can estimate your stride length -- but what if your legs are proportionally longer than another person whose height is close to your own? Some apps will also ask you to run or walk a distance you know is accurate -- say a mile (1.6 kilometers) or so -- while running the app, then tell the app how far you ran so it can adjust those estimates to be more customized to you. The "Nike+ GPS" app for iPhone, for example, lets you update your settings by using its "calibrate run" option to enter your distance after your run, and it will recalculate your stride length for future outings.

Advertisement

But what if you use run/walk intervals for your training? Your walking stride is unlikely to be the same length as your running stride. What if your calibration run was faster or slower than your normal pace? What if your gait is a little uneven, and every stride isn't the same length? As Alex Macmillan told us, "If the stride length measurement is wrong by even a small amount, the total estimated distance can be wrong by a long way." If you've ever used a running app while working out on a treadmill, you've probably noticed a disparity between the distance the app says you run and the treadmill says you run -- evidence of this problem. That's not really ideal if you're trying to train for a long-distance run like a half marathon.

Macmillan's app, "Zombies, Run!" doesn't currently offer accelerometer distance tracking, but his team is working on it, using treadmill research and a different approach to distance calculations. "By only needing to measure the relative change in a person's speed, rather than attempting to accurately estimate the runner's actual speed, we believe we can create a model that works for a very wide range of runners. In this way we hope that the runner's stride length, height and weight will not be important when we make our calculations." Will this approach work? Only time will tell.

Why not just use your treadmill to track your mileage? After all, most treadmills have digital readouts that show you how far you've run based on the movement of the belt passing under your feet. But do a quick Google search for "treadmill distance accuracy" and you'll see that many people feel that the number on your display isn't necessarily correct, either. Even a small miscalculation in belt length can create a big error over the course of the thousands of revolutions it makes around its rollers in the course of 5K training run.

So what can you, as a runner, do to track your treadmill time as accurately as possible?

Advertisement

Customize Your Experience for Best Results

The "Nike+ GPS" app has a simple interface for entering your actual distance for any run you've completed with the app.
Screencap by HowStuffWorks staff

At the end of the day, if you want to run indoors and get accurate data, you're going to have to put in a little work. First, make sure your app supports calibration inputs. Not all of them do. Once you've found one that supports this feature, here's one way to test and refine your app's calibration to maximize accuracy:

Find a place to run where you are 100 percent certain of its distance.

Advertisement

If you have a regulation track nearby, this will work just fine. If you don't, try running outdoors with a GPS tracker to map out an easy-to-identify distance, like 1 mile or 1 kilometer, and make a note of the exact starting and stopping points.

Set your app for an indoor run. Whether you're running indoors or out, this is important, because it's the setting that tells your phone to use the accelerometer instead of GPS tracking.

Go for a run! There are several critical elements to this. Make sure you start and stop in the exact spots needed for your distance measurement. If you train with run/walk intervals, use your current running-to-walking ratio for this run. Also, the longer your distance on the calibration run, the better your reading will be. More data makes for a better calculation.

Input your distance data at the end of the run. Your app will divide this number by the number of steps your accelerometer recorded to estimate your average stride length. This is why it's so important to include your current interval timing in your calibration run. If you only run for the sample data, you won't be factoring your stride change when you walk.

Test it out. Go for another run on your distance-specific course with your app set to indoor tracking mode. See if it calculates the correct distance. If you find it's a little off, you might try going through all the steps above at a longer distance to give your app a better data sample for calibration.

If your running routine changes, or if your weight increases or drops by more than a few pounds, you'll want to run through this calibration plan again. When you lose weight, you naturally get a little faster, and if you decide to do more running and less walking on an interval plan, it's going to affect your stride averages as well.

While any app that tracks distance indoors is making a calculated estimate based on either the data you enter or an established average, testing your calibration for accuracy is key if keeping track of your distance indoors is a priority for you. The key word here is "estimate" -- it's unlikely that you'll get 100 percent accuracy from the standard formula of steps multiplied by average stride length, but you can absolutely track your progress over time as you run longer distances and speed up your pace.

Advertisement

Lots More Information

Author's Note: How Does My Device's Accelerometer Know How Far I Ran on the Treadmill?

Because I both run and love tech, I have sampled quite a few running apps -- at least a dozen. I can attest that none of them are entirely accurate in tracking indoor distances, but using the calibration options some of them offer really helps. Even so, if I really, truly, absolutely feel like I need to accurately gauge my pace, I take it outside.

Related HowStuffWorks Articles

More Great Links

  • Barański, P., M. Bujacz, and P. Strumiłło. "Dead reckoning navigation - supplementing pedestrian GPS with an accelerometer-based pedometer and an electronic compass." 2009 (April 3, 2012) 144.206.159.178/ft/CONF/16438832/16438874.pdf
  • Cho, Dae-Ki, et al. "AutoGait: A Mobile Platform that Accurately Estimates the Distance Walked." UCLA, Alcatel-Lucent Bell Labs. (April 3, 2012) http://mslab.kaist.ac.kr/wikipages/files/autogait.pdf
  • Hillrunner. "Treadmill Pace Conversions." (April 3, 2012) http://www.hillrunner.com/training/tmillchart.php
  • Texas Instruments. "Accelerometers and How They Work." (April 3, 2012) http://www2.usfirst.org/2005comp/Manuals/Acceler1.pdf

Advertisement

Loading...