Skip to content

Glitches on Gyro data #105

@mmcgraw74

Description

@mmcgraw74

I ran your i2c example, but I added Serial print statements for Arduino Serial Plotter labels, adding offsets so the traces don't overlap.

if (imu.Read()) {

        Serial.print("Max:250,");    
        Serial.print("NewIMU:");    
        Serial.print(imu.new_imu_data()*150);
        Serial.print(",");
        
        Serial.print("NewMAG:");    
        Serial.print(imu.new_mag_data()*100);
        Serial.print(",");

        Serial.print("AccX:");    
        Serial.print(imu.accel_x_mps2());
        Serial.print(",");
        
        Serial.print("AccY:");    
        Serial.print(imu.accel_y_mps2()-20);
        Serial.print(",");
        
        Serial.print("AccZ:");    
        Serial.print(imu.accel_z_mps2()-40);
        Serial.print(",");
        
        Serial.print("GyrX:");    
        Serial.print(imu.gyro_x_radps()-20);
        Serial.print(",");
        
        Serial.print("GyrY:");    
        Serial.print(imu.gyro_y_radps()-40);
        Serial.print(",");
        
        Serial.print("GyrZ:");    
        Serial.print(imu.gyro_z_radps()-60);
        Serial.print(",");
        
        Serial.print("MagX:");    
        Serial.print(imu.mag_x_ut());
        Serial.print(",");
        
        Serial.print("MagY:");    
        Serial.print(imu.mag_y_ut()-20);
        Serial.print(",");
        
        Serial.print("MagZ:");    
        Serial.print(imu.mag_z_ut());
        Serial.println("Min:-250");    
                    
        //Serial.print(imu.die_temp_c());
        //Serial.print("\n");

when I run this example with my ESP32 Dev Board and MPU9250 board, I use Arduino Serial Plotter and get the following plot:

Gyro glitches

Searching the web - I found this post about gyro glitches:
https://forums.adafruit.com/viewtopic.php?f=19&p=531590

I wonder if the issue is similar - the code is getting interrupted between individual MPU register reads, and should read whole blocks of MPU i2c registers to prevent this kind of issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions