MPU9250 I2C communication trouble

Hello, I am trying to connect MPU9250 to Arduino UNO board and read sensor data from it via I2C.


1.arduino board : UNO R3
2.sensor : MPU9250
3.IDE : 2.3.2

<What I did & Problem>
1.I soldered MPU9250 with header pins (I gonna call it MPU9250#1)
2.I connected it to the arduino using bread board (VCC-5V, GND-GND, SCL-A5, SDA-A4)
3. I run I2C detection example code

#include <Wire.h>

#define WIRE Wire

void setup() {
  WIRE.begin();
  Serial.begin(9600);
  while (!Serial)
     delay(10);
  Serial.println("\nI2C Scanner");
}

void loop() {
  byte error, address;
  int nDevices;

  Serial.println("Scanning...");

  nDevices = 0;
  for(address = 1; address < 127; address++ )
  {
    WIRE.beginTransmission(address);
    error = WIRE.endTransmission();

    if (error == 0)
    {
      Serial.print("I2C device found at address 0x");
      if (address < 16) Serial.print("0");
      Serial.print(address, HEX);
      Serial.println("  !");
      nDevices++;
    }
    else if (error == 4)
    {
      Serial.print("Unknown error at address 0x");
      if (address < 16) Serial.print("0");
      Serial.println(address, HEX);
    } else {
      Serial.print("No device found at 0x");
      if (address < 16) Serial.print("0");
      Serial.println(address, HEX);
    }
  }
  if (nDevices == 0) {
    Serial.println("No I2C devices found\n");
    resetI2CBus();
  } else {
    Serial.println("done\n");
  }

  delay(5000); // wait 5 seconds for next scan
}

void resetI2CBus() {
  Serial.println("Resetting I2C bus...");
  WIRE.end();
  delay(100);
  WIRE.begin();
}
  1. but It shows only "I2C scanner", "Scanning..." messages only.
  2. So I added println function to check what is the problem
#include <Wire.h>

#define WIRE Wire

void setup() {
  WIRE.begin();
  Serial.begin(9600);
  while (!Serial)
     delay(10);
  Serial.println("\nI2C Scanner");
}

void loop() {
  byte error, address;
  int nDevices;

  Serial.println("Scanning...");

  nDevices = 0;
  for(address = 1; address < 127; address++ )
  {
    WIRE.beginTransmission(address);
    Serial.println(address);
    error = WIRE.endTransmission();
    Serial.println("end Transmission");

    if (error == 0)
    {
      Serial.print("I2C device found at address 0x");
      if (address < 16) Serial.print("0");
      Serial.print(address, HEX);
      Serial.println("  !");
      nDevices++;
    }
    else if (error == 4)
    {
      Serial.print("Unknown error at address 0x");
      if (address < 16) Serial.print("0");
      Serial.println(address, HEX);
    } else {
      Serial.print("No device found at 0x");
      if (address < 16) Serial.print("0");
      Serial.println(address, HEX);
    }
  }
  if (nDevices == 0) {
    Serial.println("No I2C devices found\n");
    resetI2CBus();
  } else {
    Serial.println("done\n");
  }

  delay(5000); // wait 5 seconds for next scan
}

void resetI2CBus() {
  Serial.println("Resetting I2C bus...");
  WIRE.end();
  delay(100);
  WIRE.begin();
}

and now Serial monitor shows message like :
I2C Scanner

Scanning...

I2C Scanner

Scanning...

1(code seems not propagate from here)

which menas, the code seems fall in the loop when endTransmission() is called.
and when I pull the jumper cable out, the code start to propagate and show's there's no I2C device found. So I thought that my sensor was out of function for some reason. and actually, it was exposed to too high temperature for a very long time due to my mistake.

6.So I ordered a new sensor with same model. (MPU9250) and connected with same pin config and It succeed..! (Serial monitor says I2C device was found at 0x68, which is known address of MPU9250) and I was so happy

  1. but after repeating the code for several times, I end up with facing same problem that I stucked. It does not propagate when calling Wire.endTransmission()

8.So I suspected anoter source of trouble, like loose connection. this is the list of what I did to resolve the problem

  1. I remove the bread board and directly connect MPU9250 and arduino by jumper
  2. I tried another SCL SDL pin of arduino, not A5 and A4 but the guys next to "AREF" pin

after trying this and run same code, I was shown following message like

104

end Transmission

I2C device found at address 0x68 !

105

end Transmission

No device found at 0x69

106

which means my sensor is alive!!!
9.but another problem is happen, It takes too much time to check each address and it stucks somewhere when repeatedly running the code. and some times It doesn't find MPU9250

Conclusion
So I am thinking that sensor is alright, but My arduino board is the source of problem. So I purchased new one. but i am still not confident what is the problem..
I would like to really thank you if you suggest the cause of trouble and what should I try.

Please post some clear photos of your Arduino and the sensor and how they are connected together.

1 Like



This is how I wired the things
Brown : VCC
RED : GND
Orange : SCL
Yellow : SDA

AFAIK this sensor is only fit for a signal level of 3.3V.
I think on the sensor module you're using, SDA and SCL are pulled up to 3.3V. Your Arduino is a 5V board. I would expect it should still work since 3.3V is likely above the logic level HIGH of the microcontroller of the UNO. However, it would be preferable if you used a proper logic level converter between the UNO and the MPU9250 sensor module. This will also prevent accidents that destroy the sensor if inadvertently SCL or SDA is being pulled up to 5V for whatever reason.

Your connections so far look OK apart from the note above.
What does the soldering look like on the sensor board?

The sensor module does not have a level shifter for SDA and SCL, but it does have a voltage regulator. You have now powered it with 3.3V, but the voltage regulator might drop that to 2.3V for the sensor.
Connect VCC of the sensor module to 5V.

Adafruit sells sensor modules that actually do work.

1 Like


This is my soldering.. as I look it closer, I realized that my soldering skill sucks!!
But when I checked it by multimeter, there seems no problem, but resoldering is good idea. And I gonna try connect level shifter. Thansk for your reply.

Yeah, I'd recommend resoldering those headers. There are some really good YouTube videos on soldering, but you really do need flux- or rosin-core solder, some additional flux, a temperature controlled soldering iron and preferably some desoldering wick as well. Without the proper materials it's pretty much impossible to get it right.