Tockn/MPU6050_tockn: Arduino Library For Easy ... - GitHub
Có thể bạn quan tâm
Arduino library for easy communicating with the MPU6050
Usage
You can see example sketch.
If you want to get data of MPU6050, you must execute update() method before get method. update() will get all data of MPU6050, and calculating angle by accelerometer, gyroscope and complementary filter.
Complementary filter
update() method calculate angle by accelerometer and gyroscope using complementary filter. Those two coefficients determined by constructor. Default coefficient of accelerometer is 0.02, gyroscope is 0.98. filtered_angle = (0.02 * accel) + (0.98 * gyro)
example
If you want to set 0.1 to accelerometer coefficient and 0.9 to gyroscope coefficient, your code is MPU6050 mpu6050(Wire, 0.1, 0.9);
Auto calibration
If you use calcGyroOffsets() in setup(), it will calculate calibration of the gyroscope, and the value of the gyroscope will calibrated. ⚠DO NOT MOVE MPU6050 during calculating.⚠
#include <MPU6050_tockn> #include <Wire.h> MPU6050 mpu6050(Wire); void setup(){ Wire.begin(); mpu6050.begin(); mpu6050.calcGyroOffsets(); }If you use calcGyroOffsets(true) in setup(), you can see state of calculating calibration in serial monitor.
#include <MPU6050_tockn> #include <Wire.h> MPU6050 mpu6050(Wire); void setup(){ Serial.begin(9600); Wire.begin(); mpu6050.begin(); mpu6050.calcGyroOffsets(true); }Serial monitor:
Calculate gyro offsets DO NOT MOVE MPU6050..... Done! X : 1.45 Y : 1.23 Z : -1.32 Program will start after 3 secondsIf you know offsets of gyroscope, you can set them by setGyroOffsets(), and you don't have to execute calcGyroOffsets(), so you can launch program quickly.
example
#include <MPU6050_tockn> #include <Wire.h> MPU6050 mpu6050(Wire); void setup(){ Serial.begin(9600); Wire.begin(); mpu6050.begin(); mpu6050.setGyroOffsets(1.45, 1.23, -1.32); }Licence
MIT
Author
tockn
Từ khóa » Thư Viện Mpu6050
-
Tổng Hợp Thư Viện Arduino Cho Một Số Loại Cảm Biến
-
MPU6050 - Arduino Library List
-
ElectronicCats/mpu6050: MPU6050 Arduino Library - GitHub
-
MPU6050 Giao Tiếp Arduino, Cảm Biến Gia Tốc + Oled + Arduino
-
Cảm Biến Gia Tốc MPU6050 Trường An Equipment
-
Hướng Dẫn Sử Dụng Module GY85, GY68, MPU6050, ADXL345
-
Mô-đun Gia Tốc Kế MPU6050 Và Con Quay Hồi Chuyển - Blog Mecsu
-
Lập Trình Vi điều Khiển-Phần 48-Cách Thêm Thư Viện MPU 6050
-
MPU6050 - Arduino Reference
-
MPU6050: Mô-đun để định Vị Với Arduino
-
Cảm Biến Gia Tốc GY-521 6DOF IMU MPU6050 - Nshop
-
10. Bài Học 9: Cảm Biến Gia Tốc Góc Nghiêng - OhStem Education
-
Module Con Quay Hồi Chuyển 6 Trục MPU 6050 | Shopee Việt Nam