Jump to content
I2Cdevlib Forums
Sign in to follow this  
Bert

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

 

 

Share this post


Link to post
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

 

Share this post


Link to post
Share on other sites

Hi,

When I am putting my MPU-6050 at an angle, the gyro values only change while I am turning it, and return to zero when I stop turning. Can you explain why they don't stay at the angle?

Regards,
Jesse

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×