QMC5883 usable library

I tried some from Github but some of them sometimes will hang up my Arduino program. Could anyone help to provide one usable and effective QMC5883 library? Thanks

Is it the library that fails or is it the sketch?

Can you post your sketch and a link to the library used so we can verify ?

wheetlyshi:
I tried some from Github but some of them sometimes will hang up my Arduino program. Could anyone help to provide one usable and effective QMC5883 library? Thanks

Hey were you able to get this working? I've got this library here, and its working, but its giving stupid answers. Or maybe my understanding of compass is stupid. Nevertheless here's the code:

#include <Wire.h>
#include <MechaQMC5883.h>
#include <HMC5883L.h>

MechaQMC5883 qmc;

// Record any errors that may occur in the compass.
int error = 0;

void setup() {
  Wire.begin();
  Serial.begin(9600);
  qmc.init();
  //qmc.setMode(Mode_Continuous,ODR_200Hz,RNG_2G,OSR_256);
}

void loop() {
  int x,y,z;
  qmc.read(&x,&y,&z);

  Serial.print("x: ");
  Serial.print(x);
  Serial.print(" y: ");
  Serial.print(y);
  Serial.print(" z: ");
  Serial.print(z);
  Serial.println();
  delay(1000);
}

And the result:

x: -516 y: -2453 z: 748
x: -548 y: -2761 z: 162
x: -573 y: -2820 z: 7
x: -633 y: -2950 z: 45
x: -461 y: -2745 z: 175
x: -506 y: -2662 z: 187
x: -358 y: -2477 z: 71
x: 110 y: -1202 z: 1256
x: 127 y: -1222 z: 1320
x: -491 y: -2800 z: 185
x: -496 y: -2807 z: 172

At least it changes, but I'm sure there is someone who is much more knowledgable in programming and compass reading could tell me what to do? I've been reading HMC's tutorial and I kind of understand about Gaussian values and what not, but I'm not even sure where to begin with this module.

Its sad that I ordered an HMC but got a QMC, but I'm out of budget and need to get this working. Any help?

High Regards

Don't know if still relevant. I'm using the lib from here: GitHub - dthain/QMC5883L: Driver for QMC5883L chip found in many GY-271 boards. and it works for me as far as i tested.

fayzanhr:
Its sad that I ordered an HMC but got a QMC, but I'm out of budget and need to get this working. Any help?

<-- I made exactly the same experience.

HMCs are being discontinued, I believe. Hence, the offloading of QMCs to unwary buyers will persist for a few months. Having used both I must confess that there should be a warning label about using a suitable I2C scanner before embarking on testing these sensors. The addresses of the sensors are 0x1E and 0x0D respectively.

Regards.

baqwas:
HMCs are being discontinued, I believe. Hence, the offloading of QMCs to unwary buyers will persist for a few months. Having used both I must confess that there should be a warning label about using a suitable I2C scanner before embarking on testing these sensors. The addresses of the sensors are 0x1E and 0x0D respectively.

Regards.

ive run the i2u scan. I run it on my Arduino mega. but still cant detect that sensor. SCL= pin 20, SDA= pin21