Jump to content
I2Cdevlib Forums

Acceleration and Gyro registers reversed?


Recommended Posts

Hi,

I'm new to the MPU6050 but getting some good results using 8051 micro interfaced to GY-521 breakout board to MPU6050.

One puzzling thing is that while the Invensense register map for the MPU6050 states:

REGISTERS 59 TO 64 – ACCELEROMETER MEASUREMENTS
REGISTERS 67 TO 72 – GYROSCOPE MEASUREMENTS

After a 200 mSec delay I measure the offsets, save them and subtract the offsets from the X,Y, and Z values of the acceleration and gyro angles.  The results show values near zero after subtracting the offsets.  So far, so good.

But...I get the Gyro and Acceleration reversed.  When I rotate the GY-521 90 degrees and then keep the board stable at the 90 degree position, the Acceleration values stay at a high value but the Gyro angle goes back to zero.  When I rotate the board back to the resting position both the acceleration and gyro values got back to near zero.  The gyro values only change when the board is actually being moved and go back to zero when the board is stationary, irregardless of the position/angle of the board. 

Here is the code:

while(1)
{
    ReadBytesIIC(59,14);        //Read 14 register bytes starting at MPU6050 register 59.
                    //Array[0]=register 59, Array[1]=register 60, etc.
    
    AccX=256*(int)Array[0]+(int)Array[1]+AccXOffset;
    AccY=256*(int)Array[2]+(int)Array[3]+AccYOffset;
    AccZ=256*(int)Array[4]+(int)Array[5]+AccZOffset;

    GyroX=256*(int)Array[8]+(int)Array[9]+GyroXOffset;
    GyroY=256*(int)Array[10]+(int)Array[11]+GyroYOffset;
    GyroZ=256*(int)Array[12]+(int)Array[13]+GyroZOffset;

    printf("\nAX,Y,Z, GX,Y,Z=%5d %5d %5d %5d %5d %5d",AccX,AccY,AccZ,GyroX,GyroY,GyroZ);
    DlyMs(50);
}

Can anyone explain to me why this might be happening?

Thank you in advance.

Bert

 

 

Link to comment
Share on other sites

Duh....  Figured it out.  The software is right but my interpretation of the results was wrong.   The acceleration measurement is displaying large numbers when I rotate the board because of gravity!  This had me pulling my hair out for a day.

Regards,

Bert

 

Link to comment
Share on other sites

  • 6 months later...
  • 2 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...