i have a question for a project that bugs me for some time now, because i dont know which sensor to use.
If i want to measure the angle a camera is flipped to the front (lets call it x-axis so the lens is looking to the ground) and to the side (lets call it y-axis so the camera would make a portrait instead of a landscape photo) which kind of sensor would i have to use?
Do i have to use a accelerometer oder do i have to use a gyro?
Just a note on using a gyro. All of the solid state gyros, MEMS gyros, that are readily available be they one, two, or three axis measure the angular rate, i.e. velocity, of rotation about each axis. You will see the the gyro's range listed as degrees/sec, e.g. 100 degrees/sec. This is the maximum angular rate the gyro can report. It is output as an analog voltage, there are some digital output MEMS gyros available. The analog voltage ouput is generally a range from 0 to a few hundred millivolts. For most gyros the "at rest," i.e. no movement, voltage is a positive voltage in the middle of the output voltage range. A clockwise rotation of the gyro on a given axis will generate a positive voltage, which will be reflected as a voltage higher than the at rest voltage and a counter clockwise rotation of the gyro will generate a negative voltage which will be reflected as a voltage lower than the at rest voltage. Through A/D conversion and application of the proper scaling factors the output voltage of the gyro is converted to the angular rate of the gyro.
The important thing to note here is that the gyro is not reporting the angle it has rotated through. It is reporting the angular rate of the rotation it has undergone. To obtain the actual angle the gyro has passed through requires integration of the the angular rate over the elapsed time of the rotation - a nontrivial exercise.
This weekend I will be adding a two axis MEMS gyro to a Netduino based project and will be posting the results of calibrating it, measuring angluar velocity and hopefully an algorithm for integrating over time to get the angle of rotation.