Cảm Biến Gia Tốc MPU9250 có khả năng đo 9 thông số: 3 trục Góc quay (Gyro), 3 trục gia tốc hướng (Accelerometer) và 3 trục từ trường (Magnetometer) chỉ bằng một cảm biến duy nhất là MPU9250 (phiên bản upgrade của MPU6050) đang rất phổ biến hiện nay, cảm biến có code mẫu đầy đủ và rất nhiều tài liệu từ cộng đồng, thích hợp cho các ứng dụng: con lắc động, xe tự cân bằng, máy bay,...
Thông số kỹ thuật:
- Điện áp sử dụng: 3~5VDC
- Điện áp giao tiếp: 3~5VDC
- Chuẩn giao tiếp: I2C / SPI
- Three 16-bit analog-to-digital converters (ADCs) for digitizing the gyroscope outputs
- Three 16-bit ADCs for digitizing the accelerometer outputs
- Three 16-bit ADCs for digitizing the magnetometer outputs
- Gyroscope full-scale range of ±250, ±500, ±1000, and ±2000°/sec (dps)
- Accelerometer full-scale range of ±2g, ±4g, ±8g, and ±16g
- Magnetometer full-scale range of ±4800μT
- Kích thước: 15 x 25mm, khoảng cách chân 2.54mm
Sơ đồ chân:
Code tham khảo Arduino:
#include "MPU9250.h" // an MPU9250 object with the MPU-9250 sensor on I2C bus 0 with address 0x68 MPU9250 IMU(Wire,0x68); int status; void setup() { // serial to display data Serial.begin(115200); while(!Serial) {} // start communication with IMU status = IMU.begin(); if (status < 0) { Serial.println("IMU initialization unsuccessful"); Serial.println("Check IMU wiring or try cycling power"); Serial.print("Status: "); Serial.println(status); while(1) {} } } void loop() { // read the sensor IMU.readSensor(); // display the data Serial.print(IMU.getAccelX_mss(),6); Serial.print("t"); Serial.print(IMU.getAccelY_mss(),6); Serial.print("t"); Serial.print(IMU.getAccelZ_mss(),6); Serial.print("t"); Serial.print(IMU.getGyroX_rads(),6); Serial.print("t"); Serial.print(IMU.getGyroY_rads(),6); Serial.print("t"); Serial.print(IMU.getGyroZ_rads(),6); Serial.print("t"); Serial.print(IMU.getMagX_uT(),6); Serial.print("t"); Serial.print(IMU.getMagY_uT(),6); Serial.print("t"); Serial.print(IMU.getMagZ_uT(),6); Serial.print("t"); Serial.println(IMU.getTemperature_C(),6); delay(100); }
Tài liệu tham khảo:
Video tham khảo: