I'm working on a project that involves a flat plane that a user can tilt from side to side and forward and back. I'd like a sensor that can give me the angle difference between the plane's position when the device is powered on and its current orientation.
Do I want a tilt sensor, an accelerometer or a gyro?
A two axis accelerometer alone should be sufficient if the platform is not being excessively moved around and has a "top" side (will not be flipped over). The accelerometer should be positioned as closely to the center of the tilt as possible so the action of moving the platform doesn't cause excessive noise. It will work like an electric plumb bob and just like a real plumb bob you can't be swinging it around wildly.
If the platform is being moved about wildly then you should use a accelerometer and gyroscope combo, and read up on Kalman filtering or look into projects like MultiWii. It's not a simple problem combining accelerometer and gyro readings to keep track of orientation.
I am not sure if your use of the wording "when the device is switched on" is important.
Using an accelerometer device in this sort of context, what you are really doing with it, is measuring
the direction of gravity, which you can assume is "down". Doing this depends on an assumption that
the device is not also being accelerated here and there all over the place. If you put this device inside
a football and started throwing it about, your arduino would have logical difficulties to distinguish
between the accelerations of the throwing and kicking, and the acceleration of gravity.
It is easy to calculate the angle of a device, relative to down, right now. Once you introduce
the complication of "when the device is switched on", you introduce some timing difficulties with
determining that intial position, the order in which the different integrated circuits get powered on,
the time for the first "stable" calculation to be completed, and so on.
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 (translation as opposed to rotation). Can an accelerometer distinguish between lateral movement and tilting? If it simplifies things, the user could have to press a Start button that would set the reference position - instead of trying to determine exactly when the device turns on.
if it is direct lateral movement, the gyro is not going to help. You'd have to look at
how this "object" is suspended or supported, and devise some scheme to keep track
of the position of that suspension or support.
A MEMS accelerometer measures acceleration, or what appears to be acceleration, by
measuring the deflection of an elastically supported mass. It is impossible to distinguish
the difference between the effect of gravity on that mass, and the inertial effect of the
whole device being accelerated somewhere.
Without knowing more details of the OP's intended application, I'd suggest he get an accelerometer
( about $7, on ebay ), build himself a model of what he wants to do, and tests it.
michinyon:
if it is direct lateral movement, the gyro is not going to help. You'd have to look at
how this "object" is suspended or supported, and devise some scheme to keep track
of the position of that suspension or support.
I think he meant that his platform was not intended to be shifted around laterally but rather just tilted.
Right - the user is only supposed to tilt the platform, but they may end up unintentionally moving it laterally. I only care about tilt, though, and I'd like to ignore any other kind of movement.