MiniIMU-9, sharing i2c bus with a LSM303DLH?

I have a MiniIMU: pololu.com/catalog/product/1265
I’d like to use it on the same i2c bus as a LSM303DLH is attached (note “H” not “M.”)
I notice that the “M” documents a “WHO_AM_I_M” register at offset 0xF in the data sheet, presumably to allow changing the I2C address (this register is listed twice, but not documented in detail.)
The “H” does not document this register – the register map stops at 0xC.
Do you know if it’s safe to write a value to 0xF for the DLH part? Ideally, it will ignore this write, whereas the DLM on the MiniIMU-9 will change its address, so I can tease these two devices apart on the bus.
Also, if you have better documentation on the WHO_AM_I_M register from the data sheet, I’d appreciate it too :slight_smile:

Hello,

Unfortunately, the WHO_AM_I register is read-only, as indicated by the “r” in the Type column of the table on page 22 of the LSM303DLM datasheet. I think its intended use might be to help distinguish a DLM from DLH; that is part of how our LSM303 Arduino library detects which chip you are using it with.

As far as I know, there is no way to change the slave address of the magnetometer, so I do not think it would be possible to read the magnetometers of more than one LSM303 (DLM or DLH) on the same I2C bus. (Could I ask why you want to do this, since the MinIMU-9 includes an LSM303DLM?)

- Kevin

I have a system that already has a DLH based compass mounted in a magnetically out-of-the-way place.
I now want to get gyro and accelerometer readings from a location that is magnetically very noisy.
I bought the mini-IMU without doing enough research to realize that it would collide with my existing compass.
I’m going to have to think more about this. I could switch which device I read by gating the SDA line to each somehow, perhaps…

Hello.

Could you use two separate I2C buses?

- Ryan

That’s a good suggestion, but doesn’t work in my system. This is a system of AVR homebrew boards to interface to analog and SPI devices, plus a few separate I2C sensors, all of which tie together with I2C. Each AVR only has one I2C interface, and in addition I only use one master on the entire bus (which talks to a computer over USB.)
I think a A/B splitter with a pair of BS170 transistors would work well enough. Actually, I’m going to try just using the MiniIMU in a different location for now, and if that works, I’ll have a spare compass to use for something else :wink:

You can do I2C in software on any two GPI/O. It is clocked so you can go slowly if you need to.

- Ryan

Software I2C adds too much scheduling jitter to my real-time tasks, I think. But thanks for the suggestion!

It sounds like you do not need the data from the LSM303DLM on the IMU board, so maybe it would be possible to cut a trace that is providing power to that chip?

Michael