An easy way to classify accelerometer vibration

I developed an Android solution to identify if a vehicle is stopped with the engine turned off, or stopped with engine turned on or if it is moving.

Instead of working with all three axis separately I decided to calculate the magnitude of the vector using the formula:

magnitude = sqrt(x^2 + y^2 + z^2);

This way if the device is stopped in the right position (Z axis is aligned to gravity force) the magnitude will be “9,8…”. This is exactly the value of gravity force.

I retrieved 1000 samples with the device stopped on the floor and when plotting a histogram I noticed that the magnitude values are concentrated in discretes positions (9,82.. 9,86.. 9,78.. 9,85.. etc). Also I noticed these positions may vary slightly from device to device, but it always will concentrate in 4 or 5 positions.

Then I decided to add up all occurrences of each individual magnitude from these 1000 samples (it is like creating a vector that represents the histogram). Now I could to identify all 4 more frequent magnitudes.

If the device is in movement the magnitude values for these 1000 samples will be distributed almost equally, but yet at least 4 or 5 magnitudes will surpass all the others. If I add up these four more frequent magnitudes I could to classify the type of vibration.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s