I’ve spent ages trying to use the gy-273 gyro for a project.

I have connected it to an arduino uno like this:

vcc- 5v

and i have used this code:

#include <Wire.h> //I2C Arduino Library

#define addr 0x1E //I2C Address for The HMC5883

void setup(){
  Wire.beginTransmission(addr); //start talking
  Wire.write(0x02); // Set the Register
  Wire.write(0x00); // Tell the HMC5883 to Continuously Measure

void loop(){
  int x,y,z; //triple axis data

  //Tell the HMC what regist to begin writing data into
  Wire.write(0x03); //start with register 3.
 //Read the data.. 2 bytes for each axis.. 6 total bytes
  Wire.requestFrom(addr, 6);
    x =<<8; //MSB  x 
    x |=; //LSB  x
    z =<<8; //MSB  z
    z |=; //LSB z
    y =<<8; //MSB y
    y |=; //LSB y
  // Show Values
  Serial.print("X Value: ");
  Serial.print("Y Value: ");
  Serial.print("Z Value: ");

But it just keeps repeating the same results

Any help at all would be really appreciated

I've spent ages trying to use the gy-273 gyro for a project.

The GY-273 is not a gyro but a magnetometer (electronic compass). A link to the device you actually use must be provided to let us know we're talking about the same hardware.

But it just keeps repeating the same results

Start by posting these results!

vcc- 5v gnd-gnd scl-a4 sda-a5

The UNO has SDA on A4 and SCL on A5 but you should use the pins SDA and SCL instead because you cannot make this error if you use the correctly named pins.

yeah you're right it's a magnetometer. But, it is the GY-273. And, I typed it the wrong way round but i had the scl and sda in the right pins.

it just keeps repeating this

X Value: 0 Y Value: 1501 Z Value: 0

X Value: 0 Y Value: 1501 Z Value: 0

X Value: 0 Y Value: 1501 Z Value: 0

Run a I2C scanner to check if your I2C bus is working.
In your sketch, use the I2C address that is found by the I2C Scanner.

i ran the code and it said that there were no i2c devices found

Then you don't need to try something else, because your I2C bus is not connected or something is broken.

Which Arduino board do you use ? Can you give a link to the sensor module ? (a link to where you bought it). Can you make a photo of the wiring ? Do you use a breadboard ? They often have bad contacts.

I am using an arduino uno. I am using a breadboard, but i have tried moving it around.
I can’t find a link for where I bought it. But, I have also tried a GY-271 which I bought here:

and i’ve attached a picture of the wiring

thank you so much for helping me


The GY-271 has also a I2C level shifter, but both modules should be detected. I don't know what could be wrong. Is one of the jumper wires broken ? Did you notice something odd when compiling or uploading the sketch ? Can you measure the voltages of the pins of the module ?

If nothing helps, you can try to make the same setup with other components. Use an other computer, other USB cable, other Arduino board, other jumper wires, other module, other breadboard.