에듀이노-아두이노 전문 교육쇼핑몰 에듀이노-코딩교육 전문 쇼핑몰
뒤로가기

묻고답하기

제목

GY-801 기술문의

작성자 CS / 배송(ip:)

작성일 2019-12-10

조회 20

평점 0점  

추천 추천하기

내용
안녕하세요 에듀이노입니다.
문의해주신 내용을 검토해보노 결과, 교환접수를 통해 테스트를 진행 해봐야할 것으로 보입니다.
하지만 한가지 우려되는 상황은 라즈베리파이에서 아두이노를 사용하는 것에대한 정보를 정확하게 파악할 수가 없어, 그 부분에 대한 판단이 어려운점 양해바랍니다.
결선상태 및 사용환경을 다시 한번 확인해 주시기 바라며, 지속적으로 동일한 문제가 발생할 경우, 교환접수를 통해 교환을 도와드리겠습니다.
감사합니다.

[ Original Message ]
GY-801 에 포함되어있는 HMC5883L 센서가 인식을 못하고 있습니다.

현재까지 4개의 제품으로 테스트를 해보았고 모두 동일하게 인식이 되지 않았습니다.

좀 더 확인해본결과 HMC5883L.h의 경우 address를 0x1E 로 설정되어있음과 달리 실제로 i2c 확인한 결과 0x30 으로 인식을 합니다. 그래서 단순히 헤더파일을 수정하면 원하던 값이 나오지 않습니다.


코트는
#include "Wire.h"

// I2Cdev and ADXL345 must be installed as libraries, or else the .cpp/.h files
// for both classes must be in the include path of your project
#include "I2Cdev.h"
#include "ADXL345.h"
#include "L3G4200D.h"
#include "BMP085.h"
#include "HMC5883L.h"

// accel
ADXL345 accel;
int16_t ax, ay, az;

// gyro
L3G4200D gyro;
int16_t avx, avy, avz;

// baro
BMP085 baro;
float temperature;
float pressure;
float altitude;
int32_t lastMicros;

// magneto
HMC5883L mag;
int16_t mx, my, mz;

#define LED_PIN 0 // (Arduino is 13, Teensy is 6)
bool blinkState = false;

void setup() {
    // join I2C bus (I2Cdev library doesn't do this automatically)
    Wire.begin();

    // initialize serial communication
    Serial.begin(9600);

    // initialize device
    Serial.println("Initializing I2C devices...");
    accel.initialize();
    gyro.initialize();
    baro.initialize();
    mag.initialize();

    // verify connection
    Serial.println("Testing device connections...");
    Serial.println(accel.testConnection() ? "ADXL345 connection successful" : "ADXL345 connection failed");
    Serial.println(gyro.testConnection() ? "L3G4200D connection successful" : "L3G4200D connection failed");
    Serial.println(baro.testConnection() ? "BMP085 connection successful" : "BMP085 connection failed");
    Serial.println(mag.testConnection() ? "HMC5883L connection successful" : "HMC5883L connection failed");

    // configure LED for output
    pinMode(LED_PIN, OUTPUT);

    gyro.setFullScale(2000);
}

void loop() {

    accelerometer();
    gyroscope();
    barometer();
    // blink LED to indicate activity
    blinkState = !blinkState;
    digitalWrite(LED_PIN, blinkState);

    // delay 100 msec to allow visually parsing blink and any serial output
    delay(1000);
}

void accelerometer(){
    // read raw accel measurements from device
    accel.getAcceleration(&ax, &ay, &az);

    // display tab-separated accel x/y/z values
    Serial.print("accel:\t");
    Serial.print(ax); Serial.print("\t");
    Serial.print(ay); Serial.print("\t");
    Serial.println(az);
}

void gyroscope(){
    gyro.getAngularVelocity(&avx, &avy, &avz);

    Serial.print("angular velocity:\t");
    Serial.print(avx); Serial.print("\t");
    Serial.print(avy); Serial.print("\t");
    Serial.println(avz);  
}

void barometer(){
    // request temperature
    baro.setControl(BMP085_MODE_TEMPERATURE);

    // wait appropriate time for conversion (4.5ms delay)
    lastMicros = micros();
    while (micros() - lastMicros < baro.getMeasureDelayMicroseconds());

    // read calibrated temperature value in degrees Celsius
    temperature = baro.getTemperatureC();

    // request pressure (3x oversampling mode, high detail, 23.5ms delay)
    baro.setControl(BMP085_MODE_PRESSURE_3);
    while (micros() - lastMicros < baro.getMeasureDelayMicroseconds());

    // read calibrated pressure value in Pascals (Pa)
    pressure = baro.getPressure();

    // calculate absolute altitude in meters based on known pressure
    // (may pass a second "sea level pressure" parameter here,
    // otherwise uses the standard value of 101325 Pa)
    altitude = baro.getAltitude(pressure);

    // display measured values if appropriate
    Serial.print("T/P/A\t");
    Serial.print(temperature); Serial.print("\t");
    Serial.print(pressure); Serial.print("\t");
    Serial.print(altitude);
    Serial.println("");
}

void magneto(){
   // read raw heading measurements from device
    mag.getHeading(&mx, &my, &mz);

    // display tab-separated gyro x/y/z values
    Serial.print("mag:\t");
    Serial.print(mx); Serial.print("\t");
    Serial.print(my); Serial.print("\t");
    Serial.print(mz); Serial.print("\t");

    // To calculate heading in degrees. 0 degree indicates North
    float heading = atan2(my, mx);
    if(heading < 0)
      heading += 2 * M_PI;
    Serial.print("heading:\t");
    Serial.println(heading * 180/M_PI);
}

입니다.

첨부파일

비밀번호
수정

비밀번호 입력후 수정 혹은 삭제해주세요.

댓글목록

등록된 댓글이 없습니다.

댓글 수정

이름

비밀번호

내용

/ byte

수정 취소

비밀번호 :

확인 취소

댓글 입력

이름

비밀번호

내용

/ byte

평점

왼쪽의 문자를 공백없이 입력하세요.

에게만 댓글 작성 권한이 있습니다.

댓글 입력

이름

비밀번호

내용

/ byte

왼쪽의 문자를 공백없이 입력하세요.

에게만 댓글 작성 권한이 있습니다.

관련 글 보기

고객센터

    1670-9626

  • 팩스.063-902-6678
  • 이메일.eduino@robodyne.co.kr
  • Kakao. 에듀이노
  • 운영시간 : AM 10:00 ~ PM 16:30
  • 점심시간 : PM 12:00 - PM 13:00 토/일/공휴일 휴무
  • 고객센터 연결하기
입금계좌
  • 예금주: (주)로보다인시스템
  • 국민. 754801-01-760296
  • 농협. 301-0234-1423-01
  • IBK기업은행. 506-080015-01-016
배송 안내
  • 배송 방법 : 택배
  • 배송 지역 : 전국지역
  • 배송 비용 : 조건부 무료 : 주문 금액 50,000원 미만일 때 배송비 3,000원을 추가합니다.
  • 배송 기간 : 1일 ~ 2일
  • 배송 안내 :
    - 제주도, 산간벽지나 도서지방은 별도의 추가금액을 지불하셔야 하는 경우가 있습니다.
    고객님께서 주문하신 상품은 입금 확인후 배송해 드립니다. 다만, 상품종류에 따라서 상품의 배송이 다소 지연될 수 있습니다.
교환/반품 안내
교환 및 반품이 가능한 경우
- 상품을 공급 받으신 날로부터 7일이내 단, 가전제품의
  경우 포장을 개봉하였거나 포장이 훼손되어 상품가치가 상실된 경우에는 교환/반품이 불가능합니다.
- 공급받으신 상품 및 용역의 내용이 표시.광고 내용과
  다르거나 다르게 이행된 경우에는 공급받은 날로부터 3월이내, 그사실을 알게 된 날로부터 30일이내

교환 및 반품이 불가능한 경우
- 고객님의 책임 있는 사유로 상품등이 멸실 또는 훼손된 경우. 단, 상품의 내용을 확인하기 위하여
  포장 등을 훼손한 경우는 제외
- 포장을 개봉하였거나 포장이 훼손되어 상품가치가 상실된 경우
  (예 : 가전제품, 식품, 음반 등, 단 액정화면이 부착된 노트북, LCD모니터, 디지털 카메라 등의 불량화소에
  따른 반품/교환은 제조사 기준에 따릅니다.)
- 고객님의 사용 또는 일부 소비에 의하여 상품의 가치가 현저히 감소한 경우 단, 화장품등의 경우 시용제품을
  제공한 경우에 한 합니다.
- 시간의 경과에 의하여 재판매가 곤란할 정도로 상품등의 가치가 현저히 감소한 경우
- 복제가 가능한 상품등의 포장을 훼손한 경우
  (자세한 내용은 고객만족센터 1:1 E-MAIL상담을 이용해 주시기 바랍니다.)

※ 고객님의 마음이 바뀌어 교환, 반품을 하실 경우 상품반송 비용은 고객님께서 부담하셔야 합니다.
  (색상 교환, 사이즈 교환 등 포함)
«
»