Did you buy a 10-DOF sensor from aliexpress or ebay and experience problems getting it running? I downloaded Jeff Rowberg library and the output always freezed after a while. I decided to debug the code, because the sensor MPU-9150 seemed promising, but didn't run well.

The sensor includes 10 sensors:

  1. 3 axis accelerometer
  2. 3 axis magnetometer
  3. 3 axis gyroscope
  4. Barometer

The most complicated part is fusion of the data to get calibrated, non-drifting measurements of yaw, pitch and roll.

Step 1: Construction

For the construction I used Arduino Pro-Micro clone, because it is compact. I wanted a small unit to incorporate in other projects.

The wiring is simple:

  • MPU9150 VCC - Arduino VCC
  • MPU9150 GND - Arduino GND
  • MPU9150 I2C SCL - Arduino I2C SCL (Pro Micro is pin 2)
  • MPU9150 I2C SCL - Arduino I2C SDA (Pro Micro is pin 3)
  • MPU9150 AD0 - Arduino GND
  • MPU9150 INT - Arduino pin 7 (interrupt 4 for Pro Micro)

Step 2: Code

To use the IMU install the two attached libraries (copy to Arduino library folder). Run the MPU6050_DMP6.ino file and upload the code to you Arduino. To see the demo, run the processing teapot example (it is located in libraries\MPU6050\Examples\MPU6050_DMP6\Processing\MPUTeapot).

Another issue I took care of is power loss during normal operation: try to disconnect power from MPU-9150 and then reconnect it. The code will re-initialize the device and continue output data.

Step 3: Additional Resources

I attached the MPU-9250 register map file. It is useful to understand what the code is doing.

The libraries are from Jeff Rowberg github: https://github.com/jrowberg/i2cdevlib

He also as a support forum: http://www.i2cdevlib.com/forums

I hope to expand this instructable in the future.

Step 4: Issues

I experienced some issues with this module.

One problem many forums mention is freezing of the data. The module for some unknown reason stops outputting data after a while. I think I fixed the issue by looking at the code and fixing some conditions for entering the part where the FIFO is taken care of. There was also an error in comparison of interrupt register - the bit where data ready indication was wrong in the code.

Another problem is FIFO Full error, many experience. I think I fixed it too by taking care of the FIFO not only when an interrupt is received, but also whenever the FIFO is not empty.

I used Arduino Pro Micro, which is a 5V device, as the MPU-9150 is a 3.3V device. But that is actually not a problem. First, the MPU-9150 has an LDO (a voltage regulator) that converts 5V to 3.3V. Second, the I2C communication pull up is on the MPU-9150. When the Arduino wants to communicate it pulls the line low (to ground). When data transaction is finished, the Arduino lets go of the line and the MPU-9150 pulls it high again, So 5V never enters the device.

Another mysterious issue was FIFO full messages received after a while the device was operating. But when I disconnected everything from power and reconnected again, the problem continued. It stopped only after I pressed reset on the Arduino (one thing to mention here is that the Arduino Pro Micro doesn't load the bootloader on normal power-up, only after a reset. After 8 seconds it loads your sketch). I don't know why the problem was solved after the bootloader was activated.

I also made another change and connected the a serial to USB converter on the RX/TX pins of the Arduino Pro Micro (the USB of the Pro Micro is a virtual device, not a real serial port). It is done by using Serial1.begin instead of Serlal.begin. After this final change I saw improvement and data didn't freeze even after an hour.

Only problem I didn't solve yet is that after a while, sometimes, the device starts to output as if it spins wildly. I am not sure if it because I hold the device static for too long or if it is caused by some other failure.

I hope to solve these issues. Please share your knowledge in the comments.

<p>How do I run the teapot portion of the demo? I do not see anything that is a windows executable to display the motion info controlling an object. Can you please help me on this? Thank you</p>
<p>Hello to everyone.check out my new project about Arduino</p><p><a href="https://www.instructables.com/id/Simple-PS3-Arduino-Project/?ALLSTEPS" rel="nofollow">https://www.instructables.com/id/Simple-PS3-Arduino-Project/?ALLSTEPS</a></p>
<p>Nice to know! I'm in the market for a small (and cheap of course ;) 9-DOF IMU chip and although I won't throw it at an Awkwarduino, it's still nice to know where to find examples and where to be wary of same - Thanks :)</p>

About This Instructable




More by BorisK4:MPU-9150/9250 IMU with Arduino Pro-Micro Chanting LED Hanukkah Menorah ESP8266 LCD Billboard 
Add instructable to: