Is it possible to connect two Mag3110 sensors to one Arduino?

Hi, I’m trying to connect two Mag3110’s Magnetometers to the same I2c Bus on an Arduino. Is there any way to change the slave address of 0x0E on one of the chips so that I can address both of them on the same bus? If not, is there any other way to connect and address both? Thanks.

Google I2C multiplexer.

There is no restriction that requires that you only have a single pin running an I2C bus. Of course, it's an annoyance when you were expecting to read all your i2C devices from a single pin, but in this case, your easiest solution may well be to put each sensor on its own private bus/pin.

Thanks for your reply. I thought I2C requires to use Analog pins 4 and 5 on the Arduino? So are you saying it's possible to use another analog pin for the SDA line at the same time (to communicate with 2 sensors for example that have the same id)? Do you know how the basic code would change to handle that? I thought the code is all set up to only work on pins 4 and 5.

Oops - I was thinking of the onewire library. Looks like I2C is, as you say on fixed pins.

please post a link to the datasheet of the sensor.

If the sensors have the same address hard coded you have a problem. A solution that worksometimes is to switch on/off the power of the I2C device (either directly or through some transistor).

digitalWrite(SENSOR1_PIN, HIGH);; digitalWrite(SENSOR1_PIN, LOW);

and to use sensor 2 digitalWrite(SENSOR2_PIN, HIGH);; digitalWrite(SENSOR2_PIN, LOW);

Note some sensors need time to "wake up", to tweaking might be needed.

I looked up the datasheet of the sensor. There appears to be no method to select alternative I2C addresses for it.

At the bottom of the first page, it seems to suggest that the address for one version of the device was different to the address for a different device, it wasn't clear to me what two versions of the device ( or different devices ), this was referring to.