Comments: MPU-9250 Hookup Guide


Comments 18 comments

  • Hey guys, I noticed that the repo/library you link to for manual install is incompatible with the example sketch code you can copy and paste from the hookup guide. At the very least at some point some variable names changed like in MPU9250.h SelfTest turns into selfTest. It seems like the example sketch files in the repository itself were updated with those changes, but the example code on the hookup guide page was not. The result for me is that the library wouldn’t compile out-of-the-box when manually installing the library from master branch but copying and pasting the example code from the hookup guide. Not a huge deal, but definitely snagged me and wasted some time.

  • The Fritzing diagram showing the “setup”, a Pro Mini connected to the sensor, is an abomination and an excellent example of why Fritzing should not be used.

    The diagram does not label the I2C connections on the Pro Mini, and fails to make it clear to beginners how to connect SDA and SCL to any other MCU board.

    I am really sorry to see that Sparkfun has abandoned clear communications in favor of idiot diagrams.

  • Hi!! I’m using this MPU with a Feather M0 SAMD21, with the DMP Library ( I have a problem when I used MPU 6050 Library it had the Lineal Accel Option but in MPU9250 DMP LIB I can’t find this option. I need this device to obtain the linear accel in order to calculate relative position in a rectangular coordinate systema (X,Y and Z ). ¿Is possible to obtain the linear accel with this device using DMP without gravity? ¿Someone has some experience doing this?

  • I cant get accurate yaw data. Please help.

  • Hi All,

    We are trying to get MPU9250 breakout board work with an Arduino mega. We tried many libraries online (including the one here), our AD0 pin is grounded (so I2C address is 0x68), we connected SDA and SCL to the corresponding SDA,SCL on mega board. VDD and VDDIO are connected together (by default), which we connected to 3.3V on mega. To be specific, connections we have are:

    (Breakout) ….. (Arduino Mega) SDA……..SDA SCL……..SCL Vdd (=vddio by default)….3.3V Gnd……Gnd

    We are getting communication error:

    MPU9250 I AM 0xFF I should be 0x71 Could not connect to MPU9250: 0xFF Communication failed, abort!

    We are not using any LCD, in fact we are only interested in the accelerometer output. Could somebody please help on this?

  • Oh additionally, when I flip my board, I only get nonsense. What could be a possible reason for this? The IMU is located next to the microcontroller. Could this affect the magnetometers?

  • Hey,

    when visualizing the data, I realized that I get good, but shaky results. Is there a way to change the frequency? Or do you have other suggestions in order to make it “less shaky”?

  • Meechy / last year / 1

    I can’t get the breakout board to talk to the Arduino MKR1000. The example sketch uploads fine but nothing appears on the serial monitor on my laptop.

    • M-Short / last year / 2

      I’m not familiar with the Arduino MKR1000 but verify that your code is printing to the correct serial bus. Most Arduinos use “serial”, but some use “serial1” or some other variation for the USB connection. If you are still having problems try contacting (and include screenshots if possible) and hopefully they can help you out.

      • Meechy / last year / 1

        Turns out the example code sets the interrupt pin: intPin = 12; unfortunately pin 12 on the MKR1000 is the SCL of the I2C bus which has a pull up resistor. I changed that line to intPin = 1; and now it works fine. I think it was just getting interrupted straight away and staying like that. Thanks for the reply :)

  • I cannot get it to verify or upload. I am getting a bunch of errors that MPU9250 has no member named ‘readByte’, ‘sum’, ‘sumCount’, ‘count’, etc. I am not sure where to go from here. Plz help.

    • a little bit late maybe, but for everyone having the same problem: try downloading a newer version of the Arduino IDE, in my case I had a problem with an old compiler version that comes with the IDE itself leading to exact the same error messages. hope that helps, good luck to everyone. :)

    • Sounds like the library may not be installed correctly. Try going through the library install process again and if you are still having problems email and they should be able to help you. If possibly include a screenshot of the error and where your library is installed.

  • Any ideas on a “‘class MPU9250’ has no member named ‘magCalibration’” error when uploading?

  • ——————– Tech Support Tips/Troubleshooting/Common Issues ——————–

    BBB Example

    There are examples online using the MPU-9250 with the beagle bone. Try looking at this GitHub respository [ and this forum post ] for more information. It doesn’t look like they used our breakout but it should function the same since they are using the same MPU-9250 IC. Additionally, you might want to check the BBB forums [ ].

  • Great product, good price. Here’s some feedback on the example sketch (MPU9250basicAHRS) that comes with the library:

    There are several mentions of interrupts in the sketch but this is a bit misleading - the interrupt pin is not used at all ! Just remove all mentions and the intPin - it makes no difference.

    After a few fiddles I managed to get it to compile and it appears to be working OK, but the sketch will not compile when I ‘#define LCD’ unless I comment out the reporting of the three accelBias[ ] values. Not sure what the bug is yet …

    Lastly when I ‘#define LCD’ the sketch compile fails for UNO as it’s way too big. This is largely due to the copious use of lengthy text strings which consume the RAM. I worked up a version with text strings shortened and relocated to PROGMEM using Serial.print(F(“string”)); and it just fits in the Uno (26500 program, 750 bytes free). It was a lot of fiddly editing but I would happy to share it if anyone wants a copy (and there’s a way to share?)

    • It’s not “accelBias” but “myIMU.accelBias”, I guess they forgot it.

      For those who don’t know, to use the LCD you just have to add #define LCD right at the start of the program. Still some issues but it works ! Thanks

      • Yes adding myIMU. fixes the accelBias issue, but are you sure the sketch is working for you? In my case pitch and roll are working properly, but yaw is not right. (I’ve been looking into this for days now). I’m wondering if the MPU8250basicAHRS example actually does compensate for the different axes orientation of the magnetometer. There’s a comment that mentions it, but I cannot see it is actually coded.

        What’s more confusing is their are two different libraries linked from the Sparkfun site and one doesn’t even include MPU9250basicAHRS. Anyway using the correct library (based on Kris Winer’s work) I now have this working on Uno (except for Yaw) and at a rate of 230Hz!

        If anyone wants a copy of my sketch PM me (ninja2) on arduino form.

        EDIT: looks like my Yaw issue is solved after calibrated the AK8963 magnetometer, see

If you've found a bug or have other constructive feedback for our tutorial authors, please send us your feedback!