Multiple HMC5883L compass units on one I2C line?

The factory default address for the HMC5883L unit is 0x7E. Does anyone know if it is possible to change this setting so that it is possible to have multiple magnetic sensors on one two-wire bus? Or, is it mandatory that a separate dedicated SDA/CLK pair be used for each sensor?

I am trying to build a magnetic sensor array and would like to simplify the comm bus if possible.




  • 6 Comments sorted by Votes Date Added
  • edited April 2012 Posts: 0Vote Up0Vote Down
    Unlike most I2C devices, according to the datasheet, there is no provision for multiple devices on the I2C bus, so you'd need a separate I2C bus for each HMC5883L
  • edited April 2012 Posts: 188Vote Up0Vote Down
    Thanks Mr. Green. I have setup for 4 separate I2C channels on the PPDB.

  • edited September 2012 Posts: 0Vote Up0Vote Down
    I have no problem running an HMC5883L and an EEPROM on the same bus. The datasheet does say, "The SCL and SDA lines in this bus specification may be connected to multiple devices. The bus can be a single master to multiple slaves, or it can be a multiple master configuration." (p. 17) I don't think it is a stretch to think that two HMC5883Ls would happily coexist. Of course, you will have to give them different addresses, which can be done by writing to the configuration register. If both are hard-wired on the bus it presents a chicken-and-egg problem.
  • edited September 2012 Posts: 0Vote Up0Vote Down
    Different classes of devices ... like EEPROMs and sensors like the HMC5883L ... use different groups of addresses. By convention, the block of addresses from $A0/$A1 through $AE/$AF allow for 8 EEPROMs although some larger (128K) EEPROMs use two addresses, one for each 64K block.

    The HMC5883L responds to I2C address $3C/$3D and there is no way to change this. As a result, there is no way to have more than one HMC5883L on the same I2C bus. You can have multiple I2C devices on the same bus, but they have to have unique addresses.
  • edited September 2012 Posts: 0Vote Up0Vote Down
    Dang, Mike. You are so right. (I have also used the HMC6352 compass, and that device does allow one to change the address. But not so with the HMC5883L or HMC5843L).
Sign In or Register to comment.