user78244: I'm currently using the MPU-6050 accelerometer to receive the acceleration and angular velocity data. I'm trying to process the data for my experiment but I can't understand the exact meaning of it. I have threee questions about the situation. I append the arduino code below.
First, I happen to know that the AcX value of the code below means how much the sensor is inclined along the x axis. Is there other way to get acceleration directly? or Do I have to use formula(v = v_0 + a*t)?
Second, for the gyro sensor, I can't understand the meaning of the value. Does it sends the angular velocity or angular acceleration and if it is one of these, what's the limit?
Third, according to code, it receives data in the form of 2^14(14bit) but sometimes it sends value way over the limit. How can I translate raw data to rather regular unit like degree and rad?
Thank you
const int MPU_addr=0x68;  // I2C address of the MPU-6050
int16_t AcX,AcY,AcZ,GyX,GyY,GyZ;

void setup(){
  Wire.begin();
  Wire.beginTransmission(MPU_addr);
  Wire.write(0x6B);  // PWR_MGMT_1 register
  Wire.write(0);     // set to zero (wakes up the MPU-6050)
  Wire.endTransmission(true);
  Serial.begin(9600);
  Serial.println("CLEARDATA");
  Serial.println("LABEL,TIME,AcX,AcY,AcZ,GyX,GyY,GyZ");
}

void loop(){
  Wire.beginTransmission(MPU_addr);
  Wire.write(0x3B);  // starting with register 0x3B (ACCEL_XOUT_H)
  Wire.endTransmission(false);
  Wire.requestFrom(MPU_addr,14,true);  // request a total of 14 registers
  
  // deviding the 16bit input??
  AcX=Wire.read()<<8|Wire.read();  // 0x3B (ACCEL_XOUT_H) & 0x3C (ACCEL_XOUT_L)    
  AcY=Wire.read()<<8|Wire.read();  // 0x3D (ACCEL_YOUT_H) & 0x3E (ACCEL_YOUT_L)
  AcZ=Wire.read()<<8|Wire.read();  // 0x3F (ACCEL_ZOUT_H) & 0x40 (ACCEL_ZOUT_L)
  GyX=Wire.read()<<8|Wire.read();  // 0x43 (GYRO_XOUT_H) & 0x44 (GYRO_XOUT_L)
  GyY=Wire.read()<<8|Wire.read();  // 0x45 (GYRO_YOUT_H) & 0x46 (GYRO_YOUT_L)
  GyZ=Wire.read()<<8|Wire.read();  // 0x47 (GYRO_ZOUT_H) & 0x48 (GYRO_ZOUT_L)

  //Serial.print("AcX = "); 
  Serial.print(AcX);
  Serial.println(",");
  //Serial.print(",");
  //Serial.print(" | AcY = "); 
  //Serial.print(AcY); Serial.print(",");
  //Serial.print(" | AcZ = ");
  //Serial.print(AcZ); Serial.print(",");
  //Serial.print(" | GyX = "); 
  //Serial.println(GyX); 
  //Serial.print(" | GyY = "); 
  Serial.println(GyY); //Serial.print(",");
  //Serial.print(" | GyZ = "); 
  //Serial.println(GyZ);
  delay(200);
}


user20245: 
Is there other way to get acceleration directly? or Do I have to use
formula(v = v_0 + a*t)?

The code appears to be currently retrieving the raw X, Y & Z acceleration and storing it in AcX, AcY & AcZ.  The equation "v = v_0 + a*t" appears to be deriving velocity.  So the question is confusing.

...for the gyro sensor, I can't understand the meaning of the value. Does
it sends the angular velocity or angular acceleration

The accelerometer sensors measure acceleration.  As the last question ultimately asked for angles, the gyroscope is not needed.  However, on page 12 in the MPU-6050 specifications the dimensions of the gyroscope is given in degrees per second or angular velocity.  Likely the mechanism within the chip depends on the Coriolis effect

...and if it is one of these, what's the limit?

On the same page the MPU-6050 chip specification shows a table containing values such as GYROSCOPE SENSITIVITY & Full-Scale Range.  Consider reading these and other values regarding the gyroscope.

...according to code, it receives data in the form of 2^14(14bit) but
sometimes it sends value way over the limit.

The code retrieves a high 8 bit and low 8 bit value for each axis of the accelerometer and the gyroscope.  This makes a 16 bit value.  Not a 14 bit value.

How can I translate raw data to rather regular unit like degree and
rad?


To obtain an angle in degrees only the accelerometer is required.
Consider calibrating the accelerator for offset and magnitude errors before using the raw values.
Consider constraining the problem such that the accelerometer is only rotated around the Z-axis.
The angle can be found by taking the inverse tangent of the ratio of the calibrated X acceleration and calibrated Y acceleration.

Other considerations:

If angles are desired in 3 dimensional space consider using commonly referred to values such as pitch, roll & yaw.  In which case many situate the accelerometer such to use these equations:


The above equations, a discussion and some example code can be found here.

So far, all the equations discussed use trigonometry and can go to infinity (unusable results) given certain inputs.  The mathematical equivalent of gimbal lock if you will.  To avoid this consider using quaternions.  This mathematical method of representing rotation in 3 dimensional space does not suffer the above problem, is easier for computers to calculate and is used extensively in computer graphics.


78244: <p>I'm currently using the MPU-6050 accelerometer to receive the acceleration and angular velocity data. I'm trying to process the data for my experiment but I can't understand the exact meaning of it. I have threee questions about the situation. I append the arduino code below.</p>
<p>First, I happen to know that the AcX value of the code below means how much the sensor is inclined along the x axis. Is there other way to get acceleration directly? or Do I have to use formula(v = v_0 + a*t)?</p>
<p>Second, for the gyro sensor, I can't understand the meaning of the value. Does it sends the angular velocity or angular acceleration and if it is one of these, what's the limit?</p>
<p>Third, according to code, it receives data in the form of 2^14(14bit) but sometimes it sends value way over the limit. How can I translate raw data to rather regular unit like degree and rad?</p>
<p>Thank you</p>
<pre><code>const int MPU_addr=0x68;  // I2C address of the MPU-6050
int16_t AcX,AcY,AcZ,GyX,GyY,GyZ;

void setup(){
  Wire.begin();
  Wire.beginTransmission(MPU_addr);
  Wire.write(0x6B);  // PWR_MGMT_1 register
  Wire.write(0);     // set to zero (wakes up the MPU-6050)
  Wire.endTransmission(true);
  Serial.begin(9600);
  Serial.println(&quot;CLEARDATA&quot;);
  Serial.println(&quot;LABEL,TIME,AcX,AcY,AcZ,GyX,GyY,GyZ&quot;);
}

void loop(){
  Wire.beginTransmission(MPU_addr);
  Wire.write(0x3B);  // starting with register 0x3B (ACCEL_XOUT_H)
  Wire.endTransmission(false);
  Wire.requestFrom(MPU_addr,14,true);  // request a total of 14 registers
  
  // deviding the 16bit input??
  AcX=Wire.read()&lt;&lt;8|Wire.read();  // 0x3B (ACCEL_XOUT_H) &amp; 0x3C (ACCEL_XOUT_L)    
  AcY=Wire.read()&lt;&lt;8|Wire.read();  // 0x3D (ACCEL_YOUT_H) &amp; 0x3E (ACCEL_YOUT_L)
  AcZ=Wire.read()&lt;&lt;8|Wire.read();  // 0x3F (ACCEL_ZOUT_H) &amp; 0x40 (ACCEL_ZOUT_L)
  GyX=Wire.read()&lt;&lt;8|Wire.read();  // 0x43 (GYRO_XOUT_H) &amp; 0x44 (GYRO_XOUT_L)
  GyY=Wire.read()&lt;&lt;8|Wire.read();  // 0x45 (GYRO_YOUT_H) &amp; 0x46 (GYRO_YOUT_L)
  GyZ=Wire.read()&lt;&lt;8|Wire.read();  // 0x47 (GYRO_ZOUT_H) &amp; 0x48 (GYRO_ZOUT_L)

  //Serial.print(&quot;AcX = &quot;); 
  Serial.print(AcX);
  Serial.println(&quot;,&quot;);
  //Serial.print(&quot;,&quot;);
  //Serial.print(&quot; | AcY = &quot;); 
  //Serial.print(AcY); Serial.print(&quot;,&quot;);
  //Serial.print(&quot; | AcZ = &quot;);
  //Serial.print(AcZ); Serial.print(&quot;,&quot;);
  //Serial.print(&quot; | GyX = &quot;); 
  //Serial.println(GyX); 
  //Serial.print(&quot; | GyY = &quot;); 
  Serial.println(GyY); //Serial.print(&quot;,&quot;);
  //Serial.print(&quot; | GyZ = &quot;); 
  //Serial.println(GyZ);
  delay(200);
}
</code></pre>
 20245: <blockquote>
<p>Is there other way to get acceleration directly? or Do I have to use
formula(v = v_0 + a*t)?</p>
</blockquote>
<p>The code appears to be currently retrieving the raw X, Y &amp; Z acceleration and storing it in AcX, AcY &amp; AcZ.  The equation &quot;v = v_0 + a*t&quot; appears to be <a href="https://en.wikipedia.org/wiki/Equations_of_motion#Constant_translational_acceleration_in_a_straight_line" rel="nofollow noreferrer">deriving velocity</a>.  So the question is confusing.</p>
<blockquote>
<p>...for the gyro sensor, I can't understand the meaning of the value. Does
it sends the angular velocity or angular acceleration</p>
</blockquote>
<p>The accelerometer sensors measure acceleration.  As the last question ultimately asked for angles, the gyroscope is not needed.  However, on page 12 in the <a href="https://invensense.tdk.com/wp-content/uploads/2015/02/MPU-6000-Datasheet1.pdf" rel="nofollow noreferrer">MPU-6050 specifications</a> the dimensions of the gyroscope is given in degrees per second or angular velocity.  Likely the mechanism within the chip depends on the <a href="https://en.wikipedia.org/wiki/Coriolis_force" rel="nofollow noreferrer">Coriolis effect</a></p>
<blockquote>
<p>...and if it is one of these, what's the limit?</p>
</blockquote>
<p>On the same page <a href="https://invensense.tdk.com/wp-content/uploads/2015/02/MPU-6000-Datasheet1.pdf" rel="nofollow noreferrer">the MPU-6050 chip specification</a> shows a table containing values such as GYROSCOPE SENSITIVITY &amp; Full-Scale Range.  Consider reading these and other values regarding the gyroscope.</p>
<blockquote>
<p>...according to code, it receives data in the form of 2^14(14bit) but
sometimes it sends value way over the limit.</p>
</blockquote>
<p>The code retrieves a high 8 bit and low 8 bit value for each axis of the accelerometer and the gyroscope.  This makes a 16 bit value.  Not a 14 bit value.</p>
<blockquote>
<p>How can I translate raw data to rather regular unit like degree and
rad?</p>
</blockquote>
<ol>
<li>To obtain an angle in degrees only the accelerometer is required.</li>
<li>Consider calibrating the accelerator for offset and magnitude errors before using the raw values.</li>
<li>Consider constraining the problem such that the accelerometer is only rotated around the Z-axis.</li>
<li>The angle can be found by taking the inverse tangent of the ratio of the calibrated X acceleration and calibrated Y acceleration.</li>
</ol>
<p>Other considerations:</p>
<ul>
<li>If angles are desired in 3 dimensional space consider using commonly referred to values such as pitch, roll &amp; yaw.  In which case many situate the accelerometer such to use these equations:</li>
</ul>
<p><a href="https://i.stack.imgur.com/7j1zY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7j1zY.png" alt="enter image description here" /></a></p>
<p>The above equations, a discussion and some example code can be found <a href="https://wiki.dfrobot.com/How_to_Use_a_Three-Axis_Accelerometer_for_Tilt_Sensing" rel="nofollow noreferrer">here</a>.</p>
<ul>
<li>So far, all the equations discussed use trigonometry and can go to infinity (unusable results) given certain inputs.  The mathematical equivalent of <a href="https://en.wikipedia.org/wiki/Gimbal_lock" rel="nofollow noreferrer">gimbal lock</a> if you will.  To avoid this consider using <a href="https://en.wikipedia.org/wiki/Quaternion" rel="nofollow noreferrer">quaternions</a>.  This mathematical method of representing rotation in 3 dimensional space does not suffer the above problem, is easier for computers to calculate and is used extensively in computer graphics.</li>
</ul>
