mpu9250 not detected by RTIMULib2 but detected by I2C scanner

I tried to run the IMU calibration code at
https://github.com/richardstechnotes/RTIMULib-Arduino/tree/master/RTArduLinkIMU

The code compiles and is copied to the arduini but I get error on the serial monitor

RTArduLinkIMU starting using device MPU-9150
Failed to init IMU: -6
No valid compass calibration data

Identity: RTArduLink_Arduino
Port index 0 speed=5, hardware port number=0
⸮Ue⸮

I need to calibrate the IMU mpu9250 before I use it for the first time for which the RTArduLink code needs to run. How can I get the compass calibration data even before I calibrate it

I ran the IMUMagCal from the same git location and saved the results in the EEPROM. But I still get the same error Failed to init IMU: -6 when I try to run the RTIMULib-Arduino code.

To check whether the I2C device has been identified I used the I2C scanner code at Arduino Playground - I2cScanner

It returned
Scanning...
I2C device found at address 0x68 !
done

How do I get the IMU 9250 to be detected correctly by the RTIMULib-Arduino?

Also why is the IMU getting detected as 9150 when it is actually a 9250(I have checked the IC name using a lense)

I use the BolderFlight Systems Library for the MPU9250 and do not have those issues: GitHub - bolderflight/mpu9250: MPU-9250 sensor driver.

Should work with RTIMUlib. You just need to DEFINE the correct IMU for compilation. See this post (using one of Pololu's IMUs).

@Idaholwalker: thanks for your multiple replies on both of my posts. I will try the bolder code tomorrow.

@jremington: thanks for your reply. I tried polulus suggestion to change the IMU defs.

after editing RTIMULibdefs.h by commenting and uncommenting related parts

//#define MPU9150_68 // MPU9150 at address 0x68

#define MPU9250_68 // MPU9250 at address 0x68

Then I run the arduinomagcal code and then I run the RTArduLinkIMU.

The IMU number changes to 9250 but I get new erros

RTArduLinkIMU starting using device MPU-9250
Failed to init IMU: -6
Using compass calibration

Identity: RTArduLink_Arduino
Port index 0 speed=5, hardware port number=0
⸮Ue⸮

Do you know if your IMU is actually working properly?

There are some pretty simple programs around that initialize it and start reading out data.

I ran the i2c scanner which detected that there was a device on the bus at 0x68
Any suggestion of such program which could detect if the IMU is working fine?

Google "arduino mpu9250" for a large number of leads.

:slight_smile: :confused: :frowning:

The results of the libraries i tried:

=========================

04Probe MPU9250: MPU-Sensor missing

=========================


MPU9250 WHO AM I = 73
Could not connect to MPU9250: 0x0

=========================

my connection:
9250 breakout->arduino uno
Vdd ->3.3V
Gnd->Gnd
SDA->A4
SCL->A5