The GY-273 module is based on the Honeywell HMC5883L IC for low-field magnetic sensing with a digital interface for applications such as lowcost compassing and magnetometry. The HMC5883L includes state-of-theart, high-resolution HMC118X series magneto-resistive sensors plus an ASIC containing amplification, automatic degaussing strap drivers, offset cancellation,
and a 12-bit ADC that enables 1° to 2° compass heading accuracy. The I2C serial bus allows for easy interface.
The HMC5883L utilizes Honeywell’s Anisotropic Magnetoresistive (AMR) technology that provides advantages over other
magnetic sensor technologies. These anisotropic, directional sensors feature precision in-axis sensitivity and linearity.
These sensors’ solid-state construction with very low cross-axis sensitivity is designed to measure both the direction and
the magnitude of Earth’s magnetic fields, from milli-gauss to 8 gauss. Honeywell’s Magnetic Sensors are among the most
sensitive and reliable low-field sensors in the industry.
HMC5883L module (three-axis magnetic field module)
Module Power supply : 3-5v
Communication: IIC communication protocol
Measuring range: ± 1.3-8 gauss
Size: 13.9 * 18.5
Example Arduino Sketch:
/* FILE: ARD_HMC5803L_GY273_Example
This is an example of how to use the Hobby Components GY-273 module (HCMODU0036) which
uses a Honeywell HMC5883L 3-Axis Digital Compass IC. The IC uses an I2C interface to
communicate which is compatible with the standard Arduino Wire library.
This example demonstrates how to initialise and read the module in single shot
measurement mode. It will continually trigger single measurements and output the
results for the 3 axis to the serial port.
You may copy, alter and reuse this code in any way you like, but please leave
reference to HobbyComponents.com in your comments if you redistribute this code.
This software may not be used for the purpose of promoting or selling products
that directly compete with Hobby Components Ltd's own range of products.
THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE.
HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES,
INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY
REASON WHATSOEVER. */
/* Include the standard Wire library */
/* The I2C address of the module */
#define HMC5803L_Address 0x1E
/* Register address for the X Y and Z data */
#define X 3
#define Y 7
#define Z 5
/* Initialise the Wire library */
/* Initialise the module */
/* Read each sensor axis data and output to the serial port */
/* Wait a little before reading again */
/* This function will initialise the module and only needs to be run once
after the module is first powered up or reset */
/* Set the module to 8x averaging and 15Hz measurement rate */
/* Set a gain of 5 */
/* This function will read once from one of the 3 axis data registers
and return the 16 bit signed result. */
int HMC5803L_Read(byte Axis)
/* Initiate a single measurement */
/* Move modules the resiger pointer to one of the axis data registers */
/* Read the data from registers (there are two 8 bit registers for each axis) */
Result = Wire.read() << 8;
Result |= Wire.read();