C/++/# Need help with accelerometer data processing

Tags:
1. May 16, 2016

Shyam Krishnan

Hi,
am working on a vehicle tracking device, i am using LIS3Dh accelerometer to get the acceleration data.
i am using TM4c1231e6pz controller. I need to implement a harsh breaking alert, I am having difficulty in finding out which direction the vehicle is moving since the axis are not aligned with the vehicle. it can be fixed in any direction in the vehicle. I checked online I found methods to find the total acceleration only. can anyone tell me how to find the orientation of the vehicle and the direction in which its moving irrespective of how the device is fixed on the vehicle. I don't have a gyro sensor .

am desperate....

2. May 16, 2016

Staff: Mentor

Total acceleration could work, assuming harsh breaking leads to larger accelerations than driving in a curve or accelerating forwards. Otherwise you'll need some calibration, assuming the orientation in the car is unknown but fixed. First get the direction of gravity - that is easy. Then you are just left with two dimensions. Traffic lights should work for that: the car has acceleration in some fixed direction (it stops), then absolutely no acceleration for some time, then acceleration in the opposite direction (it starts moving again). That pattern should be unique to traffic lights (and maybe stop and go traffic), and it gives you access to the forward/backward direction. Using multiple traffic light stops can improve the accuracy.

3. May 16, 2016

Shyam Krishnan

what you suggested could work, my doubt is ,suppose the device is fixed in such a way that when the vehicle moves forward it is at angle 45 degree with the x and y axis, then both x and y axis would have components of acceleration ,so from both x axis and y axis data how can I calculate the acceleration ?

4. May 16, 2016

Staff: Mentor

With a coordinate transformation.

5. May 16, 2016

Shyam Krishnan

I know, Its possible when we know the angle, but in my case when I give my product to a client , I have no idea how they are going to fix it (they might fix it upside down sidewise or just leave it hanging from the connector etc..) so the angle is also unknown... that's my real issue

6. May 16, 2016

Staff: Mentor

That's the point of the traffic light stops to calibrate it (=figure out how it is oriented in the car).

If it is hanging freely, or changing its orientation frequently, forget it.

7. May 16, 2016

Shyam Krishnan

ok. Anyway thanks a lot. some of your ideas are really good , I will work on it. and try to calibrate it using the traffic light idea

8. Aug 16, 2016

CmRock314

I have a couple thoughts. I process accelerometer data [almost] daily so I'm quite familiar with working with them. Be sure to look up whether your accelerometer excludes the effects of gravity (many do).

1.) First thing I would do is integrate the acceleration time history (look up trapezoidal numerical integration) to get the velocity components. Then, do this again to get displacement. (One word of caution, you may need to high pass filter the data before each integration at approximately 5 Hz to remove the DC component which can make the Vel. TH and Disp. TH incorrect). The vehicle is going to displace the most in the direction it is traveling and the total velocity will be the greatest in the direction of travel as well. I would plot all of the velocity time histories together and the displacement time histories together. Since it's not oriented with the vehicle axis, it will be at minimum a combination of the 2 directions (or possibly all 3) to figure out the orientation. If you do the entire time segment, you should see where braking begins, acceleration starts, etc. If you see that 2 velocities and/or displacements are near the same and are the highest, then those 2 are in the direction of travel 45° from the axis of travel and the other direction is orthogonal.

2.) Additionally, road vibration is mostly Gaussian random vibration (although some sources have shown vehicle random vibration is actually more random than random vibration...i.e. higher Kurtosis value). So consider that you will have random vibration, vehicle acceleration (and deceleration and centripetal motion), and shocks (and also noise) possibly all in one single time segment measurement. This is not just some object accelerating in a straight line in a vacuum with no outside influence. These can all be converted to power spectra, but it may not be as beneficial... but things such as velocity Power Spectral Density (PSD) and displacement PSD can be computed--something else to consider calculating. So in other words, don't be surprised if the results don't come out to exactly what you anticipate. Filtering of the data may be required to get what you want.