Activity Monitoring Using Accelerometers in Smart Phones

I have been interested in developing sensors and algorithms for activity monitoring for a while. I believe we can leverage the accelerometers in the ubiquitous smart phones to detect activity levels of individuals and provide real time feedback on their energy balance. I got tired of writing proposals for it, and decided to whip up something in my spare time. Why? because I can; that’s why. The basic goal of this experiment was to detect 4 levels of activities from accelerometer readings, a) Sitting, b) Standing, c) Walking, and d) Running.

I used a nexus one from Google to collect 3D acceleration and orientation data from the comfort of my pant pockets. The phone sampled at about 60 Hz (shown below).

Since most human activities are low frequency, the raw data was conditioned through a 10th order butterworth filter with a cut-off frequency of 15 Hz to remove spurious artifacts.

The conditioned signal was used to extract features. I divided up the signals into 3 second time segments. For each segment, the mean, standard deviation, magnitude of variation, and peak frequency of FFT (frequency of activity) were extracted for the three axis accelerations, thereby giving us 12 features. By including orientation data, we can expand this to 24 features if needed. The feature set based on Z axis acceleration is shown below.

For training, I collected data while walking from the lab to my office. First I walked from the lab, took the elevator up 3 floors, ran down the corridor to my office, sat down for a while, and walked a bit in my office. Based on the features extracted in the previous step, activity class was determined based on elementary heuristics. The results are shown below.

Note that the algorithm can detect the few steps I took to enter the elevator, and more importantly as I sped up to a run and then slowed down to a stop. I could even pin point where I opened my office door 🙂

I ran the same algorithm without retraining the heuristics on the data I collected while walking to my internship at Illionix. Here are the results.

As you can see, I was running quite a bit late to work, and had to run/brisk walk. Why do people insist on starting work before noon? Anyways, I am not claiming that this algorithm works in every given condition or for everyone. More testing and tuning lies ahead. If you are interested in this work, I would be glad to talk to you. You can find my contact information here.

Leave a Comment