I have an IMU sensor (MPU 6050) connected with arduino UNO. Pin maps are as follows:

MPU6050 --> Arduino
Vcc --> Vcc
Gnd --> Gnd
SCL --> A5
SDA --> A4

(Not using any pull up resistors)

I am using jeff rowberg's MPU6050 library to get data from sensor. To test the sensor, I am using the raw value example sketch from the library. I am getting readings for both the accelerometer and the gyroscopes.

The problem is after some time the serial monitor just stops printing data. I have tried to figure it out but have not succeeded in solving the problem. It could be due to one of two reasons:

  1. The MPU6050 stops giving sensor values
  2. There is a problem with the serial monitor

As far as I have figured, the sensor is giving values because when I restart the serial monitor, the data starts to print again on the serial monitor and stops printing after same duration of time as it did before restarting the monitor.

I have tried the serial monitor of the arduino IDE and hyperterminal. In both cases the data stops printing after some time.

Any idea, what causes the serial monitor to stop printing data? Is it the sensor or the serial monitor?

Help would be greatly appreciated. Thanks in advance.

  • 4
    Chances are it's I2C locking up whilst reading from the MPU6050. Re-opening the serial monitor resets the Arduino. Check your wires (I2C doesn't like long wires), and add 3.3KΩ pullups to the I2C wires (if not provided by the MPU6050 board). Internal Arduino pullups are not adequate for I2C.
    – Majenko
    Jan 12, 2017 at 11:25
  • 1
    Please post the sketch. It could also be a String/memory allocation problem. Jan 12, 2017 at 11:34
  • @Majenko It worked. I can't believe it but changing the wire length actually worked. I was using really long wires before, I shortened the length but it didn't worked so I shortened the length even more. This time the serial monitor didn't stop. I can't understand what cause the wire length has on the communication process though. Seems illogical. Thanks again for helping out. Jan 12, 2017 at 11:56
  • 2
    Au contraire - it's perfectly logical. Long wires = big antenna = picks up noise. Weak pullups = noise easy to interfere with communications. Combine the two and you have a recipe for disaster. Fix one or both and you get it working.
    – Majenko
    Jan 12, 2017 at 14:20
  • 1
    Note that even with good wiring, I2C code that lacks a "give up and try over" timeout is risky - if it waits eternally for a slave acknowledgement, one single misinterpreted bit will hang the system. Jan 13, 2017 at 3:38

1 Answer 1


I had exactly same situation.
I initially started to inspect on FIFO overflow of MPU6050, then experimented setting different clock speed for I2C communication, tried to tweak with pullup resistors as recommended. Finally, here is the solution which worked for me. Basically, I just disconnected INT pin from MPU6050.

Now the schema is:
(MPU) -> (Arduino)

AD0 -> GND
SDA -> A4 (No pullup)
SCL -> A5 (No pullup)
VCC -> 3.3V

I used this code as an example:

from this library:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.