คำอธิบาย
เซนเซอร์โมดูลวัดความเร่ง 3-axis Accelerometer Gyro Sensor Module MPU6050 GY-521
- MPU-6050 Accelerometer + Gyroscope
- ใช้ ชิป MPU6050
- แหล่งจ่ายไฟ DC3-5V
- วิธีการสื่อสาร โปรโตคอลการสื่อสาร IIC มาตรฐาน I2C
- ตัวแปลง AD 16 บิตในตัวชิป
- เอาต์พุตข้อมูล 16 บิต
- ช่วง Gyroscope ±250, ±500 ±1,000, ±2,000 °/s
- ช่วงการเร่งความเร็ว ±2g, ±4g, ±8g, ±16g
- VCC, GND, SCL, SDA, XDA, XCL, ADO, INT ระยะพิทช์ Connector 2.54mm
- Board size 20 x 16mm

Arduino Code
/* Get tilt angles on X and Y, and rotation angle on Z
* Angles are given in degrees
*
* License: MIT
*/
#include "Wire.h"
#include <MPU6050_light.h>
MPU6050 mpu(Wire);
unsigned long timer = 0;
void setup() {
Serial.begin(115200);
Wire.begin();
byte status = mpu.begin();
Serial.print(F("MPU6050 status: "));
Serial.println(status);
while(status!=0){ } // stop everything if could not connect to MPU6050
Serial.println(F("Calculating offsets, do not move MPU6050"));
delay(1000);
// mpu.upsideDownMounting = true; // uncomment this line if the MPU6050 is mounted upside-down
mpu.calcOffsets(); // gyro and accelero
Serial.println("Done!\n");
}
void loop() {
mpu.update();
if((millis()-timer)>10){ // print data every 10ms
Serial.print("X : ");
Serial.print(mpu.getAngleX());
Serial.print("\tY : ");
Serial.print(mpu.getAngleY());
Serial.print("\tZ : ");
Serial.println(mpu.getAngleZ());
timer = millis();
}
}



รีวิว
ยังไม่มีบทวิจารณ์