9 DOF with MPU9150

      We all love if multiple entities are integrated into a small package, tiny looks – quickly hooks. Here we bring out a break-out board of 9DOF, its MAKE IN INDIA pals, housing a complex MEMS sensors MPU9150, Gyro, Accelerometer and Magnetometer in a tiny package and hell yeah it does not stop here it packs a lot more under the hood, an Integrated Digital Motion Processing core supporting 3D and gesture support. This System-In-Package is by InvenSense, packed in 4x4x1mm LGA package.

     I hope you enjoyed the Music too….


    Here we present you a demo of our break-out board, we have adapted the code from Jeff Rowberg’s MPU demo, credits to him for a nice demo, visually appealing and shows how actually the board works. We have used this board along with Arduino Uno. The demo has two parts, one part is compiling and uploading the code into Arduino Uno and other one is re-routing serial port to Processing to see the actual visuals of movement. So below are the prequisites you need before you start.

  • Ardunio Board (we used Uno here)
  • Arduino IDE
  • Processing IDE with toxic libraries
  • MPU9150 Breakout board
  • Connecting wires

     First, lets start with setting up the IDEs, Arduino and Processing. Download both of them and also toxic libraries, copy toxic libraries into Processing path install_path\processing-2.2.1\modes\java\libraries\. Lets take the first part, the Ardunio part. Get a copy of the code (Credits: Jeff Rowberg) from https://github.com/jrowberg/i2cdevlib place it in sketchbook path or Ardunio Libraries path IDE (File > Preferences). OpenPath\Arduino\libraries\MPU6050\Examples\MPU6050_DMP6\MPU6050_DMP6.ino same as below code.

Download here the code files of  MPU 9 DOF.

    Now connect the MPU9150 breakout board as per below connection details, these are for Uno and also others.

Board I2C / TWI pins
Uno, Ethernet A4 (SDA), A5 (SCL), Digital0 (INT), 3.3V & GND
Mega2560 20 (SDA), 21 (SCL)
Leonardo 2 (SDA), 3 (SCL)
Due 20 (SDA), 21 (SCL), SDA1, SCL1

Compile and upload the code, click on the serial monitor icon on top right corner and yeah you see raw reads of Yaw, Pitch and Roll.

Next is the wow part, comment line-100 of the code above and un-comment line-117 #define OUTPUT_TEAPOT, make sure again line 100 is commented, defines are mutually exclusive.

Now open the Processing IDE, prior to that you should have planted the toxic libraries in install_path\processing-2.2.1\modes\java\libraries\ Now open Processing IDE and open file:Path\Arduino\libraries\MPU6050\Examples\MPU6050_DMP6\Processing\MPUTeapot\MPUTeapot.pde. Remember one thing when you read raw data, make note of COM port ID Arduino is connected. Inside MPUTeapot.pde @line 74 change the COM port as observed.


No changes in connections though, now click on Run and a small window should pop-up with a graphical flight, wait for few seconds to get activated, if not under a minute something has gone wrong, check for connections and COM port ID change. Close the pop-up window and run again.

Check out our video for a neat demo.

Like and subscribe to our channel for exciting demos.

Posted in Breakout boads, Dev Boards, ID/IMU, Sensors and tagged , , .