The GY-273 is a 3-axis digital compass module based on the HMC5883L sensor. It is designed to measure magnetic fields and determine orientation, making it an essential component in navigation systems, robotics, and various other applications requiring precise directional data. The module communicates via the I2C interface, making it easy to integrate with microcontrollers such as the Arduino UNO.
Parameter | Value |
---|---|
Operating Voltage | 3.3V to 5V |
Operating Current | 100 µA |
Communication | I2C |
Measurement Range | ±1.3 to ±8 Gauss |
Resolution | 160 to 1370 LSB/Gauss |
Dimensions | 14mm x 13mm x 3.5mm |
Pin | Name | Description |
---|---|---|
1 | VCC | Power supply (3.3V to 5V) |
2 | GND | Ground |
3 | SCL | Serial Clock Line for I2C communication |
4 | SDA | Serial Data Line for I2C communication |
5 | DRDY | Data Ready (optional, not commonly used) |
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_HMC5883_U.h>
// Create an instance of the HMC5883L sensor
Adafruit_HMC5883_Unified mag = Adafruit_HMC5883_Unified(12345);
void setup() {
Serial.begin(9600);
// Initialize the sensor
if (!mag.begin()) {
Serial.println("Could not find a valid HMC5883 sensor, check wiring!");
while (1);
}
}
void loop() {
// Get a new sensor event
sensors_event_t event;
mag.getEvent(&event);
// Display the results (magnetic vector values are in micro-Tesla (uT))
Serial.print("X: "); Serial.print(event.magnetic.x); Serial.print(" ");
Serial.print("Y: "); Serial.print(event.magnetic.y); Serial.print(" ");
Serial.print("Z: "); Serial.print(event.magnetic.z); Serial.print(" ");
Serial.println("uT");
// Delay before the next reading
delay(500);
}
No Data Output:
Inaccurate Readings:
I2C Communication Errors:
Q1: Can the GY-273 be used with a 3.3V microcontroller?
Q2: How do I calibrate the GY-273?
Q3: What is the default I2C address of the GY-273?
By following this documentation, users can effectively integrate and utilize the GY-273 3-axis digital compass module in their projects, ensuring accurate and reliable orientation measurements.