# 6.Gyro IMU（MPU6050）

MPU6050 เป็นไจโรสโคป 6 แกนที่ใช้กันแพร่หลายมากที่สุด ซึ่งไม่เพียงวัดความเร็วเชิงมุม 3 แกนและการเร่งความเร็ว 3 แกนได้แม่นยำมากขึ้น แต่ยังใช้ตัวประมวลผลการเคลื่อนไหวแบบดิจิตอล (DMP) ในตัวสำหรับการคำนวณฟิวชั่นทัศนคติตามฮาร์ดแวร์ มือใหม่จึงใช้งานได้สะดวกมาก ด้วยเหตุนี้ เราจึงใช้ไจโรสโคป MPU6050

มีการสาธิต MPU6050 มากมายบน Arduino UNO ที่มีชื่อเสียงที่สุดคือไลบรารี I2Cdev และ MPU6050DMP ของ jrowberg:

{% embed url="<https://github.com/jrowberg/i2cdevlib/tree/master/Arduino/MPU6050>" %}

ขออภัย ไลบรารีนี้ไม่สามารถเรียกใช้โดยตรงบน BiBoard ที่ใช้ ESP32 เราพบไลบรารีที่มีบน Github ซึ่งใช้งานง่าย ไลบรารีนี้เพิ่มคำจำกัดความของ PGMSpace สำหรับซีรีส์ ARM และ ESP เพิ่มฟังก์ชันการปรับเทียบ และลบฟังก์ชันการประมวลผลเกิน FIFO (เพื่อนๆ ที่สนใจสามารถใช้ Beyond Compare สำหรับการเปรียบเทียบโค้ดได้) ไลบรารีประกอบด้วย I2Cdev และ MPU6050 ที่อยู่และแพ็คเกจที่บีบอัดมีดังนี้:

{% embed url="<https://github.com/ElectronicCats/mpu6050/tree/master/src>" %}

{% file src="/files/-McCm4zwUWO7wB\_3RRFN" %}
mpu6050-master.zip
{% endfile %}

หลังจากการดาวน์โหลดเสร็จสิ้น ให้สร้างโฟลเดอร์ MPU6050 ภายใต้ Documents/Arduino/library และคัดลอกไฟล์ไลบรารีในแพ็คเกจที่บีบอัดลงไป ไลบรารีของ MPU6050 ที่แก้ไขนี้ยังเข้ากันได้กับ ARM และ AVR ดังนั้นหากคุณมีไลบรารี I2Cdev และ MPU6050 ดั้งเดิมในคอมพิวเตอร์ของคุณ คุณสามารถลบออกได้

เราสามารถใช้การตัวอย่าง MPU6050\_DMP6 อย่างเป็นทางการ


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.petoi.com/thai/biboard/demo-applications/6.gyro-imu-mpu6050.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
