# Using an accelerometer for position

I have some accelerometers hanging from strings. I would like to be able to compute the position of the string from the accelerometer reading.

What I think I need to do is:

1. Compute a transform from the accelerometer at rest in order to normalize my sensor. I will have gravity so I should be able to know where the z-axis is.
2. Move the string in a known direction to set x and y.
4. Subtract out the effect of gravity.
5. Integrate to get a position.

Is the integration necessary for position? I know that one side is fixed. I should be able to use the magnitude of gravity to determine where the string is if the string is held at a position with some trigonometry, right?

I realize that this a solved problem, but I'm not sure what it falls into. There are some transforms between coordinate systems, robotics, and also probably some physics.

• so one string goes from the accelerometer to the ceiling. by held at a position I mean that the string pulled so that it is still taught. Oct 31, 2019 at 5:18
• Please explain position: who's position? The sensor itself? The upper end of the string keeping the sensor? The cart holding the entire setup? Relative to what? To the horizontal string / bar? To the cart? To the walls? Please remember that acceleration is not directly linked to position, it must go through speed. How will you handle all the errors? Note that some errors might be small in absolute values, but their effects will add-up as the time passes, to become prohibitively big. What is the required precision of the end calculation? Oct 31, 2019 at 7:09
• I am curious: what technique do you have in mind to calculate position from acceleration, without integration? I cannot think of one. What kind of transform do you have in mind when saying compute a transform? Do you need the position in orthogonal coordinates, or in polar coordinates? Again, relative to what? :) Oct 31, 2019 at 7:11
• I am not able to fully understand what do you want to measure. With accelerometer you can measure acceleration (as the name implies). So with it you can measure relative position from somewhere to somewhere else. But if your sensor is still in starting position, you get a measurement and the you move it to another position, keep it still and then take another measurement, I can't imagine a way to calculate this movement. Oct 31, 2019 at 12:17
• @virolino I'm wondering if there is a linear relationship between the amount of gravity in each component and position. For a static system. Any motion will of course need some integration to get position. Nov 1, 2019 at 2:09