I have a cheap MPU 6050 chip that communicates over 3.3V I2C. I can talk to it just fine on my Leonardo. If I add an additional Adafruit Motor shield (the old one), my MPU 6050 demo sketch hangs somewhere, and I get nothing back.

As far as I see, the pins I use for the I2C communication are not used at all by the motor shield.

What could be wrong here?

I have the MPU6050 connected to SCL, SDA, GND and 3.3V, the motor shield uses almost all other pins.

Additional Info: I am using this sketch currently: https://github.com/jrowberg/i2cdevlib/tree/master/Arduino/MPU6050

Update: Lots of "Serial.println"s later, I've narrowed it down a bit. The example sketch above hangs on the statement "Wire.endTransmission();" on line 279 of the I2CDev library.

Update: Connecting the motor shield to external power seems to fix my problem. Weird =) I am still interested in the reason for this behavior.

  • Did you modify the code at all? Can you isolate the problem to a small section of the sketch and include that? Does the 'blink' sketch work? Thanks! Aug 16, 2014 at 16:57
  • With both the motor shield and the mpu 6050 connected, the blink sketch works fine. I can even talk via Serial.
    – Jens
    Aug 16, 2014 at 17:02
  • So, it is something with your code. Can you post the minimum code required to reproduce this issue? Aug 16, 2014 at 17:06
  • I'll try... this will take a while, since I don't understand one bit of what the MPU 6050 library linked above really does =)
    – Jens
    Aug 16, 2014 at 17:11
  • Wait... didn't see your edit. Which example are you using? Aug 16, 2014 at 17:32

1 Answer 1


Motors draw large amounts of current, and will either cause your power supply voltage to sag if you draw more current than your power supply can support, or cause blips in the power supply that will cause you all sorts of problems.

You need to take steps to isolate the power from the motor shield from the power for the Arduino.

How are you powering the motor shield? How are you powering the Arduino?

If your power supply has enough current to support both your Arduino and your motors then you can probably solve the problem by adding an isolation capacitor between the Vin port on your Arduino and ground.

What that does is to filter out temporary variations in the input voltage that's being fed to the Arduino. Without it, the Vin voltage to the Arduino is probably dropping as your motor draws large pulses of current, and that causes the output from the voltage regulator to droop as well.

I don't know how to pick the rating of the cap. A trip to the Electrical Engineering stack exchange is probably in order.

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.