感測器(三): 使用Mega2560結合MPU6050三軸陀螺儀+三軸加速計之數位運動處理器(DMP)
今天試了一下買的MPU6050模組,想了解一下陀螺儀與加速計如何應用,
首先要先下載MPU6050的I2C範例程式,
- MPU6050 範例程式下載網址:
https://www.i2cdevlib.com/devices/mpu6050#source
下載完成後將MPU6050資料夾放到C:\Program Files (x86)\Arduino\libraries
同時亦將I2Cdev資料夾中的I2Cdev.cpp與I2Cdev.h放到C:\Program Files (x86)\Arduino\libraries\MPU6050
在Arduino IDE中選File–>Examples–>MPU6050
有兩個範例,其使用方式如下:
- 範例 MPU6050 raw使用文章參考:
https://ming-shian.blogspot.tw/2014/05/arduino21mpu6050row-data.html
MUP6050與Arduino連接方式如下,左邊為MPU6050的接腳,右邊為Mega2560接腳,
VCC–>5V
GND–>GND
SCL–>SCL (Pin 21)
SDA–>SDA (Pin20)
使用Serial monitor時,設定Baud rate: 38400
- 範例 MPU6050 DMP6使用文章參考:
https://42bots.com/tutorials/arduino-uno-and-the-invensense-mpu-6050-6dof-imu/
MUP6050與Arduino連接方式如下,左邊為MPU6050的接腳,右邊為Mega2560接腳,
VCC–>5V
GND–>GND
SCL–>SCL (Pin 21)
SDA–>SDA (Pin20)
INT–> Dig 2
使用Serial monitor時,設定Baud rate: 115200
MPU6050與Mega2560連接圖。
其他參考資料:
https://playground.arduino.cc/Main/MPU-6050
https://www.takobear.tw/201702608526356260322804024687/bear-arduinompu6050servo
https://gogoprivateryan.blogspot.tw/2014/07/mpu-6050-google.html




