How to read a gyro/accelerometer

A Gyroscope gives the values of Angular Velocity (degrees/sec) in the three respective axis (Yaw, Pitch and Roll axes respectively).

But whatever raw value given first by these sensors should be converted to sensible acceleration or angular velocity values by scaling.

InvenSense Data Sheet of MPU-6050 says that we have to use different scaling factors for different ranges of gyro values. I shall explain how to use these scaling factors in the end.

Angular Velocity Limit  |   Sensitivity
----------------------------------------
250º/s                  |    131
500º/s                  |    65.5 
1000º/s                 |    32.8 
2000º/s                 |    16.4

Similarly , for Accelerometer (which gives x,y,z axes acceleration including gravity) the unit used is g (\$ \large 9.81 \frac{m}{\text{s}^2} \$).

Scaling factors for accelerometer values :

Acceleration Limit  |   Sensitivity
----------------------------------------
2g                  |    16,384
4g                  |    8,192  
8g                  |    4,096 
16g                 |    2,048 

Converting the raw data :

\$ \Large \text{required_value} = \frac{\text{raw_value}}{\text{proper_sensitivity}} \$

For example , in the first data , you got

accel x,y,z: 1944, 368, 15608
gyro x,y,z : -34, -204, -247

Acceleration seems to be in the limit of 2g. So, scaling factor = 16384

implies \$ \Large ax=\frac{1944}{16384} g \$

Gyro seems to be in the limit of \$ \Large \frac{250º}{\text{s}} \$. So, scaling factor or sensitivity = 131

implies \$ \Large \text{gyro_value}=\frac{-34}{131} \frac{degrees}{sec} \$

Hope that helps. :)


The accelerometer's reading seem to make sense. The datasheet, page 13 indicates 4 different sensitivities:

2 g  
4 g  
8 g  
16 g  

with resp. sensitivity scale factors:

16 384 counts/g  
8 192 counts/g  
4 096 counts/g  
2 048 counts/g  

From the Z-reading I assume you have the 2 g scale selected, then 15 608 is 0.95 g, which is what you can expect from a Z-axis reading when you hold the sensor more or less horizontal. The X- and Y-reading are probably also due to gravitation when you're not holding the part perfectly horizontal. And you'll have an error in the reading too.



Similar for the gyro. At 131 counts per degree/s you may have this kind of reading if you're holding the part in your hands.