Using a magnetometer with Arduino Uno

Hello everyone

I am having an issue with my QMC5883L Magnetometer. I have tried various different example codes with their corresponding libraries, trying to get an x y z value. However all i see in my serial monitor is either X: 0 Y: 0 Z: 0 or X: -1 Y: -1 Z: -1.

Wiring:
VCC ---- 3.3V
GND ---- GND
SCL ---- A5
SDA ---- A4

I ran the example code for x y z data from this library: GitHub - mechasolution/Mecha_QMC5883L: Arduino lib for QMC5883 6

Does anyone have any idea what could be wrong?

Thanks

Run the I2C address scanner program to test communications.

Does this board have level conversion hardware for the I2C lines?

I got this:

I2C Scanner
Scanning...
I2C device found at address 0x1E !
done

so it seems to be connected

DEBO_SENS_MFELD_02

I think it does, i couldn't find a datasheet of my magnetometer but on the website i purchased it it says i can supply 3...5V.

1E is not the correct I2C address. The library you are using assumes a different one.

Ah yes i see what you mean. It seems to be using 0x0D. Is there a way to change this?

Of course you can change the library code to use a different I2C address, but the real question is: what sort of chip is on that board? Is it a magnetometer?

Any of those cheap boards from China is very likely to be made from reject, counterfeit or mislabeled parts.

Example: a bunch of "ATmega328 chips" that were something else entirely. And that was 11 years ago!

Alright i got it! Still very confused because apparently i have an hmc58853l and i thought that was the better one so no idea why i bought it labeled as qmc... i finally got it to work and only needed wire.h. Thanks a lot for your help!

Glad to hear you figured it out. The HMC5883 is better than the QMC5883, but it was discontinued several years ago, and magnetometers have improved substantially since then.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.