GY-271 QMC5883L CHN Chip 3-Axis Digital Compass Module – 3V-5V I2C Magnetic Field Sensor for Arduino

SKU: FA2166-0
Sensor Chip

QMC5883L (CHN)

Axes

3-axis (X, Y, Z)

ADC Resolution

16-bit

Measurement Range

±2 Gauss to ±8 Gauss (user selectable)

Interface

I2C (address 0x0D)

Supply Voltage

3V – 5V DC (onboard regulator)

Operating Temperature

-40°C to +85°C

Module Dimensions

Approx. 16 × 16 mm

The GY-271 QMC5883L 3-Axis Digital Compass Module is a compact, high-sensitivity magnetic field sensor designed for compass heading, orientation detection, and magnetic field measurement applications. Built around the QMC5883L chip (CHN version), this module is a popular and cost-effective alternative to the older HMC5883L, offering improved performance and wider availability. It is ideal for Arduino projects, robotics, navigation systems, and DIY electronics.

At the heart of the module is the QMC5883L, a 3-axis magnetic sensor with 16-bit ADC resolution that measures magnetic fields across three axes (X, Y, Z). The sensor provides ±2 Gauss to ±8 Gauss user-selectable measurement ranges, making it suitable for both weak and strong magnetic field environments. The I2C digital interface simplifies connection to microcontrollers, requiring only two data lines (SDA, SCL) plus power and ground.

The QMC5883L features built-in signal processing including self-test, temperature compensation, and offset cancellation, ensuring stable and accurate readings across temperature variations. The module includes onboard voltage regulation and level shifting, allowing it to operate from 3V to 5V supplies — making it directly compatible with both 3.3V and 5V microcontrollers like Arduino Uno, ESP32, and STM32.

The GY-271 module breaks out the QMC5883L chip onto a compact PCB with a standard pin header for easy connection to breadboards and jumper wires. The board includes onboard pull-up resistors for the I2C bus and a 3.3V regulator for reliable operation. The module measures approximately 16 × 16 mm.

Supported development environments include Arduino IDE (with the QMC5883L library by MPrograms or similar), ESP-IDF, and MicroPython. The module is widely used for compass heading, tilt compensation (when combined with an accelerometer), magnetic field detection, and position sensing.

Whether you are building a robot with navigation capabilities, a handheld compass, a metal detector, or an orientation-aware device, the GY-271 QMC5883L provides a reliable, cost-effective foundation for magnetic sensing. It is suitable for individual makers, students, and businesses purchasing in bulk for product development or educational programs.


Features

  • QMC5883L 3-axis magnetic sensor — Measures magnetic fields in X, Y, and Z axes

  • 16-bit ADC resolution — High-resolution magnetic field measurement

  • User-selectable ranges — ±2 Gauss to ±8 Gauss measurement ranges

  • I2C digital interface — Simple connection with only two data lines

  • Wide supply voltage — 3V to 5V operation with onboard regulation and level shifting

  • Built-in signal processing — Self-test, temperature compensation, and offset cancellation

  • Compact module form factor — 16 × 16 mm with standard pin header

  • Onboard pull-up resistors — For reliable I2C communication

  • Wide library support — Compatible with QMC5883L Arduino libraries

  • Direct replacement for HMC5883L — Popular alternative with improved availability


Technical Specifications 

# Parameter Specification
1 Sensor Chip QMC5883L (CHN)
2 Axes 3-axis (X, Y, Z)
3 ADC Resolution 16-bit
4 Measurement Range ±2 Gauss to ±8 Gauss (user selectable)
5 Interface I2C (address 0x0D)
6 Supply Voltage 3V – 5V DC (onboard regulator)
7 Operating Temperature -40°C to +85°C
8 Module Dimensions Approx. 16 × 16 mm

Usage

Getting Started

  1. Connect power — Supply 3V to 5V to the VCC pin and GND to ground.

  2. Connect I2C lines — Connect SDA to your microcontroller’s I2C data line and SCL to the I2C clock line.

    • Arduino Uno: SDA → A4, SCL → A5

    • ESP32: SDA → GPIO21, SCL → GPIO22 (default)

    • ESP8266: SDA → D2, SCL → D1

  3. Install the library — Install the QMC5883L library (by MPrograms or similar) through the Arduino Library Manager.

  4. Verify communication — Run an I2C scanner sketch to confirm the module’s address (typically 0x0D).

  5. Upload a test sketch — Use a basic example to read magnetic field values on the X, Y, and Z axes. Calculate heading using atan2(Y, X).

Pin Connections

Module Pin Function Arduino Uno ESP32 ESP8266
VCC Power 5V or 3.3V 3.3V 3.3V
GND Ground GND GND GND
SDA I2C Data A4 GPIO21 D2
SCL I2C Clock A5 GPIO22 D1

Calibration Notes

For accurate compass heading, the QMC5883L should be calibrated to compensate for hard-iron and soft-iron magnetic distortions. The common approach involves rotating the sensor through all orientations and recording min/max values for each axis, then applying offset and scale corrections in your code.

Typical Applications

  • Compass heading — Determine direction relative to magnetic north

  • Robotics navigation — Provide heading reference for mobile robots

  • Tilt-compensated compass — Combine with accelerometer for accurate heading at any orientation

  • Magnetic field detection — Detect presence of magnetic materials or fields

  • Position sensing — Use magnetic field changes to detect proximity or movement

  • Educational projects — Teaching magnetic sensing and I2C communication

Notes for Business Buyers

  • Cost-effective alternative — QMC5883L provides similar performance to HMC5883L at a lower cost.

  • Wide voltage compatibility — Onboard regulation and level shifting simplify integration with 3.3V and 5V systems.

  • Proven technology — QMC5883L is widely adopted with extensive documentation and community support.

  • Suitable for bulk purchasing — Ideal for product development, educational kits, and commercial deployments.

Q: What is the GY-271 QMC5883L module used for?

It is a 3-axis digital compass module for compass heading, orientation detection, magnetic field measurement, and navigation applications in Arduino and microcontroller projects.

Q: Is the QMC5883L compatible with HMC5883L libraries?

Not directly. The QMC5883L uses a different register map and I2C address (0x0D vs. 0x1E for HMC5883L). Use a dedicated QMC5883L library for proper operation.

Q: What is the I2C address of this module?

The default I2C address is 0x0D.

Q: What is the measurement range?

The module supports ±2 Gauss to ±8 Gauss user-selectable measurement ranges.

Q: What voltage does the module require?

It operates from 3V to 5V thanks to its onboard voltage regulator and level shifting.

Q: How do I calculate compass heading?

Use the formula heading = atan2(Y, X) where Y and X are the magnetic field readings. Convert the result to degrees and adjust for declination if needed.

Q: Does the module require calibration?

Yes. For accurate compass heading, the QMC5883L should be calibrated to compensate for magnetic distortions in your environment.

Q: Can I use this module with an ESP32?

Yes. Connect SDA to GPIO21 and SCL to GPIO22 (default I2C pins), and use a QMC5883L library.

Q: What is the difference between QMC5883L and HMC5883L?

The QMC5883L is a newer, more readily available chip that offers similar functionality to the HMC5883L. They use different I2C addresses and register maps, so software is not directly interchangeable.

Q: Can I purchase in bulk for a product development project?

Yes. This module is suitable for both individual users and business purchasing, including product development, educational programs, and commercial deployments.