I've tried this sketch provided by arduino.cc. (I've an MPU6050 GY-521 breakout board.)
I think it works fine. It gives a weird set of numbers I can't get any meaning out. It says that those are raw values.
How can I convert them into meaningful values?
The output is as follows. Even when the whole thing is kept stationary, it gives changing values! Is this meaningful? Then how is it to be understood?
(What I only know is that the temperature value is meaningful :D)
June 2012
WHO_AM_I : 68, error = 0
PWR_MGMT_2 : 0, error = 0
MPU-6050
Read accel, temp and gyro, error = 0
accel x,y,z: 260, 120, 15572
temperature: 31.047 degrees Celsius
gyro x,y,z : -24, -234, -240,
MPU-6050
Read accel, temp and gyro, error = 0
accel x,y,z: 304, 12, 15608
temperature: 31.000 degrees Celsius
gyro x,y,z : -7, -234, -232,
MPU-6050
Read accel, temp and gyro, error = 0
accel x,y,z: 160, 100, 15716
temperature: 31.000 degrees Celsius
gyro x,y,z : -8, -241, -248,
MPU-6050
Read accel, temp and gyro, error = 0
accel x,y,z: 192, 56, 15712
temperature: 31.000 degrees Celsius
gyro x,y,z : -36, -212, -222,
MPU-6050
Read accel, temp and gyro, error = 0
accel x,y,z: 212, 100, 15440
temperature: 30.906 degrees Celsius
gyro x,y,z : -32, -253, -240,
You need to look at the datasheet to translate the raw values to meaningful ones. Look for tables like this one for the gyroscope:
If you used the default values, FS_SEL
will be 0
. That's the sensitivity setting. So to translate your raw gyroscope values to degrees per second, you divide them by 131. You can see your numbers come out under 2 degrees per second or so, which is a reasonable margin of error.
For the default accelerometer sensitivity, you divide by 16,384
to get the value in g (the force exerted by the earth). You're getting on the order of 0.01g for the x and y axes and 0.95g for the z axis, which is within a reasonable margin of error for the chip staying still with the z-axis pointed toward the earth.