10
\$\begingroup\$

I recently purchased this MPU6050 GY-521 breakout board. I tried it with my Arduino Mega using this Arduino sketch provided by official arduino.cc.
(MPU-6050 Datasheet, InvenSence (producer) Page)

Man, it gives this weird output!!!

InvenSense MPU-6050
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: 1944, 368, 15608
temperature: 30.576 degrees Celsius
gyro x,y,z : -34, -204, -247, 

MPU-6050
Read accel, temp and gyro, error = 0
accel x,y,z: 1952, 364, 15304
temperature: 30.435 degrees Celsius
gyro x,y,z : -38, -216, -274, 

MPU-6050
Read accel, temp and gyro, error = 0
accel x,y,z: 1864, 388, 15356
temperature: 30.482 degrees Celsius
gyro x,y,z : -34, -233, -278, 

MPU-6050
Read accel, temp and gyro, error = 0
accel x,y,z: 1888, 324, 15260
temperature: 30.576 degrees Celsius
gyro x,y,z : -14, -220, -261, 

MPU-6050
Read accel, temp and gyro, error = 0
accel x,y,z: 1904, 392, 15316
temperature: 30.624 degrees Celsius
gyro x,y,z : -34, -241, -238, 

MPU-6050
Read accel, temp and gyro, error = 0
accel x,y,z: 1856, 308, 15604
temperature: 30.435 degrees Celsius
gyro x,y,z : -33, -252, -235, 

MPU-6050
Read accel, temp and gyro, error = 0
accel x,y,z: 1892, 444, 15528
temperature: 30.624 degrees Celsius
gyro x,y,z : 20, -236, -251, 

MPU-6050
Read accel, temp and gyro, error = 0
accel x,y,z: 1924, 356, 15520
temperature: 30.576 degrees Celsius
gyro x,y,z : -19, -224, -251, 

MPU-6050
Read accel, temp and gyro, error = 0
accel x,y,z: 1844, 280, 15732
temperature: 30.529 degrees Celsius
gyro x,y,z : -1, -240, -249, 

MPU-6050
Read accel, temp and gyro, error = 0
accel x,y,z: 2004, 372, 15396
temperature: 30.671 degrees Celsius
gyro x,y,z : -20, -252, -255, 

(This is only a part of it, it gives this king of output continuously). I know for sure, only the temperature reading is meaningful. But what are those values given for acceleration and gyro readings??

OK, It says those are raw values. If it is so, then how can I convert them into meaningful values. Hoping it can be helpful (as many suggested), I also like to know how to use so called Jeff Rowberg library.

Hope there will be someone experienced with MPU-6050 module. Just give me a point to start. I have no clue on how to use the module... :(

Any help is greatly appreciated. Thanks !

\$\endgroup\$
2

2 Answers 2

6
\$\begingroup\$

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.

\$\endgroup\$
6
  • \$\begingroup\$ Thanks! All your assumptions are correct. Then are you suggesting me to multiply above raw output by 1g/16384 (when using 2g scale) to get the real acceleration reading (for all thee axes)? Then, how to deal with gyro readings? \$\endgroup\$
    – Anubis
    Commented Sep 7, 2012 at 10:53
  • \$\begingroup\$ And what is the meaning of LSB in the unit LSB/g? \$\endgroup\$
    – Anubis
    Commented Sep 7, 2012 at 10:58
  • \$\begingroup\$ The gyro seems to be very sensitive, so that holding it in your hands may give a rotation reading when your hands would shake a bit (too much coffee? :-)). LSB = Least Significant Bit, which I translated as "count". It indicates the minimum change. \$\endgroup\$
    – stevenvh
    Commented Sep 7, 2012 at 11:09
  • \$\begingroup\$ In general, "raw" readings from this type of device are going to include offset (bias) and scale-factor errors. Eventually, you're going to want to calibrate these errors out by subtracting the offset value and multiplying by a scale-factor adjustment value for each axis. \$\endgroup\$
    – Dave Tweed
    Commented Sep 7, 2012 at 11:43
  • \$\begingroup\$ The link to the datasheet has broken. Do you happen to know the new location of that document? \$\endgroup\$
    – Right leg
    Commented Jul 3, 2017 at 15:58
12
\$\begingroup\$

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. :)

\$\endgroup\$
2
  • 1
    \$\begingroup\$ I feel this answer provides a much better explanation compared to the accepted one. \$\endgroup\$
    – chutsu
    Commented Aug 4, 2015 at 7:02
  • \$\begingroup\$ @ajmal I understand the sensor values upto the point you described. I also understand that gyro by default has a slight drift. But I dont understand how to visualize the data in the real world positioning. I read a lot regarding euler angles, quarternions, but i dont understand the tradeoffs between the representations, and the math behind it. Any suggestion where to start. \$\endgroup\$ Commented Sep 4, 2016 at 16:22

Not the answer you're looking for? Browse other questions tagged or ask your own question.