Skip to content

A PLAY EXPERIENCE MAKER'S WORK LOG FOR FUTURE SELF©2001 – 2023 Kyle Li 李肅綱 All Rights Reserved.

MPU-6050

Posted on October 15, 2019June 20, 2021 by admin

I cleaned up the code and tested it, I was able to read MPU6050 for an hour in Unity 3D without freezing or interruption. Here is what I did:

  1. I removed the wire that connects to INT on MPU6050
  2. I connected AD0 on MPU6050 to GND.
  3. I use Arduino Uno for this test, if you are using the Leonardo board, the SCL and SDA pins are different (D2 and D3). This is done to prevent unnecessary interruption and freezing.
  4. Change the API Compatibility in Unity to .NET 4.x.
    Build setting > Player Setting > Other Setting > Api Compatibility Level > .NET 4.x
  5. Update the port name in the Unity code

Also, in the Arduino code, you can decide what data to print to the serial port. Look for this string: #define OUTPUT_READABLE_EULER look around it and read the description of different data outputs, I am using this one above which is rotation data.

Notes from the past:

Finally, this day has come for me to play with an MPU-6050 – a 3 Axis Analog Gyro Sensors+ 3 Axis Accelerometer Module.

Found out a tutorial on Arduino Playground:
https://playground.arduino.cc/Main/MPU-6050/#sketch

“Reading raw values is easy, the rest is not”

For serious use of the MPU-6050, Jeff Rowberg has done an excellent job.
See his I2C lib: http://www.i2cdevlib.com/devices/mpu6050
Or the latest code on GitHub: https://github.com/jrowberg/i2cdevlib/tree/master/Arduino/MPU6050

The FreeIMU library includes the MPU-6050 code from Jeff Rowberg.
The FreeIMU library: http://www.varesano.net/projects/hardware/FreeIMU

To start with the MPU-6050, see the page of InvenSense: https://www.invensense.com/products/motion-tracking/6-axis/mpu-6050/

Since my ultimate goal is to use it with Unity 3D, I also found this promising library – Uduino.
https://youtu.be/8YP8HrcGr9M

using with Bluetooth Module HC-05

New version 03/23/2021

I cleaned up the code and tested it, I was able to read MPU6050 for over an hour in Unity 3D without freezing or interruption. Here is what I did: 1. I removed the wire that connects to INT on MPU6050, 2. I connected AD0 on MPU6050 to GND. Magic!

Posted in Uncategorized

Post navigation

Lantern
the memory orb

Recent Posts

  • BMP – Rearrange Colormap
  • Reset Allow USB Debugging? Notification
  • 8-bit Notes
  • AT29C256 90PI
  • Super-Toys Last All Summer Long

Archives

Proudly powered by WordPress | Theme: MiniZen by Martin Stehle.