MPU6050-Unity-thumb

[en] Arduino + Unity + MPU 6050 : using gyroscope to control Unity

Tes­ted on MACOS X 10.9.5

Hard­ware

arduino

Arduino Uno

mpu6050

MPU-6050 Module 3 axis Gyro

Soft­wares

Pro­ces­sing

Arduino

Unity

Libra­ries for Arduino

Libra­ries for Processing

Codes / Files

Arduino sketch

Pro­ces­sing sketch

Unity3D pro­ject

Prin­ciples

Wiring MPU 6050 with Arduino

mpu6050-arduino

Ins­tal­ling libraries

I2Cdevlib

After down­loa­ding, unzip it.

Browse into the unzip­ped folder

i2cdevlibDrop the I2Cdev fol­der to your Ardeuino’s library fol­der (default is : ~/Documents/Arduino/libraries/)

MPU 6050

For a cor­rect use, we need to ins­tall a second library from the same unzip­ped fol­der. This time, it’s named : MPU6050. Drag it to the Arduino’s librai­ries folder.

mpu6050

Arduino soft­ware : connec­ting MPU6050 to serial Port – 1srt com­mu­ni­ca­tion with computer

Launch Arduino soft­ware to check the good ins­tal­la­tion of libraries.

Go to File → Examples → MPU6050 → Examples → MPU6050_DMP6

mpu6050-arduino

After connec­ting Arduino board to your com­pu­ter with USB wire, click the upload button.

Capture 2015-01-02 à 18.42.35Go to Tools → Serial Monitor

Capture 2015-01-02-18.44.21

Type any key in the field of serial moni­tor and click on the Send button…

Have a look on this video to check wor­king example :

The Tea­pot Demo

The next step is che­cking the good com­mu­ni­ca­tion bet­ween the arduino serial port and ano­ther appli­ca­tion. There’s an ready-tot-go way to do that : the tea­pot demo. The tea­pot demo com­bines 2 files : an arduino one and a pro­ces­sing one. It’s very easy to use them to test the way arduino’s serial port com­mu­ni­cates with ano­ther application.

Down­load Tea­pot Demo Files

Fil­te­ring values from sensor

For acu­rate results in Unity, we need to fil­te­ring the values sent by mpu6050. For detai­led expla­na­tions, read the fol­lo­wing posts :

http://www.geekmomprojects.com/gyroscopes-and-accelerometers-on-a-chip/

http://www.geekmomprojects.com/mpu-6050-redux-dmp-data-fusion-vs-complementary-filter/

Refe­rences

http://playground.arduino.cc/Main/MPU-6050

http://geedesign.com/blog/?p=834

http://geedesign.com/blog/?p=834

http://www.geeetech.com/wiki/index.php/MPU-6050_Triple_Axis_Accelerometer_%26_Gyro_Breakout

https://bayesianadventures.wordpress.com/2013/10/20/gyroscopes-accelerometers-and-the-complementary-filter/

http://www.geekmomprojects.com/gyroscopes-and-accelerometers-on-a-chip/

http://www.geekmomprojects.com/mpu-6050-redux-dmp-data-fusion-vs-complementary-filter/

Uni­duino

http://www.uniduino.com

MPU6050

http://www.botched.co.uk/pic-tutorials/mpu6050-setup-data-aquisition/

http://mpuprojectblog.wordpress.com/category/mpu6050/page/2/

0