I'm working on a mobile app that uses the accelerometer to move a cursor. Although it's technically a computer science problem, once you get past how you get the values, it's more of a math problem, so I figured its more relevant to post here.
I can get the phone's acceleration (in the x, y, and z axis) every time the phone detects a change in acceleration. I can also figure out how long it's been since the last event (i.e. since the last time a phone noticed a change in acceleration). My goal is to create a displacement vector from this information.
I found this paper that suggests I use the following formula:
Xa = (Aa * Ta2)/4
Where Xa is the displacement during interval Ta and Aa is the acceleration during the period.
My prototype used this method and gathered the instantaneous acceleration and time intervals for a set sampling period, and then ran that formula on the data points and took the sum of those values to get total displacement. Unfortunately, the values I got during testing were inconsistent.
I assume that my math is the cause of my problem. What equation/approach should I use so I can turn the information I have (i.e. time between readings, and instantaneous accelerations) into a displacement vector (relative change in distance, direction) for each axis?