GY-15 IMU angles

Hello everyone. I'm using the IMU GY-25 sensor, which has an internal Kalman filter with serial communication of Arduino mega2560. As is shown in the picture I attached the IMU (in red) on a link (in black) that is rotating around one of its sides. The problem is when I read the roll, pitch, and yaw angles and recalibrate the sensor by uploading the Arduino code, the values that I get are different (the sensor is still in the previous configuration) and are not zero or the previous values. What is the reference frame of the sensor for calibration? The second problem is when I rotate the link, the sensor will rotate around the roll angle, but other angles will vary too, and it's like 30 degrees, and I cannot understand why? Because I just rotate the sensor around one of its axes. I attached my Arduino code and the sensor datasheet.

float Roll,Pitch,Yaw;
unsigned char Re_buf[8],counter=0;
void setup()
{
Serial.begin(115200);
Serial3.begin(115200);// SoftwareSerial can only support 9600 baud rate for GY 25 but Serial3 can support 115200 and 9600 both
delay(4000);     
Serial3.write(0XA5);
Serial3.write(0X54);//correction mode
delay(4000);
Serial3.write(0XA5);
Serial3.write(0X51);//0X51:query mode, return directly to the angle value, to be sent each read, 0X52:Automatic mode,send a direct return angle, only initialization

}

void loop() {
serialEvent();
Serial.print("roll= ");
Serial.print(Roll);
Serial.print(" pitch= ");                 
Serial.print(Pitch);
Serial.print(" yaw= ");                 
Serial.print(Yaw);
}

void serialEvent() {
Serial3.write(0XA5);
Serial3.write(0X51);//send it for each read
while (Serial3.available()) {   
Re_buf[counter]=(unsigned char)Serial3.read();
if(counter==0&&Re_buf[0]!=0xAA) return;       
counter++;       
if(counter==8)               
{   
  counter=0;                 
  if(Re_buf[0]==0xAA && Re_buf[7]==0x55)  // data package is correct     
    {         
     Yaw=(int16_t)(Re_buf[1]<<8|Re_buf[2])/100.00;   
     Pitch=(int16_t)(Re_buf[3]<<8|Re_buf[4])/100.00;
     Roll=(int16_t)(Re_buf[5]<<8|Re_buf[6])/100.00;
    }     
} 
}
}

gy-25.jpg

GY25_MANUAL_EN.pdf (126 KB)

The GY-25 module uses the MPU-6050 chip. Yaw values are relative and won't be stable, as that module has no magnetometer or other external yaw reference.

jremington:
The GY-25 module uses the MPU-6050 chip. Yaw values are relative and won't be stable, as that module has no magnetometer or other external yaw reference.

Thank you for your reply. What about the reference frame for the other angles like roll and pitch?

Roll and pitch are defined by the Earth's gravity, as tilt away from the horizontal. Only an accelerometer is required to measure those angles. See How_to_Use_a_Three-Axis_Accelerometer_for_Tilt_Sensing-DFRobot