Khác

GY87 IMU 10DOF MPU6050 + HMC5883L (QMC5883L) + BMP180

Mã sản phẩm: K1_62
Cảm biến GY-87 10DOF IMU MPU6050 + HMC5883L + BMP180 được sử dụng để đo 10 thông số: 3 trục Góc quay (Gyro), 3 trục gia tốc hướng (Accelerometer), 3 trục từ trường (Magnetometer) và áp suất không khí (Atmospheric Pressure) bằng cách kết hợp 3 loại cảm biến trên...
130,000₫
Hàng còn: 0
Số lượng
 
1
 
Tiêu đề
Thêm vào giỏ Mua ngay

Dịch vụ & Khuyến mãi

Giao miễn phí chuyển phát nhanh trong nội thành TPHCM đối với đơn hàng trên 1 triệu đồng

Giảm 5k cho đơn hàng trên 300k đồng

Giảm 10k cho đơn hàng trên 500k đồng

Giảm 15k hoặc freeship chuyển phát nhanh cho đơn hàng trên 1tr đồng

Giảm 25.000đ hoặc freeship cho đơn hàng trên 2tr đồng.

Chi tiết sản phẩm

Cảm biến GY-87 10DOF IMU MPU6050 + HMC5883L + BMP180 được sử dụng để đo 10 thông số: 3 trục Góc quay (Gyro), 3 trục gia tốc hướng (Accelerometer), 3 trục từ trường (Magnetometer) và áp suất không khí (Atmospheric Pressure) bằng cách kết hợp 3 loại cảm biến trên cùng 1 board mạch sử dụng giao tiếp I2C:

 

 

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
  • Kích thước: 22 x 17mm
  •  

SƠ ĐỒ KẾT NỐI GY 87 VỚI ARDUINO

 

 

 

 

 

 

LINK TẢI THƯ VIỆN 

THƯ VIỆN MPU6050

THƯ VIỆN HMC5883L (CHIP L883)

THƯ VIỆN BMP085 

THƯ VIỆN QMC5883L (CHIP HA5883)

THƯ VIỆN QMC5883P (CHIP HP5883)

 

CODE TEST GY - 87

#include "I2Cdev.h"

#include "MPU6050.h"

#include <Adafruit_BMP085.h>

#include <HMC5883L_Simple.h>

MPU6050 accelgyro;

Adafruit_BMP085 bmp;

HMC5883L_Simple Compass;

int16_t ax, ay, az;

int16_t gx, gy, gz;

#define LED_PIN 13

bool blinkState = false;

void setup() {

  Serial.begin(9600);

  Wire.begin();

  Serial.println("Initializing I2C devices...");

  if (!bmp.begin()) {

    Serial.println("Could not find a valid BMP085 sensor, check wiring!");

    while (1) {}

  }

  accelgyro.initialize();

  Serial.println(accelgyro.testConnection() ? "MPU6050 connection successful" : "MPU6050 connection failed");

  accelgyro.setI2CBypassEnabled(true); // set bypass mode for gateway to hmc5883L

  Compass.SetDeclination(23, 35, 'E');

  Compass.SetSamplingMode(COMPASS_SINGLE);

  Compass.SetScale(COMPASS_SCALE_130);

  Compass.SetOrientation(COMPASS_HORIZONTAL_X_NORTH);

  pinMode(LED_PIN, OUTPUT);

}

void loop() {

  Serial.print("Temperature = ");

  Serial.print(bmp.readTemperature());

  Serial.println(" *C");

  Serial.print("Pressure = ");

  Serial.print(bmp.readPressure());

  Serial.println(" Pa");

  Serial.print("Altitude = ");

  Serial.print(bmp.readAltitude());

  Serial.println(" meters");

  Serial.print("Pressure at sealevel (calculated) = ");

  Serial.print(bmp.readSealevelPressure());

  Serial.println(" Pa");

  Serial.print("Real altitude = ");

  Serial.print(bmp.readAltitude(101500));

  Serial.println(" meters");

  accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);

  Serial.print("a/g:\t");

  Serial.print(ax); Serial.print("\t");

  Serial.print(ay); Serial.print("\t");

  Serial.print(az); Serial.print("\t");

  Serial.print(gx); Serial.print("\t");

  Serial.print(gy); Serial.print("\t");

  Serial.println(gz);

  float heading = Compass.GetHeadingDegrees();

  Serial.print("Heading: \t");

  Serial.println( heading );

  blinkState = !blinkState;

  digitalWrite(LED_PIN, blinkState);

  delay(500);

}

 

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

CODE TEST ĐỊA CHỈ I2C TRÊN GY-87:

#include <Wire.h>

 

// Set I2C bus to use: Wire, Wire1, etc.

#define WIRE Wire

 

void setup() {

  WIRE.begin();

 

  Serial.begin(9600);

  while (!Serial)

    delay(10);

  Serial.println("\nI2C Scanner");

 

  // Enable bypass Mode for mpu6050

  Wire.beginTransmission(0x68);

  Wire.write(0x37);

  Wire.write(0x02);

  Wire.endTransmission();

 

  Wire.beginTransmission(0x68);

  Wire.write(0x6A);

  Wire.write(0x00);

  Wire.endTransmission();

 

  // Disable Sleep Mode

  Wire.beginTransmission(0x68);

  Wire.write(0x6B);

  Wire.write(0x00);

  Wire.endTransmission();

}


 

void loop() {

  byte error, address;

  int nDevices;

 

  Serial.println("Scanning...");

 

  nDevices = 0;

  for (address = 1; address < 127; address++) {

    // The i2c_scanner uses the return value of

    // the Write.endTransmisstion to see if

    // a device did acknowledge to the address.

    WIRE.beginTransmission(address);

    error = WIRE.endTransmission();

 

    if (error == 0) {

      Serial.print("I2C device found at address 0x");

      if (address < 16)

        Serial.print("0");

      Serial.print(address, HEX);

      Serial.println("  !");

 

      nDevices++;

    } else if (error == 4) {

      Serial.print("Unknown error at address 0x");

      if (address < 16)

        Serial.print("0");

      Serial.println(address, HEX);

    }

  }

  if (nDevices == 0)

    Serial.println("No I2C devices found\n");

  else

    Serial.println("done\n");

 

  delay(5000);  // wait 5 seconds for next scan

}

KẾT QUẢ SAU KHI TEST:

 

 

 

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

CODE TEST QMC5883L TRÊN GY-87:

 

 

 

/*

===============================================================================================================

QMC5883LCompass.h Library XYZ Example Sketch

Learn more at [https://github.com/mprograms/QMC5883LCompass]

 

This example shows how to get the XYZ values from the sensor.

 

===============================================================================================================

Release under the GNU General Public License v3

[https://www.gnu.org/licenses/gpl-3.0.en.html]

===============================================================================================================

*/

#include <QMC5883LCompass.h>

 

QMC5883LCompass compass;

 

void setup() {

  Serial.begin(9600);

  compass.init();

 

}

 

void loop() {

  int x, y, z;

 

  // Read compass values

  compass.read();

 

  // Return XYZ readings

  x = compass.getX();

  y = compass.getY();

  z = compass.getZ();

 

  Serial.print("X: ");

  Serial.print(x);

  Serial.print(" Y: ");

  Serial.print(y);

  Serial.print(" Z: ");

  Serial.print(z);

  Serial.println();

 

  delay(250);

}

 

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

 

CODE TEST MPU6050 TRÊN GY-87:

 

 

KẾT QUẢ SAU KHI TEST TRÊN GY87:

 

 

 

 

CODE  TEST  QMC5883P (HP5883) TRÊN GY87:

 

#include <Wire.h>

 

// QMC5883P的I2C地址

const int QMC5883P_ADDR = 0x2C;

 

// 控制寄存器地址

const int MODE_REG = 0x0A;

const int CONFIG_REG = 0x0B;

 

// 数据输出寄存器地址

const int X_LSB_REG = 0x01;

const int X_MSB_REG = 0x02;

const int Y_LSB_REG = 0x03;

const int Y_MSB_REG = 0x04;

const int Z_LSB_REG = 0x05;

const int Z_MSB_REG = 0x06;

 

// 状态寄存器地址

const int STATUS_REG = 0x09;

 

// 初始化QMC5883P

void initQMC5883P() {

  Wire.begin();

  // 设置为连续测量模式,数据输出速率为200Hz,量程为±8G

  Wire.beginTransmission(QMC5883P_ADDR);

  Wire.write(MODE_REG);

  Wire.write(0xCF); // 0xCF: 连续模式, 200Hz数据输出速率

  Wire.endTransmission();

 

  Wire.beginTransmission(QMC5883P_ADDR);

  Wire.write(CONFIG_REG);

  Wire.write(0x08); // 0x08: 设置Set/Reset模式为开启,量程为±8G

  Wire.endTransmission();

}

 

// 读取QMC5883P的原始数据

void readQMC5883PData(int16_t& x, int16_t& y, int16_t& z) {

  Wire.beginTransmission(QMC5883P_ADDR);

  Wire.write(X_LSB_REG);

  Wire.endTransmission(false);

  Wire.requestFrom(QMC5883P_ADDR, 6);

 

  if (Wire.available() == 6) {

    byte x_lsb = Wire.read();

    byte x_msb = Wire.read();

    byte y_lsb = Wire.read();

    byte y_msb = Wire.read();

    byte z_lsb = Wire.read();

    byte z_msb = Wire.read();

 

    x = (x_msb << 8) | x_lsb;

    y = (y_msb << 8) | y_lsb;

    z = (z_msb << 8) | z_lsb;

  }

}

 

void setup() {

  Serial.begin(9600);

  initQMC5883P();

}

 

void loop() {

  int16_t x, y, z;

  readQMC5883PData(x, y, z);

 

  Serial.print("X: ");

  Serial.print(x);

  Serial.print("\tY: ");

  Serial.print(y);

  Serial.print("\tZ: ");

  Serial.println(z);

 

  delay(100);

}

Bình luận

Không có sản phẩm nào trong giỏ hàng của bạn

Không có sản phẩm nào trong giỏ hàng của bạn

LINH KIỆN ĐIỆN TỬ ĐỨC HUY (29A BÙI XUÂN PHÁI)
Hotline 0942954739
LINH KIỆN ĐIỆN TỬ ĐỨC HUY (29A BÙI XUÂN PHÁI)