Blog

GY-271 HMC5883L Triple Axis Magnetometer Sensor Module

GY-271 HMC5883L Triple Axis Magnetometer

High-Sensitivity Digital Compass Module for Arduino Projects

Introduction

The GY-271 HMC5883L is a 3-axis digital compass module featuring the Honeywell HMC5883L magnetometer IC. With 1° to 2° heading accuracy and a resolution up to 5 milli-gauss, it’s ideal for navigation systems, robotics, and orientation detection applications.

HMC5883L Module

Key Features

🧭 Triple Axis

Measures X, Y, Z magnetic fields simultaneously

📡 High Sensitivity

1-2 milli-gauss resolution (up to 8 Gauss range)

🔋 Low Power

100μA operation current (0.5μA standby)

🔌 I2C Interface

Standard digital output (3.3V or 5V compatible)

Technical Specifications

Measurement Range ±1.3 to ±8.1 Gauss (selectable)
Resolution 0.73 to 4.35 milli-gauss (depending on range)
Update Rate Up to 160Hz
Supply Voltage 2.16V to 3.6V (5V tolerant I/O)
I2C Address 0x1E (fixed)
Accuracy 1°-2° heading (typical)

Pin Configuration

HMC5883L Pinout
Pin Label Description Arduino Connection
1 VCC Power (3.3V recommended) 3.3V
2 GND Ground GND
3 SCL I2C Clock A5 (Uno) or SCL
4 SDA I2C Data A4 (Uno) or SDA
5 DRDY Data Ready (Optional) Any digital pin
Important: Requires 3.3V power (use voltage regulator if needed)

Wiring Diagram (Arduino Uno)

Basic Compass Example

Library Required: Install “Adafruit HMC5883 Unified” via Arduino Library Manager

Advanced Configuration

Measurement Range

Data Rate

Measurement Mode

Calibration

Troubleshooting

No Device Detected

  • Verify I2C connections (SDA/SCL)
  • Check with I2C scanner sketch
  • Confirm 3.3V power supply

Incorrect Readings

  • Keep away from magnetic sources (motors, speakers)
  • Perform hard/soft iron calibration
  • Set proper declination for your location

Erratic Values

  • Add 0.1μF decoupling capacitor near VCC
  • Ensure stable power supply
  • Check for electromagnetic interference