I am trying to do a self-balancing bot as a school project, but I got stuck with the MPU6050.

I tried using the code by Jeff Rowberg (MPU_6050_raw) but it's reading only zeros.

I tried the MPU_6050_DMP and got stuck at "initializing DMP..." and no reading is shown.

I tried other code, but same thing happens, either reading zeros or getting stuck at "initializing DMP..".

And how can I make sure that the chip isn't broken?


1 Answer 1


The MPU-6050 is a 3.3V chip. When you are using a 5V Arduino board, you should take care that you don't put current into the SDA and SCL pins of the MPU-6050.

Start with a i2c scanner.
This one: Arduino Playground I2C scanner
Or this one: Nick Gammon I2C scanner
If the I2C scanner halts, then there is a hardware problem with the I2C bus. It might be a shortcut of SDA or SCL to GND, or the MPU-6050 module is not powered.

If the I2C scanner is working, then you know the address (0x68 or 0x69). With that address you can try the Short example sketch to read data from the chip.

If that is working, then you can try the Jeff Rowberg library.

  • Thanks for replying. the i2c scanner worked well here is what i got. I2C scanner. Scanning ... Found address: 104 (0x68) Done. Found 1 device(s). but i still get zeros when i try the short examples. AcX = 0 | AcY = 0 | AcZ = 0 | Tmp = 36.53 | GyX = 0 | GyY = 0 | GyZ = 0 AcX = 0 | AcY = 0 | AcZ = 0 | Tmp = 36.53 | GyX = 0 | GyY = 0 | GyZ = 0 AcX = 0 | AcY = 0 | AcZ = 0 | Tmp = 36.53 | GyX = 0 | GyY = 0 | GyZ = 0 sorry i forgot to mention tham iam using arduino uno board
    – Zohary
    Commented Apr 28, 2017 at 11:50
  • The temperature is not zero. It seems as if the accelerometer and gyro are not turned on. There are a number of possibilities: a broken sensor, or a bad I2C bus, or wrong voltages, or it is not the MPU-6050. Could you try the long example sketch playground.arduino.cc/Main/MPU-6050#sketch , that sketch checks for bus errors. Could you check with a magnifier if it is really a MPU-6050 ? It is a 3.3V sensor and the Arduino Uno is a 5V board. The MPU-6050 might be broken because of the wrong voltages. My suggestion is to buy a new MPU-6050 (or the newer MPU-9250) and a I2C level shifter.
    – Jot
    Commented Apr 28, 2017 at 14:15
  • thank you for being patient with me. here is what i got form the code MPU-6ًInvenSense MPU-6050 June 2012 WHO_AM_I : 68, error = 0 PWR_MGMT_1 : 0, error = 0 MPU-6050 Read accel, temp and gyro, error = 0 accel x,y,z: 0, 0, 0 temperature: 36.506 degrees Celsius gyro x,y,z : 0, 0, 0, i use the 3.3 volt pin in the arduino i dont know what you mean that the uno is 5v board. and i consider buying the mpu 9250 .and iam sorry to ask another question. if you know how to test it at the shop and what to do to prevent it from getting burned like the last one. thanks again for your patience
    – Zohary
    Commented Apr 28, 2017 at 19:45
  • error = 0 means there is no error, but the accelerator and gyro values are still zero. That is weird, and I have not heard of it before. Let's assume it is broken. The Arduino Uno has a ATmega328P microcontroller running at 5V. The MPU-6050 should have 3.3V to power it and also 3.3V signals at the I2C bus (SDA and SCL). You don't have to test it at the shop, it should be fine. It is safer and better to use a I2C level shifter to connect the Arduino Uno to a 3.3V sensor, or else use 4k7 pullup resistors to 3.3V: playground.arduino.cc/Main/I2CBi-directionalLevelShifter
    – Jot
    Commented Apr 29, 2017 at 11:51

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