Monday 8 July 2013

Accelerometer application

For the last three to four weeks at CDOT I have been working with the native Android Accelerometer through Cordova. The goal is to have a pedometer that uses the phone's native Accelerometer that enables the user to walk and simultaneously have their steps counted. This has been very exciting for me. I have needed to do a lot of research that involves finding out "What exactly is a step?" This forced me to become aware of myself and those around me, making me think "How do we walk from point A to B" After a certain age we do this so easily (those who are able to). But rediscovering this in computer language was different. I am currently using the following formula to calculate the force exerted on the phone:

Step force = ((acceleration.x * acceleration.x) + (acceleration.y * acceleration.y) + (acceleration.z * acceleration.z)) / (9.78 * 9.78);

On average a force near to the value of 2 counts as a step.

At the moment the demo only outputs X,Y, and Z acceleration with time-stamp, steps according to the formula above, the force exerted on the phone, distance, intensity and stride length.  I have also tested the results with another pedometer.  Because intensity varies with each person, I later added a feature to the demo that allows the user to adjust their intensity.  The user may also change their stride length.  They may adjust their stride length and intensity at any moment in the workout.  This gives me the idea that maybe the intensity can self adjust.

In the future maybe I can make this application help the user manage their fitness goals. Currently the prototype is a pull request and only has a certain scope. Later on there will be testing, and other new features.  The pedometer will truly be a part of the NexJ Medical Device Plugin, and no more.  Project scope is very important.

The latest Cordova Accelerometer Specs can be found here: Cordova Accelerometer

To see the Cordova tests visit: Apache/Cordova-mobile-spec. A personal goal is to later implement the accelerometer test in QUnit for the pedometer integration.

This is slowly coming together. I am pleased with what I have so far, but am ready to make the extra effort.

See my pull request here: Pedometer Skeleton

No comments:

Post a Comment