Hello, 

In this article, we are going to learn more about interfacing the magnetometer GY-273 with Arduino.

Hardware Required

Software Required

GY-273 Magnetometer

  • GY-273 is a 3-axis magnetic compass that is used to measure the magnetization of various magnetic materials. It can also be used to measure the intensity of a magnetic field.
  • This module converts any said magnetic field into a voltage output on 3-axis. This voltage shift is the raw digital output value, which is then reverse-engineered to calculate the values of magnetic fields coming from different directions. 
  • Magnetometer GY-273 measures the orientation and magnitude of the Earth’s magnetic field and hence is used for low-cost compassing and magnetometry.
  • Earth's magnetic fields along the X, Y, Z-axis can be found using this sensor. 
  • This module uses an I2C communication interface.

Specifications

  • Power Supply required: 3 to 5V.
  • Input/Output Voltage required: 3 to 5V.
  • Communication: Standard I2C protocol.
  • Measuring Range: - 8 to + 8 Gauss.
  • 1 to 2 Degree heading accuracy. 

Pin-out of GY-273 Magnetometer

  • VCC pin: This pin is used for the power supply. 
  • GND pin: This pin is used for ground.
  • SCL pin: This pin is used to maintain the serial clock during the I2C communication protocol.
  • SDA pin: This pin is used for the input or output transfer of data during the I2C communication protocol. 
  • DRDY pin: This pin is called the Data Ready Interrupt pin. 

Interfacing with Arduino board

Pins on Arduino board

Pins on GY-273

5V

VCC

GND

GND

SDA/A4

SDA

SCL/A5

SCL

Arduino Code

  • During interfacing with Arduino, we are going to use the code to find out the direction of the heading using the GY-273 magnetometer module. 

  • Upload the code to the Arduino board. Now open the Serial Monitor. You will see the direction of the Heading on the Serial monitor. As you change the orientation of the sensor, the direction also changes. 

  • I hope you learned something about magnetometers from this article and I hope you enjoyed it. Thank you.