Electronic – How to detect angular movements and disregard lateral movements

accelerometergyroimusensor

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.

Best Answer

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).