# Remove Gravity from Accelerometer values

by trustnoone
Tags: accelerometer, gravity, remove, values
 P: 14 Hay guys, so I have an accelerometer which is obtaining values in either G or m/s/s depending on how I program it. Testing it everything seems fine and I get 1 G on one of the axis depending on how I hold it which is great. The problem is I'm using an ADXL345 accelerometer which gives me values in X, Y and Z but I only want the acceleration values, unfortunately I am also getting acceleration values with gravity, so essentially I want to remove gravity. Note that I don't care so much about orientation, but I do want to know its magnitude I guess. Also its going to be placed in a ball which a person can pick up in any sort of way and wave it around (not throw it) so I won't know what the orientation is at all. So far the things I've heard in doing it is to derive the values then reintegrate it so that I remove the constant component (gravity) the other way i heard about it is through a filter pretty much stealing the same thing as they are doing in an android example except for arduino, but I don't know if thats really going to be that accurate, and I don't quite understand the example either. Any help would be great!!
 Mentor P: 15,167 You need to add gravity (vectorially), not subtract it. The reason an accelerometer at rest on your table measures 1g *upward* is because an accelerometer can't sense gravity. No local experiment can sense gravity, and your tiny little chip definitely qualifies as a "local experiment". So if an accelerometer can't measure gravity, why does it register a 1g acceleration? The answer is simple. Draw a free body diagram of the forces acting on the accelerometer. There are only two. The table pushes the accelerometer upward and gravity pulls the accelerometer downward. The net force is almost zero. Since the accelerometer can't sense acceleration due to gravity, all it can sense is that 1g upward force by the table.
P: 14
 Quote by D H You need to add gravity (vectorially), not subtract it. The reason an accelerometer at rest on your table measures 1g *upward* is because an accelerometer can't sense gravity. No local experiment can sense gravity, and your tiny little chip definitely qualifies as a "local experiment". So if an accelerometer can't measure gravity, why does it register a 1g acceleration? The answer is simple. Draw a free body diagram of the forces acting on the accelerometer. There are only two. The table pushes the accelerometer upward and gravity pulls the accelerometer downward. The net force is almost zero. Since the accelerometer can't sense acceleration due to gravity, all it can sense is that 1g upward force by the table.
Woah okay that sort of blows my mind a bit, but it does make sense, thanks heaps for clearing that up for me, although I think my accelerometer is feeling inadequate now since you called it tiny :P. Unfortunately I'm still at a loss though, like it makes sense to add gravity vectorially now but will I still be able to do that without knowing the orientation of my accelerometer. Along with the fact that my accelerometer may be accelerating as it does this?