Code Monkey home page Code Monkey logo

Comments (8)

mmcgraw74 avatar mmcgraw74 commented on June 24, 2024

The glitches appear on different sensors at random intervals. I had tried filtering algorithms on the data but the glitches are large magnitude.

from invensense-imu.

mmcgraw74 avatar mmcgraw74 commented on June 24, 2024

The green spikes are the plot of the boolean imu.new_mag_data(), which looks correct - and is not the issue I'm describing.

The issue in the plotter output above is on the imu.mag_y_ut() output.

from invensense-imu.

mmcgraw74 avatar mmcgraw74 commented on June 24, 2024

Here is one more snapshot - I commented out the New Mag signal.
You can see a glitch on MagX followed later by a glitch on MagY.
Gyro glitches4

from invensense-imu.

mmcgraw74 avatar mmcgraw74 commented on June 24, 2024

Sorry, same plot as before.
Here is the other plot:
Gyro glitches3

from invensense-imu.

flybrianfly avatar flybrianfly commented on June 24, 2024

Can you post the full code that you are running and confirm that you are running the newest version of this library (i.e. v5.6.0)? We burst read the IMU, but we have had issues in the past with the ESP32 not working with the I2C repeated start. I don't have an ESP32 board to test, but will try to see if I can replicate the issues on the Teensy boards that I have. Is there any potential to try reading the sensor with SPI? That might help us determine if it's an issue with the I2C communication or something else.

from invensense-imu.

mmcgraw74 avatar mmcgraw74 commented on June 24, 2024

I'm running your MPU9250 i2c.ino example with only the print statements modified to add sensor labels and use sensor offsets to separate the traces for Arduino Serial Plotter:

`/*
Brian R Taylor
[email protected]

Copyright (c) 2021 Bolder Flight Systems Inc

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.

*/

#include "mpu9250.h"

/* Mpu9250 object */
bfs::Mpu9250 imu;

void setup() {
/* Serial to display data /
Serial.begin(115200);
while (!Serial) {}
/
Start the I2C bus /
Wire.begin();
Wire.setClock(400000);
/
I2C bus, 0x68 address /
imu.Config(&Wire, bfs::Mpu9250::I2C_ADDR_PRIM);
/
Initialize and configure IMU /
if (!imu.Begin()) {
Serial.println("Error initializing communication with IMU");
while (1) {}
}
/
Set the sample rate divider */
if (!imu.ConfigSrd(19)) {
Serial.println("Error configured SRD");
while (1) {}
}
}

void loop() {
/* Check if data read */
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()+40);
        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()-40);
        Serial.println("Min:-250");    
                    
        //Serial.print(imu.die_temp_c());
        //Serial.print("\n");
    
}

}
`

I will look into connecting to the MPU9250 with SPI instead of i2c and retrying with the SPI example.

from invensense-imu.

mmcgraw74 avatar mmcgraw74 commented on June 24, 2024

I confirm I'm running Blolder Flight Systems MPU9250 v 5.6.0 Arduino library.

from invensense-imu.

mmcgraw74 avatar mmcgraw74 commented on June 24, 2024

I rewired my board to use ESP32 VSPI with the MPU-9250 board instead of i2c.

I ran your SPI example and didn't see any glitches (left running for 45 minutes. Here is the serial plot:

Bolderflight_MPU9250_spi_example_plot

I also tried the fifo_SPI example and it looks like LOTS of spikes:

Bolderflight_MPU9250_fifo_spi_example_plot

from invensense-imu.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.