Uneven sampling and false zero-motion values of the accelerometer readings (better read to understand)

matteo diana's picture

Firstly, I don't know why I wanted to start working with smartphone sensors. The real fact is that in principle I thought that woking with IMUs and smartphones would have been roughly the same thing, well it seems not.

The problem I am facing is related to the movement I am trying to observe/measure. Imagine you hold your smartphone in one hand horizontally and meanwhile you are walking with the Y-axis of the body (smartphone) reference system pointing in the same direction of motion, you swing that smartphone producing like a number of 8 movements around the Y-axis (so around the pitch), for about 10 seconds in total.

PROBLEM: The data log shows strange jumps not only in the time stamp (as expected due to the smartphone platform/OS), but also in the readings of the accelerometer which as it is clearly shown in the image here attached, produces new steady values between different swings. I cannot explain myself how the accelerometer could measure different values than the expected due to the uneven sampling of the smartphone sensors (since it seems to occur whenever there is a jump on the time stamp). The same holds for the magnetometer.

SOLUTION: ?

Gabor Paller's picture

Hi,
The easiest explanation is simply an error. I just came across a gyroscope sensor that seemed to work nicely but produced significant spikes when exposed to fast rotation. I had to change device as these spikes were impossible to filter out without sacrificing the measurement precision. The moral is that these smartphone sensors are not particularly exact, some are simply defective.
I have another "rational" explanation. What if the "jump" is really a change in acceleration? Suppose, you had a linear change in the sensor output. Now if you skip, say, 100 samples, the result is a "jump" as the linear change during those 100 samples would be missing.
What happens if you leave the phone on the table, stationary? Do you experience those jumps?

matteo diana's picture

Thanks for the answer and an error was the right one.

Now, what about this...

Currently I am testing both the EKF and the Complementary Filter performances to estimate the attitude with sensor fusion (gyro, acc, mag) in the quaternion form. The ultimate scope is to get different velocity estimates. At the moment I have a Nonlinear Complementary Filter that does a good job to estimate the attitude, then I subtract the gravity and integrate to get the velocity. It works fine on the short period.

What would it be the best bet if from smartphone sensors and sensor fusion algorithms I want to obtain the velocity in the end? Currently I am integrating the accelerometer readings after gravity compensation, but do you have other ideas based on your experience ? Navigation Equations? Or what else?

Gabor Paller's picture

To put it cautiously: I am not aware of anyone who managed to calculate velocity by integrating acceleration sensor data. Drift kills this measurement if you run the integration for more than a few seconds. 
There are solutions that work, however. You can infer the speed of the motion by matching motion patterns (walking or running, for example, have quite recognizable patterns) or you can use an additional speed sensor if you have the luxury (cars have it, for example, ymy upcoming Droidcon London presentation will be about that: 
http://uk.droidcon.com/2013/sessions/sensor-fusion-between-car-and-smartphone/
)