GY-85 Issue with YAW

Hello everyone,

after days I have no idea what to do with my IMU. I have bought GY-85 and connect it with my Arduino UNO board. Specifically I have connected 3.3V to 5V, GND to GND, SCL to A5 and SDA to A4. It seems that all the connections are correct. I have also downloaded the first two pages of google search and gone through almost all the tutorials. I would like to place it to my 4 wheel mobile robot to determine the YAW angle of rotation. I do not care about pitch and roll since it will not fly (hopefully). So, I have gone through some codes and it seems that pitch and roll works just fine. However, yaw is not responding. :confused: No idea why. Can anyone help me out? Am I turning the IMU somehow wrong? :confused:

I followed this: GitHub - sqrtmo/GY-85-arduino

#include "GY_85.h"
#include <Wire.h>

GY_85 GY85;     //create the object

void setup()
{
    Wire.begin();
    delay(10);
    Serial.begin(9600);
    delay(10);
    GY85.init();
    delay(10);
}


void loop()
{
    int ax = GY85.accelerometer_x( GY85.readFromAccelerometer() );
    int ay = GY85.accelerometer_y( GY85.readFromAccelerometer() );
    int az = GY85.accelerometer_z( GY85.readFromAccelerometer() );
    
    int cx = GY85.compass_x( GY85.readFromCompass() );
    int cy = GY85.compass_y( GY85.readFromCompass() );
    int cz = GY85.compass_z( GY85.readFromCompass() );

    float gx = GY85.gyro_x( GY85.readGyro() );
    float gy = GY85.gyro_y( GY85.readGyro() );
    float gz = GY85.gyro_z( GY85.readGyro() );
    float gt = GY85.temp  ( GY85.readGyro() );
    
    Serial.print  ( "accelerometer" );
    Serial.print  ( " x:" );
    Serial.print  ( ax );
    Serial.print  ( " y:" );
    Serial.print  ( ay );
    Serial.print  ( " z:" );
    Serial.print  ( az );
    
    Serial.print  ( "  compass" );
    Serial.print  ( " x:" );
    Serial.print  ( cx );
    Serial.print  ( " y:" );
    Serial.print  ( cy );
    Serial.print  (" z:");
    Serial.print  ( cz );
    
    Serial.print  ( "  gyro" );
    Serial.print  ( " x:" );
    Serial.print  ( gx );
    Serial.print  ( " y:" );
    Serial.print  ( gy );
    Serial.print  ( " z:" );
    Serial.print  ( gz );
    Serial.print  ( " gyro temp:" );
    Serial.println( gt );
    
    delay(500);             // only read every 0,5 seconds, 10ms for 100Hz, 20ms for 50Hz
}


In the first position my output is:
accelerometer x:-6 y:8 z:-136 compass x:-52 y:354 z:278 gyro x:0.00 y:0.00 z:0.00 gyro temp:23.61

and in the second position my output is:
accelerometer x:-8 y:8 z:-136 compass x:-217 y:-137 z:278 gyro x:0.00 y:0.00 z:0.00 gyro temp:23.59

PS: I have turned it 90 degrees in yaw axis.

Can anyone figure out what is happening?
thank you!

You need to calibrate the magnetometer -- they don't work "out of the box". Calibration overview.

I recommend the BNO055, which has a built in calibration.

Oh this is a terrible solution. I hope there was a magic click that does all that job. I will get here for my status when I complete this tutorial. If there is any other solution out there please share!

It is indeed very sad that there is no magic click to solve the many challenges posed by being alive.

Cheer up, magnetometer calibration builds character, knowledge and experience.