This small and cheap GY-521 module, connected to an Arduino Uno, It measures acceleration, gyro and magnetic field thanks to chip M6050. You can use to check the orientation of the Board as well as a cell phone can tell odo landscape or portrait. or picture.
It comes with the terminal sticks to you weld.
On the back there is no chip. These two small holes are used to attach the module in place where if you want to make the measure of angle X and Y (ROLL and PITCH).
To connect to the Arduino simply place the VCC of the GY-521 to 5V, the GND to GND of the Arduino and the SDA and SCL pins for A4 and A5 respectively.
Now you have to install the library FREEIMU, that can be downloaded by This link. You should give it a read in the documentation and instructions in the main site of the library. Basically, put all the files in the ZIP in the Libraries directory within the directory the program Arduino Libraries.
The surprise is in the two examples that comes with the library, and must be rotated in the calling program Processing. You send it to the Arduino example code of the library called FREEIMU_SERIAL and open the program FreeIMU_yaw_pitch_roll (or FreeIMU_cube) within this processing. Then simply change the following line of code to point to the SERIAL port, in my case it's the COM12, but will differ according to the computer.
The FreeIMU_yaw_pitch_roll program of the processing takes the data from the GY-521 (the MPU6050) received by the USB serial port (sent by the Arduino) and shows on the screen graphically. See below the values of the compass (magnetometer) and the PITCH and ROLL.
See now how is also interesting the other program FreeIMU_cube. I recorded to a video to show:
The module is cheap and one cannot expect much quality. Actually, angle values are not stable when the label's standing, making enough any serious project. I'm trying to see why this happens, but so far haven't found. Anyway, I leave the link to the GY-521, because it is very interesting:
http://www.dx.com/pt/p/gy-521-mpu6050-3-axis-acceleration-gyroscope-6dof-module-blue-154602