MPU6050 Gyro&Accelerometer

From Epalsite Wiki
Jump to: navigation, search


The MPU6050 has an embedded 3-axis MEMS gyroscope, a 3-axis MEMS accelerometer. It is very useful for some motion detecting. This small module integrate the logic level converter circuit(makes it compatible with 3.3V-5V voltage level) together with the MPU6050 sensor, you can integrate it to your project conveniently


  • I2C interface
  • Compatible with 3.3V-5.0V voltage level


For detailed internal function of MPU6050, please refer to the MPU6050 Datasheet. The following sample code is from Sparkfun. Please extract it to the library folder of your Arduino IDE.
MPU6050 Sample Code
In addition to connecting 3.3v, GND, SDA, and SCL to the relative pins of Arduino, this sketch depends on the MPU-6050's INT pin being connected to the Arduino's external interrupt #0 pin. On the Arduino Uno and Mega 2560, this is digital I/O pin 2.
As the sketch nmaed "MPU6050_raw" for example, we'll get the raw data from MPU6050. The following picture shows the result.
MPU6050 raw.PNG
The first 3 columns are the data of the 3-axis Accelerometer, the rest 3 columns are the data of the 3-axis Gyro. Try to move the sensor module, you will see the data changes.