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.
  3. Read the sensor and apply the transform to factor out the steady-state reading.
  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.

diagram of accelerometer hanging

  • $\begingroup$ 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. $\endgroup$
    – fritz
    Oct 31, 2019 at 5:18
  • $\begingroup$ 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? $\endgroup$
    – virolino
    Oct 31, 2019 at 7:09
  • $\begingroup$ 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? :) $\endgroup$
    – virolino
    Oct 31, 2019 at 7:11
  • $\begingroup$ 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. $\endgroup$
    – nionios
    Oct 31, 2019 at 12:17
  • $\begingroup$ @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. $\endgroup$
    – fritz
    Nov 1, 2019 at 2:09

1 Answer 1


Is the integration necessary for position?

Typically yes, but if the accelerometer is colinear to the string (NOT as you have drawn it!), then you can find the gravity component in your accelerometer output and use that plus the assumption that the string is taught and find your position that way.

For example, if z points up and x points right, then if gravity is all on the negative z-axis then you know the sensor is oriented such that the z-axis is colinear with gravity, so your position is (0, -stringLength). If the z-axis reading is zero and the x-axis reading is negative gravity, then the position is (stringLength, 0).

The components of gravity on each axis will correspond with the angle of the accelerometer and, again, if your accelerometer is colinear with the string then you can determine the angle of the string and thus the position if you assume the string is taught.

The issue, as always with accelerometers, is that you will not get a yaw/heading fix, so you won't be able to tell where on the "cone" you are located, just the cone angle.

  • $\begingroup$ Good point. I did not draw it colinear because my paint skills are lacking. I did not want for it to have to be colinear because that is hard to maintain with a string. It would be easier with a rod. The cone angle and magnitude would be enough for me, actual position may be too much of a stretch for this setup. If I calibrate it at steady state and make sure the string doesn't twist I think I can estimate yaw. $\endgroup$
    – fritz
    Nov 1, 2019 at 2:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.