6
\$\begingroup\$

I'm working on a project that involves a flat platform that a user can tilt from side to side and forward and back. I'd like a sensor that can monitor the angle difference between the platform's original position on and its current orientation.

Do I want a tilt sensor, an accelerometer, a gyro or IMU?

To provide a little more background, this is supposed to be a game that the user will play by holding the plane with both hands and tilting it in the two axes. I wouldn't expect it to move around a lot, but the user might move the platform if they start walking around (translation as opposed to rotation). Can any of the above devices distinguish between lateral movement and tilting? I only care about rotation and would like to ignore any incidental translation.

\$\endgroup\$
  • \$\begingroup\$ To answer your question we need to know the entity of lateral accelerations, and how precise should the thing be. If lateral acceleration is small compared to gravitational acceleration, then a 3 axis accelerometer is enough, while if you think the user might be more... Strong, or if you would like to upgrade your interface one day, you will need a 3 axis giroscope too. \$\endgroup\$ – Vladimir Cravero Jan 22 '13 at 8:37
  • \$\begingroup\$ @Vladimir -- Could you explain your reasoning for tracking 6 degrees of freedom (3 linear, 3 rotary) to isolate only 2 axes of motion? If all that happens is "tilting it in two axes", then 4 of your sensor channels will contain no information or redundant information. What does "upgrade your interface" mean? Apologies for my misunderstanding... \$\endgroup\$ – DrFriedParts Jan 22 '13 at 9:19
  • \$\begingroup\$ the point is that what happens is moving the thing in all the 6dof, what he wants to know is another story. and traking everything might help to be more precise in what he wants to know. with upgrading I mean for example one day he decides to track translation movements too. \$\endgroup\$ – Vladimir Cravero Jan 22 '13 at 18:54
7
\$\begingroup\$

You can low-pass filter an accelerometer signal. The gravity vector is at DC. Using a 2-axis accelerometer like the Analog Devices ADXL202 should be sufficient for a plane.

Here's an excellent article on all the math.

what happens if the user suddendly moves the plate forward?

You are confusing the concept of translation (change in position) with attitude (orientation). If the plate moves suddenly forward (pure translation) then you, ideally, want to see no change in the output (the attitude didn't change).

If the user suddenly tilts the plate forwards then after an infinite time period the DC value will also correctly and exclusively reflect this change.

An accelerometer measures acceleration. Acceleration is caused by force. Gravity is a force. Gravity is based on mass relationships, separation distance, and the angle between the vectors. Since neither the plate's mass or the Earth's mass is changing, the separation distance is (for all intents and purposes unchanging), for a specific angle (tilt) gravity is a constant force. Things that are constant have 0 frequency (e.g. "DC").

Any given tilt angle will correspond to one (and only one) force vector on the plate through 180 deg.

enter image description here

The problem in a practical system is that you can't wait an infinite amount of time to notice that the attitude has changed. So you must, like everything in engineering, compromise between the requirements. That is why I suggested the approach of a low-pass filter. Where you corner the filter will determine the trade-off between selectivity and accuracy (in the short term).

In practical systems you can corner somewhere around 10Hz and usually do ok (most cell phones take this approach).

link you provide assumes a three axis accelerometer

The third axis is only absolutely required if you need to detect yaw (via gyro) or disambiguate attitude through both hemispheres (via accelerometer), which the original question seems to explicitly discount as undesired motion. If that assumption on my part is in error, the OP can use a 3-axis accelerometer or 2-axis + 1 axis gyro as desired. That is why I said "should be sufficient."

I'd go with a gyro...

If you are trying to minimize cost/power, then using a gyroscope by itself is a poor choice with respect to the accelerometer as proposed. In the tilt sensing application you described, the gyro develops a tilt error that continues to increase without bound as it measures only rotational accelerations, which you must integrate to find the position (tilt).

When you tilt the gyro you'll see a change in the output voltage, but it quickly returns to it's resting level if the new attitude (tilt) is held. This leads to two undesirable problems:

  1. It becomes extremely sensitive to jostling (shaking and other transient disturbances)
  2. Error accumulates very quickly and must therefore be "reset" to some known value every so often by correlating it with some other data source (such as the accelerometer as proposed).

Here is data from an experiment conducted by David Anderson on his self-balancing robot:

enter image description here

Note how the error (difference between the blue line and red line) quickly runs away from the ground-truth.

In contrast, the accelerometer measures tilt directly so error does not accumulate. In the gyro, each estimate of tilt is a function of all prior measurements (error accumulates). In the accelerometer, each estimate of tilt is based on only the current reading (to the first order).

\$\endgroup\$
  • 1
    \$\begingroup\$ excuse me, but what you are saying is not right. ignoring one component of the g vector as you suggest will lead to completely unreliable data. hint: what happens if the user suddendly moves the plate forward? And the link you provide assumes a three axis accelerometer. \$\endgroup\$ – Vladimir Cravero Jan 22 '13 at 8:33
  • \$\begingroup\$ @Vladimir -- That isn't technically correct. Omitting one axis doesn't omit one component of the g vector. Each axis of the accelerometer measures pitch, roll, yaw** (**not really, actually it provides full spherical disambiguation), respectively. There is no unique attitude information in the third axis (unless you need to support the plate being turned over), so including it doesn't add any information. I've expanded my answer to try to explain. Thank you for the feedback. \$\endgroup\$ – DrFriedParts Jan 22 '13 at 9:46
  • 1
    \$\begingroup\$ You are right about the axis component thing. Let's say I was speaking of a coordinates system solidal with g vector. The point is that if the table is accelerated in parallel to the earth taking account of gz might help eliminate that. I'm reading your answer right now! \$\endgroup\$ – Vladimir Cravero Jan 22 '13 at 18:43
  • 1
    \$\begingroup\$ Ok, I've read it and it is very good. But the point is that if you accelerate the table the measured vector acceleration vector will not point to ground anymore. "true" (or more precise) attitude can be achieved with both an accelerometer and a gyro, the latter being used only when the first gives very fast transients. \$\endgroup\$ – Vladimir Cravero Jan 22 '13 at 18:48
  • 1
    \$\begingroup\$ I correct you once again: the accelerometer is the ONLY possible approach ;) I just thought your answer needed to be expanded, and you did it perfectly. Thank YOU! \$\endgroup\$ – Vladimir Cravero Jan 23 '13 at 15:54
3
\$\begingroup\$

Right tool for the right job. If the nature of your particular beast is such that low-pass filtering would do the job, the accelerometer might be right. If you're trying to track the dynamics, though, that sensor would need to be at the center of rotation, or you'll need to worry about what to do with centripetal accelerations.

If you need angular velocity, though, and not angular position, I'd go with a gyro. If you need angular position, you need to worry about how you will deal with accumulated errors of integration, which (by definition) will add up over time. Maybe use a low-pass filtered accelerometer to remove accumulated errors?

\$\endgroup\$
  • 1
    \$\begingroup\$ This is pretty much how balancing robots like segway tend to work. See nBot. \$\endgroup\$ – Phil Frost Jan 22 '13 at 18:13
  • \$\begingroup\$ People also have a built in 3d accelerometer and a 3d gyro, and still can't resolve perfectly. Plenty of arguments about how we don't fall down all the time, but I'm in the "low-freq->reorientation, High-freq->translation" school. \$\endgroup\$ – Scott Seidman Jan 22 '13 at 22:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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