Khác

HMC5883L GY-273 Cảm biến la bàn số (từ kế)

Mã sản phẩm: Chưa rõ
+ Cảm biến la bàn số HMC5883L có kích thước nhỏ gọn sử dụng giao tiếp I2C, được dùng để đo từ trường của trái đất nhằm xác định phương hướng với độ chính xác lên đến 1 hoặc 2 độ, cảm biến có cách đo riêng biệt cho từng...
62,000₫
Số lượng
 
1
 
Thêm vào giỏ Mua ngay

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

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

Tặng ngay 50.000đ cho đơn hàng trên 2 triệu đồng

Chi tiết sản phẩm

+ Cảm biến la bàn số HMC5883L có kích thước nhỏ gọn sử dụng giao tiếp I2C, được dùng để đo từ trường của trái đất nhằm xác định phương hướng với độ chính xác lên đến 1 hoặc 2 độ, cảm biến có cách đo riêng biệt cho từng trục và có thể kết hợp lại để tính toán 3D.

+ Cảm biến la bàn số HMC5883L  còn có thể dùng để đo từ trường thô hoặc các nguồn từ trường mạnh hơn gần nó, cảm biến có thể cảm nhận được nguồn từ trường xung quanh nó như của nam châm hoặc điện trường, khi phát hiện được từ trường từ bên ngoài, nó có thể xác định được khoảng cách tương đối hoặc chiều đến vật phát ra từ trường đó.

THÔNG SỐ KỸ THUẬT:

+ Điện áp hoạt động: 5V

+ Độ phân giải: 2mm gauss ở từ trường ±8g

+ Giao tiếp: I2C 160Hz ở chế độ fast

+ Độ chính xác: 1º - 2º

+ Xử lý dữ liệu bộ ADC 12 bit, xử lý chống nhiễu tốt.

SƠ ĐỒ ĐẤU NỐI HMC5883L VÀ ARDUINO:

CÀI ĐẶT THƯ VIỆN CHO ARDUINO: Hãy liên hệ với chúng tôi để được cung cấp thư viện.

THAM KHẢO CODE ARDUINO GIAO TIẾP HMC5883L:

#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_HMC5883_U.h>

/* Assign a unique ID to this sensor at the same time */
Adafruit_HMC5883_Unified mag = Adafruit_HMC5883_Unified(12345);

void displaySensorDetails(void)
{
  sensor_t sensor;
  mag.getSensor(&sensor);
  Serial.println("------------------------------------");
  Serial.print  ("Sensor:       "); Serial.println(sensor.name);
  Serial.print  ("Driver Ver:   "); Serial.println(sensor.version);
  Serial.print  ("Unique ID:    "); Serial.println(sensor.sensor_id);
  Serial.print  ("Max Value:    "); Serial.print(sensor.max_value); Serial.println(" uT");
  Serial.print  ("Min Value:    "); Serial.print(sensor.min_value); Serial.println(" uT");
  Serial.print  ("Resolution:   "); Serial.print(sensor.resolution); Serial.println(" uT");  
  Serial.println("------------------------------------");
  Serial.println("");
  delay(500);
}

void setup(void) 
{
  Serial.begin(9600);
  Serial.println("HMC5883 Magnetometer Test"); Serial.println("");
  
  /* Initialise the sensor */
  if(!mag.begin())
  {
    /* There was a problem detecting the HMC5883 ... check your connections */
    Serial.println("Ooops, no HMC5883 detected ... Check your wiring!");
    while(1);
  }
  
  /* Display some basic information on this sensor */
  displaySensorDetails();
}

void loop(void) 
{
  /* Get a new sensor event */ 
  sensors_event_t event; 
  mag.getEvent(&event);
 
  /* Display the results (magnetic vector values are in micro-Tesla (uT)) */
  Serial.print("X: "); Serial.print(event.magnetic.x); Serial.print("  ");
  Serial.print("Y: "); Serial.print(event.magnetic.y); Serial.print("  ");
  Serial.print("Z: "); Serial.print(event.magnetic.z); Serial.print("  ");Serial.println("uT");

  // Hold the module so that Z is pointing 'up' and you can measure the heading with x&y
  // Calculate heading when the magnetometer is level, then correct for signs of axis.
  float heading = atan2(event.magnetic.y, event.magnetic.x);
  
  // Once you have your heading, you must then add your 'Declination Angle', which is the 'Error' of the magnetic field in your location.
  // Find yours here: http://www.magnetic-declination.com/
  // Mine is: -13* 2' W, which is ~13 Degrees, or (which we need) 0.22 radians
  // If you cannot find your Declination, comment out these two lines, your compass will be slightly off.
  float declinationAngle = 0.22;
  heading += declinationAngle;
  
  // Correct for when signs are reversed.
  if(heading < 0)
    heading += 2*PI;
    
  // Check for wrap due to addition of declination.
  if(heading > 2*PI)
    heading -= 2*PI;
   
  // Convert radians to degrees for readability.
  float headingDegrees = heading * 180/M_PI; 
  
  Serial.print("Heading (degrees): "); Serial.println(headingDegrees);
  
  delay(500);
}

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

Cửa hàng linh kiện điện tử Đức Huy
Cửa hàng linh kiện điện tử Đức Huy