I'm developing a small Windows Phone application in C#. This app is recording acceleration data, GPS-location and compass data.
Here my code for fetching acceleration data:
void accelerometer_ReadingChanged(object sender, AccelerometerReadingEventArgs e)
{
Deployment.Current.Dispatcher.BeginInvoke(() => MyReadingChanged(e));
}
void MyReadingChanged(AccelerometerReadingEventArgs e)
{
if (accelerometer != null)
{
xdata = e.X.ToString("0.000");
ydata = e.Y.ToString("0.000");
zdata = e.Z.ToString("0.000");
}
}
After that another code will save the data to MySQL-Database...
My app is taking 8 values per second. So I want to calculate the amplitude (height) in centimeters [cm] using the data. Normally the formula for calculating the amplitude using acceleration data is:
s = 0,5 * a * t^2 (+ s0)
s: distance in meters - t: time in seconds - a: acceleration im m/s^2
I tried to calculate the amplitude with it, but it doesn't work. There were only wrong values.
So my question:
Which unit or which format has the given output from accelerometer? Is it really meters/second^2 [m/s^2] ? If it isn't, I'd be delighted if you'll send me the right unit, at most the complete formula / way how to calculate. The saved data is completely correct, so I think my formula has some mistakes... I'm using Nokia Lumia 1520.
I hope you'll understand my problem, because of my english-skills. ;)
Thank you in advance!