Shop OBEX P1 Docs P2 Docs Learn Events
Multiple HMC5883L compass units on one I2C line? — Parallax Forums

Multiple HMC5883L compass units on one I2C line?

StephenMooreStephenMoore Posts: 188
edited 2012-09-12 14:57 in Accessories
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.

Regards,

sgm

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2012-04-28 16:27
    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
  • StephenMooreStephenMoore Posts: 188
    edited 2012-04-28 17:08
    Thanks Mr. Green. I have setup for 4 separate I2C channels on the PPDB.


    sgm
  • LiquidsLiquids Posts: 2
    edited 2012-09-12 01:09
    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.
  • Mike GreenMike Green Posts: 23,101
    edited 2012-09-12 08:15
    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.
  • LiquidsLiquids Posts: 2
    edited 2012-09-12 14:57
    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.