Difference between revisions of "MPU6050 Module"

From Wiki
Jump to: navigation, search
Line 5: Line 5:
 
===Step 1: Connect the circuit===
 
===Step 1: Connect the circuit===
 
See the following table for connection between the I2C LCD2004 and the SunFounder Uno board:<br>  
 
See the following table for connection between the I2C LCD2004 and the SunFounder Uno board:<br>  
[[File:Untitled Sketch 2_bb.png]] <br>
 
 
<center>
 
<center>
 
{| border="1" class="wikitable"
 
{| border="1" class="wikitable"
Line 23: Line 22:
 
|align="center"|SCL
 
|align="center"|SCL
 
|align="center"|A5
 
|align="center"|A5
 +
|-
 +
|align="center"|INT
 +
|align="center"|D2
 
|}
 
|}
 
</center>
 
</center>
 
+
[[File:Untitled Sketch 2_bb.png]] <br>
 
===Step 2:Add library===
 
===Step 2:Add library===
 
+
Open Arduino IDE, then click Sketch -> Include Library -> Add ZIP Library, and select MPU6050.zip to include.<br>
 +
After including successfully, you can see the example in File -> Examples -> MPU6050 as shown.<br>
 +
[[File:lib1.png]] <br>
 +
===Step 3: Get Drift Compensation Values===
 +
The MPU6050 sensor’s reading (raw data) is transformed in space attitude angle. To get more stable and accurate reading, we should set the drift compensation first. The drift differs for different sensors (also affected by environments), thus it’s necessary to configure it before using every time.<br>
 +
Download mpu6050_calibration in folder examples, select the board type and COM. Open the serial monitor after program uploading, set the baud rate to 115200, and place the MPU6050 horizontally, do not move to avoid any vibration disturbance. Then press any key and click enter. So here you can see the compensation values are 1721, -1885, 1368, 38, -25, and 18, corresponding to six parameters including acceleration (AcceX, AcceY, and AcceZ) and gyroscope (GyroX, GyroY, and GyroZ).<br>
 +
[[File:mpu6050 jz.png]] <br>
 +
===Step 4: Reading Real-time Data===
 +
Then go back to the interface of the example mpu6050_DMP6 after including, and go to line 128. Enter the compensation value for “GyroX, GyroY, GyroZ and AcceZ” (as shown in figure below)<br>
 +
[[File:mpu6050cs.png]] <br>
 +
Then upload the program, press any key and click Enter in the serial monitor. Move the MPU6050 and observe the real-time data (as shown in figure below).<br>
 +
[[File:mpu6050ck.png]] <br>
 
=='''Resource'''==
 
=='''Resource'''==
 
[ Test Experiment for Arduino][[File:LINK.jpg]]<br>
 
[ Test Experiment for Arduino][[File:LINK.jpg]]<br>
 
[https://www.sunfounder.com/learn/sensor-kit-v2-0-for-raspberry-pi-b-plus/lesson-32-mpu6050-gyro-acceleration-sensor-sensor-kit-v2-0-for-b-plus.html Test Experiment for Raspberry Pi][[File:LINK.jpg]]
 
[https://www.sunfounder.com/learn/sensor-kit-v2-0-for-raspberry-pi-b-plus/lesson-32-mpu6050-gyro-acceleration-sensor-sensor-kit-v2-0-for-b-plus.html Test Experiment for Raspberry Pi][[File:LINK.jpg]]

Revision as of 02:25, 28 August 2017

Introduction

Mpu6050.png
The MPU-6050 is the world’s first and only 6-axis motion tracking devices designed for the low power, low cost, and high performance requirements of smartphones, tablets and wearable sensors.

Experimental Procedures

Step 1: Connect the circuit

See the following table for connection between the I2C LCD2004 and the SunFounder Uno board:

MPU6050 SunFounder uno Board
GND GND
VCC 5V
SDA A4
SCL A5
INT D2

Untitled Sketch 2 bb.png

Step 2:Add library

Open Arduino IDE, then click Sketch -> Include Library -> Add ZIP Library, and select MPU6050.zip to include.
After including successfully, you can see the example in File -> Examples -> MPU6050 as shown.
Lib1.png

Step 3: Get Drift Compensation Values

The MPU6050 sensor’s reading (raw data) is transformed in space attitude angle. To get more stable and accurate reading, we should set the drift compensation first. The drift differs for different sensors (also affected by environments), thus it’s necessary to configure it before using every time.
Download mpu6050_calibration in folder examples, select the board type and COM. Open the serial monitor after program uploading, set the baud rate to 115200, and place the MPU6050 horizontally, do not move to avoid any vibration disturbance. Then press any key and click enter. So here you can see the compensation values are 1721, -1885, 1368, 38, -25, and 18, corresponding to six parameters including acceleration (AcceX, AcceY, and AcceZ) and gyroscope (GyroX, GyroY, and GyroZ).
Mpu6050 jz.png

Step 4: Reading Real-time Data

Then go back to the interface of the example mpu6050_DMP6 after including, and go to line 128. Enter the compensation value for “GyroX, GyroY, GyroZ and AcceZ” (as shown in figure below)
Mpu6050cs.png
Then upload the program, press any key and click Enter in the serial monitor. Move the MPU6050 and observe the real-time data (as shown in figure below).
Mpu6050ck.png

Resource

[ Test Experiment for Arduino]LINK.jpg
Test Experiment for Raspberry PiLINK.jpg