Magnetometer/compass modules GY-273 not working

In a recent order I received two of the following;
HMC5883L Triple Axis Compass Magnetometer Sensor Module 018-DB-HMC5883L

They were on special as clearance items. On the PCB itself is the code GY-273

Neither module appears to be working/communicating. I’ve read quite a bit about them now and used some simple Arduino examples to try and get it going, i.e.
Henry’s bench

Also there wasn’t really any info about this particular module on the Core site but schematics, etc can be found at;
Addicore
According to the schematic this module has pull-up resistors for SDA, SCL.

Basically when the Arduino uses the I2C bus to write to address 0x1E (this device’s address) and then calls endTransmission() it gets a return code;
2 : received NACK on transmit of address
so it appears that the device is not responding.

Has anyone else been able to get one of these to modules work? Is that why they were clearance items?

Cheers,
Paul

Try running a I2C device scanner script, which essentially loops through all possible addresses and reports if a device is found on the bus. This is often a good first troubleshooting step.
Can you please post an image of your setup showing the wiring as cleanly as possible?


Here’s the code as copied from that link for posterity

 // --------------------------------------
// i2c_scanner
//
// Version 1
//    This program (or code that looks like it)
//    can be found in many places.
//    For example on the Arduino.cc forum.
//    The original author is not know.
// Version 2, Juni 2012, Using Arduino 1.0.1
//     Adapted to be as simple as possible by Arduino.cc user Krodal
// Version 3, Feb 26  2013
//    V3 by louarnold
// Version 4, March 3, 2013, Using Arduino 1.0.3
//    by Arduino.cc user Krodal.
//    Changes by louarnold removed.
//    Scanning addresses changed from 0...127 to 1...119,
//    according to the i2c scanner by Nick Gammon
//    http://www.gammon.com.au/forum/?id=10896
// Version 5, March 28, 2013
//    As version 4, but address scans now to 127.
//    A sensor seems to use address 120.
// Version 6, November 27, 2015.
//    Added waiting for the Leonardo serial communication.
// 
//
// This sketch tests the standard 7-bit addresses
// Devices with higher bit address might not be seen properly.
//

#include <Wire.h>


void setup()
{
  Wire.begin();

  Serial.begin(9600);
  while (!Serial);             // Leonardo: wait for serial monitor
  Serial.println("\nI2C Scanner");
}


void loop()
{
  byte error, address;
  int nDevices;

  Serial.println("Scanning...");

  nDevices = 0;
  for(address = 1; address < 127; address++ ) 
  {
    // The i2c_scanner uses the return value of
    // the Write.endTransmisstion to see if
    // a device did acknowledge to the address.
    Wire.beginTransmission(address);
    error = Wire.endTransmission();

    if (error == 0)
    {
      Serial.print("I2C device found at address 0x");
      if (address<16) 
        Serial.print("0");
      Serial.print(address,HEX);
      Serial.println("  !");

      nDevices++;
    }
    else if (error==4) 
    {
      Serial.print("Unknown error at address 0x");
      if (address<16) 
        Serial.print("0");
      Serial.println(address,HEX);
    }    
  }
  if (nDevices == 0)
    Serial.println("No I2C devices found\n");
  else
    Serial.println("done\n");

  delay(5000);           // wait 5 seconds for next scan
}

Hi Paul,
I believe the issue you’re having is due to the chipset change which has occured on that product. I’ve updated the product page to reflect this change and include relevant info.

The TLDR is that the I2C address has changed, but you can find the correct address in the datasheet.

Hi Sam,

Thanks! I just came back here to post an update with the same information as you’ve just added!! (literally within the past 2 hours). You’re very efficient.

I found a thread here where people originally thought these were fake chips because the address and register arrangement is totally different to an HMC5883, but there are links within that to the correct datasheet and working example code.

So I now have it working on the bench and spitting out X,Y,Z readings. Not sure how good this QMC chip is versus the HMC, the readings can jump around a bit (need some smoothing). I mainly want to use one as a non-invasive motor on/off detector so the difference in output ought to be pretty striking.

HI Paul,
Not a problem, it had been on my radar to sort out so it’s good to be able to help someone out with that info. Glad to hear that you go it working, I’d think that any noise could definitely be ignored in that use case.