SparkFun IMU Breakout - MPU-9250

The SparkFun MPU-9250 IMU Breakout features the latest 9-axis MEMS sensor from InvenSense. Each of these 9DoF breakouts feature an MPU-9250 with a System in Package (SiP) that combines two chips: the MPU-6500, which contains a 3-axis gyroscope as well as a 3-axis accelerometer, and the AK8963, which features a 3-axis magnetometer. This breakout has been designed to be smaller than some of our other offerings to fit in smaller projects. However, if you plan to use a breadboard, or secure the IMU board to a project with something like epoxy, the mounting holes can be easily snapped off.

To achieve its smaller size, the MPU-9250 Breakout features PTH pins that have been wrapped around the border of the PCB in three rows of three or four. The top row (J1) is all one needs to get the most functionality out of the IMU. These include the I2C and power interface. The second most likely to be used set of PTHs are found along the bottom (J3). This includes the address pin, the interrupt pin, and the IO voltage supply for easy interface with a more modern 1.8V processor. The third, a non-breadboard-compatible row (J2), is used for features like running other I2C devices as slaves to this one. For prototyping with these connections, throw your connections on top as you would with an Arduino Pro Mini or similar product.

The MPU-9250 replaces the popular EOL MPU-9150 and decreases power consumption by 44 percent. According to InvenSense, “Gyro noise performance is 3x better, and compass full-scale range is over 4x better than competitive offerings.” The MPU-9250 uses 16-bit Analog-to-Digital Converters (ADCs) for digitizing all nine axes, making it a very stable 9 Degrees of Freedom board.

  • Digital-output X-, Y-, and Z-axis angular rate sensors (gyroscopes) with a user-programmable full-scale range of ±250, ±500, ±1,000 and ±2,000°/sec and integrated 16-bit ADCs
  • Digital-output triple-axis accelerometer with a programmable full-scale range of ±2g, ±4g, ±8g and ±16g and integrated 16-bit ADCs
  • 3-axis silicon monolithic Hall-effect magnetic sensor with magnetic concentrator
  • Digitally programmable low-pass Gyroscope filter
  • Gyroscope operating current: 3.2mA
  • Accelerometer normal operating current: 450µA
  • Magnetometer normal operating current: 280µA at 8Hz repetition rate
  • VDD supply voltage range of 2.4 – 3.6V
  • Small board design
  • Detachable mounting holes

SparkFun IMU Breakout - MPU-9250 Product Help and Resources

MPU-9250 Hookup Guide

July 28, 2016

Get up and running with the MPU-9250 9-axis MEMS sensor.

9DoF Razor IMU M0 Hookup Guide

December 1, 2016

How to use and re-program the 9DoF Razor IMU M0, a combination of ATSAMD21 ARM Cortex-M0 microprocessor and MPU-9250 9DoF-in-a-chip.

Alternate library and example code

If you're having trouble with the SparkFun library and sample code, give this library a try. It's been tested with I2C but not SPI. Many thanks to Brian R Taylor for the library.


I2C Address Issues with "MPU9250BasicAHRS_I2C” sketch

If you are having address conflict issues running the Basic I2C sketch, try editing this line of code:

if (d != 0x48) 

to:

if (d != 0xFF) 

It seems certain versions of Arduino do not agree with the syntax but changing this line in the example sketch should fix the I2C address issue.


Use with the Raspberry Pi?

There is Python example code for the MPU-9250 for a Raspberry Pi.

Try looking at this tutorial http://kingtidesailing.blogspot.com/2016/02/how-to-setup-mpu-9250-on-raspberry-pi_25.html . Also, try looking at this blog [ http://blog.pistuffing.co.uk/mpu-9250-first-impressions/ ].


Core Skill: Soldering

This skill defines how difficult the soldering is on a particular product. It might be a couple simple solder joints, or require special reflow tools.

1 Soldering

Skill Level: Noob - Some basic soldering is required, but it is limited to a just a few pins, basic through-hole soldering, and couple (if any) polarized components. A basic soldering iron is all you should need.
See all skill levels


Core Skill: Programming

If a board needs code or communicates somehow, you're going to need to know how to program or interface with it. The programming skill is all about communication and code.

3 Programming

Skill Level: Competent - The toolchain for programming is a bit more complex and will examples may not be explicitly provided for you. You will be required to have a fundamental knowledge of programming and be required to provide your own code. You may need to modify existing libraries or code to work with your specific hardware. Sensor and hardware interfaces will be SPI or I2C.
See all skill levels


Core Skill: Electrical Prototyping

If it requires power, you need to know how much, what all the pins do, and how to hook it up. You may need to reference datasheets, schematics, and know the ins and outs of electronics.

3 Electrical Prototyping

Skill Level: Competent - You will be required to reference a datasheet or schematic to know how to use a component. Your knowledge of a datasheet will only require basic features like power requirements, pinouts, or communications type. Also, you may need a power supply that?s greater than 12V or more than 1A worth of current.
See all skill levels


Comments

Looking for answers to technical questions?

We welcome your comments and suggestions below. However, if you are looking for solutions to technical questions please see our Technical Assistance page.

  • Member #115633 / about 8 years ago * / 2

    Why are the magnetic and accel/gyro sets of axis references not in sync? Is this intentional (or typical)? I guess SW can "fix" that without a problem.

    • .Brent. / about 8 years ago / 1

      I'm not certain why the two sensors in the package don't have the axes aligned the same, but here is where that difference is documented orientation of axes

  • Clebio / about 5 years ago / 1

    How does this compare to the SparkFun 9DoF IMU Breakout - LSM9DS1 (part SEN-13284)?

    • santaimpersonator / about 5 years ago / 1

      The datasheets should be linked for each product.

  • jremington / about 5 years ago / 1

    The Sparkfun example code MPU9250BasicAHRS_I2C does not work out of the box, because the I2C address is incorrect. Fix that, and also enable the magnetometer calibration.

    See also the major bug that produces nonsensical yaw, pitch and roll angles, reported in a separate comment below.

  • jremington / about 5 years ago * / 1

    The Sparkfun code MPU9250BasicAHRS_I2C has a serious bug that makes the yaw, pitch and roll angles nonsense. The bug is also in Kris Winer's original BasicAHRS code for Arduino/MPU-9250. The magnetometer coordinate system as defined is left handed and has NEVER worked properly. See issue #368 on Kris Winer's Github page.

    A simple fix to the code is to invert the sign of mz, AS SHOWN IN THE FOLLOWING, CORRECTED LINE:

    MahonyQuaternionUpdate(myIMU.ax, myIMU.ay, myIMU.az, myIMU.gx * DEG_TO_RAD, myIMU.gy * DEG_TO_RAD, myIMU.gz * DEG_TO_RAD, myIMU.my, myIMU.mx, -myIMU.mz, myIMU.deltat);

    Of course, if the magnetometer is not properly calibrated, the orientation angles will also be nonsense, so activate the built in calibration procedure, and make sure that all possible magnetometer orientations are sampled reasonably well in the 15 seconds you are given.

    With the above fix, and the magnetometer properly calibrated, yaw = 0 corresponds to the acelerometer/gyro X axis pointing toward magnetic North, Yaw increases as the X-axis sweeps toward West (unlike a magnetic compass). See the comments in the code to interpret the meaning and signs of the other angles.

  • Member #1537078 / about 5 years ago / 1

    My sensor works only when provided with 5V (simplest setup I2C). Every information that I found says that proper voltage is 3.3V, not 5V. When powered with 3.3V nothing happens. No sensor response. Can anybody explain this to me?

    • santaimpersonator / about 5 years ago / 1

      Hi there, it sounds like you are looking for technical assistance. Please use the link in the banner above, to get started with posting a topic in our forums. Our technical support team will do their best to assist you.

      Although, that doesn't sound right... the max input voltage on the datasheet is 3.6V (hopefully, you haven't damaged the IC). Otherwise, make sure you are using a logic level converter if you have a 5V microcontroller. You can also use the hook up guide (I don't remember if you need pull-up/down resistors).

  • Member #562638 / about 6 years ago / 1

    I am working on a device that has a base and inside has a part that rotates. the part is small and therefore can be placed/moved in any direction. Inside the base, I have a part that moves laterally with respect to the base. I want to know the position of the moving part, with respect to the base. The simpler solution is to put physical limit switches for me to know when the part is in certain locations but I want to know the location at all times.

    Will putting two of these modules (one on the base and the other on the moving part), and using all 9 readings, work in determining the lateral location of the moving part?

    for example, if the part is at a 30 degree angle from the base, and the base is flat on the surface, I will get the 30 degree reading. But I want to get the same 30 degree reading if the whole part is at a different pitch and yaw. I think this should be possible, I just want to ask before I go ahead and buy two of these

  • Tinkerman / about 6 years ago * / 1

    This sensor will not give you great heading accuracy without proper calibration. You need to remove the biases on the x,y,z planes for both the magnetometer, gyro and the accelerometer to get headings that make sense. On top of that, the board layout will affect the measured magnetic field causing the response surface for the magnetometer x,y,z to be non-spherical. You need to apply a vector transform to compensate. You can use a program called "Magneto v1.2" to determine both the biases and the transform that needs to be applied based on samples taken as you rotate the board around all axis. Once you do all that, you can get +/- 4-5 degrees heading accuracy when using Mahony/Madgwick sensor fusion algorithms. The MPU9250 is now officially end-of-life (EOL) by Invensens/TDK. Although the TDK ICM-20948 is supposed to be a replacement (and pin compatible) it operates the I2C at a maximum of 1.8v.

  • noworries / about 6 years ago / 1

    The Sparkfun Arduino library example code is misleading. It leads one to think that changing the code to include a local adjustment for magnetic variation will get a valid yaw output that can be used to obtain heading data. Not so. The code contains bias values for the magnetometer that are unique to the MPU-9250 that was used to develop the library. These bias values will not be your required bias values to obtain useful heading data from the MPU-9250. Without these bias values, the library example AHRS code can be expected to output valid pitch and roll info, but wildly inaccurate (unusable) yaw info.

  • noworries / about 6 years ago / 1

    I am using this part with a 5v pro mini. I compiled the example code MPU9250BasicAHRS that was included with the library which I installed with the arduino library manager.

    The code is connecting to the MPU9250, displaying reasonable data for pitch and roll, but yaw, not so much.

    I applied the correct magnetic variation for my location, but note the following:

    When the x axis of the accelerometer is aligned with true north, the yaw output is around 35 degrees, east gives values around -159, south shows 135, west 84. This does not make sense. The Yaw is changing in the wrong direction when rotated from north to east.

    I know the magnetic sensor coordinate axes are not the same as the accel axes, but it is not clear if the example code is intended to correct for this before displaying yaw, pitch, and roll amounts.

    Has this code been verified to output sane results, and if so how exactly is the part oriented physically when oriented towards true north?

  • Member #774817 / about 7 years ago / 1

    I've been trying to get accurate yaw data for 2 days straight ad I have no idea what is wrong. I don't know here to start. I'm using sparkfun's library and the yaw data is constantly shifting all over the place and has never once pointed me towards north. Also the yaw sporadically jumps when I go past (what should be) 90 degrees. There seems to be absolutely no correlation between how far I turn it and the yaw. I'm going insane trying to figure this out and it doesn't help that I have no understanding of quaternion filters and all the crazy math going on.

    • jremington / about 5 years ago / 1

      The code has never worked properly. See most recent comments, and the fix.

      • santaimpersonator / about 5 years ago / 1

        Try using the Razor hookup guide, it uses more updated library and a modified version of the DMP from InvenSense. Just keep in mind that the code in that hookup guide is designed to work on the SAMD21 and may not work with other microcontrollers.

  • liudr / about 7 years ago / 1

    Is an interrupt pin required? The sample code defined an intPin but didn't really use it. I couldn't find anywhere in the library code that uses interrupt either.

  • liudr / about 7 years ago / 1

    I have a question regarding the yaw angle. According to wikipedia, turning the nose to the right is positive yaw. According to the sparkfun tutorial, this seems to be the opposite. The mag. declination angle (east of true north being positive) is subtracted from myIMU.yaw (line 391). This means that if your device points 8.5 degrees east of true north, your magnetometer will show zero and you end up getting -8.5 degrees after the subtraction. Can someone explain the difference? Thanks.

    https://en.wikipedia.org/wiki/Aircraft_principal_axes https://learn.sparkfun.com/tutorials/mpu-9250-hookup-guide?_ga=2.41541028.747198559.1526401852-836860115.1440527768

  • What is the sampling frequency of this sensor?

  • https://www.youtube.com/watch?v=6ijArKE8vKU

    Can i do 3d tracking like above with this sensor?

    If yes means Please help me to do this?

    Thanks in advance

  • Member #729200 / about 7 years ago / 1

    Pardon my noobness but does this also include a compass so I can get data on the orientation of the device? I plan to use this in an obstacle avoiding drone and want to make sure that the sensor to detect the obstacles is always pointed in the direction of movement.

    • M-Short / about 7 years ago / 1

      This does have a 3 axis magnetometer which can be used as a compass.

  • OHoilett / about 7 years ago * / 1

    I am trying to change the address of the chip in the firmware, but can't seem to find where SparkFun defines "slave_addr". Has anyone been able to do this?

    ***UPDATE: I found where the register address is defined. It's hard-coded into a struct. Navigate to the inv_mpu.c file. Go to "const struct hw_s hw = {", line 435 in my version of the code and "const struct hw_s hw = {", line 516 of the code. The register address is stored in variable ".addr". Not sure why the original author of the library decided to hard-code this value in vs. allow the user to pass the address as a parameter (had a good reason I guess--maybe easier to manage?? -- would someone care to comment?), but that seems to be the case. Hope this helps someone else.

  • Member #320720 / about 8 years ago / 1

    What are the dimensions of this item?

  • Member #905391 / about 8 years ago / 1

    I see that in data sheet Figure 4 and 5, the axes are diagrammed. It appears that the axes are exactly on top of each other. Is this true, or is there slight angle deviations between axes? That is, is the X axis of accelerometer a certain angle theta off from the X axis of gyroscope? Is the X axis of accelerometer a certain angle phi off from the Y axis of the compass? If so, can this information be found anywhere? I want to know the exact theta and phi for a given IMU.

    Thanks!

  • Member #101121 / about 8 years ago / 1

    Was reading some additional documentation on this chip (found using this search: AN-IVS-0002A-00) as well as reading though Kris Winer's various Q&A. It says the exposed die pad should NOT be soldered to the PCB. Kris refers to this as a big no-no. Is there something I'm missing here, because it looks like your breakout does put paste there for soldering (as well as running traces beneath the device, which also is discouraged)? I am asking because I bought a couple of these and I am having a very hard time calibrating them (wondering if this could be at least part of the issue).

  • Member #861160 / about 8 years ago / 1

    Does this board also have a dmp ?

    • .Brent. / about 8 years ago / 1

      The IC has DMP capabilities, but only by loading about 3kB of closed binary firmware onto it each time it's powered on. Things are changing, but that is a little large for the more common Arduinos. InvenSense's developer site has code for ARM processors if you need it.

  • Juliano / about 8 years ago / 1

    What is the best/right logic level converter to connect the IMU to a UNO? :)

  • randomvibe / about 8 years ago / 1

    I hooked up the MPU-9250 SPI pins to a Teensy 3.2, but the WHO-AM-I register is incorrectly returning zero. Does the breakout board need any special treatment, like desoldering one of the jumpers or anything else?

    I prefer SPI because my robot needs a 3 foot CAT-5 cable to the IMU and SPI is less susceptible to noise and it's way faster than I2C. I've done SPI for the LSM6DS3 IMU, but now I need magnetometers too.

    • Member #522649 / about 8 years ago / 1

      Agreed, SPI jumper instruction is needed. Sparkfun, please...

      • Member #522649 / about 8 years ago / 1

        Ok, after digging through the documentation a bit more, I figured that SJ2 jumper needs to be moved to the opposite side. Now it still didn't work on my Teensy but then I moved over to an Arduino Due and all is good. I guess I need to understand the brand-spanking new Teensy 3.6 a bit better with its 3 SPI's...truly amazing piece of hardware, 180MHz!!!

  • MickeyMouse / about 8 years ago / 1

    I would like to know about the sensors' uniformity. In other words, if I use 2 of these sensors to measure the same movement, how different will the 2 measurements be, compared to each other?

    • MickeyMouse / about 8 years ago / 1

      Can anyone answer my question please? If not, then could anybody think of a way to connect the IMU to a breadboard WITHOUT soldering it (so that I can check the uniformity of multiple sensors myself, before soldering them)?

      • M-Short / about 8 years ago / 2

        As for the original question I'm not sure, I'd check out the datasheet for the sensor which should give you an idea of its accuracy. As for connecting them without soldering I personally would use jumper wires and hold them at an angle with a bit of pressure to make sure they don't move. This does make debugging and things hard since you only have 1 hand free, but for a quick measurement should work fine.

  • Member #2980 / about 8 years ago / 1

    I want to measure very small changes in a objects position. tip/tilt. direction etc. But I'm looking at fractions of a degree not large changes for example.
    is one of these appropriate for that type of measurement.? what would be a better choice if not?

    Oh and it would be placed on a large aluminum plate. would that cause interference of any kind

    • You want an Inclinometer http://www.digikey.com/product-detail/en/murata-electronics-north-america/SCA61T-FA1H1G-1/551-1005-1-ND/751309

    • Member #2739 / about 8 years ago / 1

      Also applies to +MickeyMouse:s question

      MEMS gyros/accelerometers (and probably inclinometers too but IDK) are noisy as hell, even with relatively good kalman filtering you're unlikely to get repeatability to fractions of degree. rotation around the "Z" axis (assuming gravity eg up<->down is Z) is especially difficult and if you rotate 180deg one way and then back the reading is likely to be off by several degrees (tilts are easier since they can be correlated with accelerometer data).

      All of the above applies to "older generation" IMUs, this one might be significantly better (but probably isn't, there are inherent limits in MEMS technology and it will never be comparable with proper laser-gyros, but we're not building space shuttles.)

  • Are those tattoos for real?

  • cctsm / about 8 years ago / 1

    You misspelled "Gyro" on the silkscreen...

Customer Reviews

3.9 out of 5

Based on 15 ratings:

Currently viewing all customer reviews.

1 of 1 found this helpful:

Amazing accuracy

Just apply a kalman filter and this'll give you near perfect orientation data.

Y-axis accel bad out of the box

Y-axis accel sensitivity only 35% of X and Z right out of the box.

Sorry to hear that, sounds like it may be a borked chip. If you contact our tech support team, they should be able to help you resolve the issue.

I am surprised how stable it is

I am still experimenting with combining all the accelerometers and gyros together, but testing just the X axis for 2 1/2 minutes with the bias dialed in I got less than an inch of error when it was strapped down. I did not believe that you could buy that much stability for such a low price!

Satisfactory

This breakout board allows you to connect an MPU-9250 to a microporcessor or microcontroller board without having to create your own printed circuit board to mount the chip on. Good job.

Works well, amazing for the price

We needed to collect some accelerometer data and liked that these had adjustable G ranges. The I2C interface requires a level shifter if you want to use this board with an Arduino Uno (it would be nice if this were explicitly mentioned up front! I ordered the SparkFun Logic Level Converter - Bi-Directional BOB-12009 once I figured this out and it worked great). I used the code from http://playground.arduino.cc/Main/MPU-6050#short to get the data collection going. We've gotten a 4kHz data rate out of the system and the data had low noise until we tried to move the IMU about 3 meters away - didn't work even with shielded cable. Keep the IMU and mpu close!. All in all a very good sensor.

Nice and small products.

I ordered 7 of these. Of the 7 one of them was orientated the wrong way, or at least appeared to be. Changing the SJ2 jumper was tricky and a little bit scary to do. Worked well for our project.

Cannot read Yaw and pitch

We are not able to reach pitch and yaw correctly. Too much wring reading. We need 0.1 degree accuracy. How can we fix it?

Sorry to hear about the issues with the sensor.

Have you reached out to our technical support department? They're the best line of communication to use to get support for the product.

Product is great, some misses though.

The product works great and the code works out of the box. However, compared to other SparkFun break outs, this one has some issues. So it is "Okay" relative to the other SparkFun offerings. And please; maybe my expectations are off base.

The example code is not 100% straight forward. There are definitions for pins that are not used, comments that refer to deleted code, and "ifdef" sections for non-standard parts. I am used to there being an example code that gets the system started and demonstrates how to get data from the sensor. Granted that the additional implementation of the features in "quaternionFilters.h" are awesome. But, this is not the simplest demo code as I would expect.

With regard to the board, it would be nice to have labels for the pins on the top of the board. It's a small board, so that would be a challenge, but it would be nice. Since there are no labels on the top of the board, the connection diagrams in the "Getting Started" pages are harder to follow than examples for other SparkFun products.

Fast and working

Very fast shipment and a good sensor!

Great value for the money

Small size, I2C capability, easy to use, and relatively cheap

Very Good despite the datasheet

I needed fast data readout (I2C is too slow) so I went with this breakout because of the ability to read all of the data from the SPI interface. This breakout is very good with small form factor. You just de-solder one jumper and you can switch from I2C to SPI. The datasheet for the MPU-9250 however is pretty horrendous (I know this is not sparkfun's fault but it is soooo bad I had to ding the board one star)

Good product.

Very good product, working well. I do recommend MPU-9250 to others.

Worked great first try using android example

Wow, couldn't have been easier. Hooked it up to a Teensy, and presto, everything worked! Nice sensor and great price.

NRND

The device provided is now Not Recommended for New Development and Obsolete. The manufacturer has been acquired by TDK, who now (God knows why...) recommend you use their product that's inferior to this IMU. TDK does not sell any IMUs that are as good as the MPU-9250 unless you can supply 1.8v power and don't mind a slight hit to sensor quality and a considerable hit to SPI communications speed. I looked around for a device that is similar in quality and price to the MPU9250 and found the Bosch BMX160.