Skip to Content
Circuitera

HMC5883L three-axis magnetometer

Read magnetic axes with a genuine HMC5883L, calibrate locally and distinguish it from incompatible look-alike compass modules.

HMC5883L three-axis magnetometer photograph
Digital Compass sensor.jpg by Ctg4Rahat · CC BY 3.0. Resized and encoded as WebP without cropping.

Compass measurements

The chip measures magnetic field components. To estimate heading while the board is tilted, combine the magnetic data with an independent tilt measurement and use the correct axis convention.

Source: Honeywell

Bus and register checks

Read the identification registers before assuming the HMC5883L register map applies. Use the published order of the output registers: X, Z and then Y.

Source: Honeywell

Calibration and interference

Collect readings in several orientations to estimate offsets and distortion. Keep the sensor away from high-current wiring and magnetic hardware. A heading that follows motor operation is a sign to inspect placement and magnetic interference.

Source: Honeywell

Specifications

ParameterValue or conditionSource
I²C addressing0x1E as a seven-bit addressHoneywell
Sensor outputThree magnetic axes with programmable gainHoneywell

Compatibility and practice

Confirm chip identity and address before choosing a library; board labels are sometimes misleading.

Sources and datasheets