Apple HealthKit, how u work?
January 27, 2015 4:37 PM   Subscribe

I've become obsessed with the Health app on my iPhone. I get that it probably uses GPS to calculate how far I'm walking/running in a day. But how does it know with crazy precision, how many flights of stairs I've gone up? What else can I get it to do, and how can I get the most out of this app?

Except for one weird, errant day that calculated me going up 25 flights of stairs, the app is frighteningly accurate every single day. I'm obsessed. It matches distance pretty precisely with my RunKeeper app, using GPS. It knows when I've taken the stairs in my highrise, as opposed to the elevator (so it doesn't use some kind of vertical measurement). It knows I've gone up a flight of stairs in a store. It knows when I've gone up 1 flights of stairs to the class studios at the gym, as opposed to 2 flights to the equipment. But it doesn't count the few (3-5) short stair/steps I might run up in the park, as opposed to a ramp.

How does it know?! How does it work?! How else can I get more/the most out of this app??
posted by raztaj to Health & Fitness (5 answers total) 17 users marked this as a favorite
Response by poster: Also, how does it automatically differentiate when I'm driving, on public transportation, flying, backing out slowly from the tarmac, vs. walking through the airport (with my phone rolling on a carryon - no pendulum swing). I need to know how this witchcraftery works.
posted by raztaj at 4:57 PM on January 27, 2015

Best answer: It has a barometric altimeter to detect gains and losses in altitudes. It can combine this with data from the accelerometers to determine when you're climbing a flight of stairs and how far you've climbed. The accelerometers can also count steps; there's some algorithm involved in processing the accelerometer data that determines what motion is a step and what motion is not. The details of this algorithm aren't likely to be public.

I doubt it uses GPS data. The GPS chip is power-hungry, so you don't want to keep it on all of the time, and it doesn't work indoors.
posted by mr_roboto at 5:06 PM on January 27, 2015

Jog in place back and forth while in an elevator (hopefully alone) to see if it counts that as flights of stairs!
posted by WasabiFlux at 6:22 PM on January 27, 2015

Best answer: there's some algorithm involved in processing the accelerometer data that determines what motion is a step and what motion is not

There's actually a whole second processor that has the job of counting steps and watching movement and telling the main phone processor what you've been doing.
posted by JoeZydeco at 6:39 PM on January 27, 2015 [3 favorites]

I think it probably does use the GPS a lot - google has a page you can go to that shows you where you've been and it shows *every* place I've been. Maybe it only checks in 1x/minute but that's good enough for distance when walking/running.
posted by RustyBrooks at 5:12 AM on January 28, 2015 [1 favorite]

« Older Thoughts become things...sometimes.   |   Please take my whisky! Newer »
This thread is closed to new comments.