Hi, and welcome
Before I start, I want to mention an important thing: I recently bought an Arduino module which is HMC5883L (GY-273) I tried it with its library but unfortunatley it doesn’t work, after some research on the internet I found out that they are actually QMC5883 modules.
How to know it’s a real HMC5883L:
-If you try after wiring it with arduino with i2c scanner you gonna find that the address is “0x1E“
-Or if you look on the chip itself it’s marked L883
How to know it’s a fake one:
-If you try after wiring it with arduino with i2c scanner you gonna find that the address is “0x0D” as i found out or something else
-Or if you look on the chip itself it’s marked DA5883
A picture I took from : https://www.reddit.com/r/AskElectronics/comments/5xo3md/problem_with_hmc5883l_magnetometer/
But actually it’s not a fake but it’s the QMC5883 which is a similar module but cheaper and not stable, and in this post I’m using one of them.
So the HMC5883L or QMC5883 are called digital compass, they are detecting the magnetic north and calculate the value comparing to it while moving, and they are very sensitive, but the cheap version which is QM5883 is more sensitive and difficult to calibrate.
While sensing the magnetic north the module can know in which direction its moving and comparing to which axis, this module has 3 axis (x, y and z) gives you three values and they change while moving, and they can be positive or negative depending on the orientation of your module, similar to the gyro that I interface it before: Interfacing L3G4200 triple axis gyro module with Arduino, but here we are detecting translating and movement, not tilting.
to not be confused I let the HMC5883L module in the wiring because the “fake” one is marked like the real one
For i2c scan:
i2c Scanner: Download here (it’s a separate code that uses “wire.h” library that you already have and it works with i2c devices)
For using the module:
Since the code I used is just an example of the library all you have to do after installing the library is to go to examples
(MechaQMC5883lmaster -> example -> raw)
Automation and Electrical Engineer, Electronics amateur trying to share my little projects.