4

I have an IMU sensor and a Bluerobotics temperature sensor, both have different I2C addresses.

I want to integrate both with an Arduino UNO, I know I can do this with an I2C multiplexer but I don't have access to one right now.

Is it possible to integrate them with arduino without a multiplexer, i.e., by just connecting them parallelly on the A4 and A5 pins of Arduino? (This didn't work though when I tried, the temperature sensor was giving values but the values of IMU sensor were only zeros on the Arduino Serial Monitor)

I've found some videos on it on YT, some have connected pull up resistors to the sensors, but this method doesn't seem to work.

So before delving deeper into it, I'd like to know if this is even possible to do without a multiplexer, because my time is precious since I have a project deadline.

2
  • Yes, I2C is a bus designed for connecting multiple i2c devices via the same bus as long as the i2c devices have different i2c address. If you can read the temperature sensor, but not the IMU, run the i2c scanner to see if you can detect it first. You will definitely need pull-up resistors on both i2c lines if your Arduino or your sensors do not have it.
    – hcheung
    Commented Aug 31, 2022 at 6:44
  • also asked on Arduino forum forum.arduino.cc/t/…
    – Juraj
    Commented Aug 31, 2022 at 9:15

2 Answers 2

2

first of all , you said they have different I2C addresses , so you don't need I2C multiplexer , I2C multiplexer is only used when having more than one device having same I2C address , and refer to Adafruit I2C multiplexer as they say :

Finally, a way to get up to 8 same-address I2C devices hooked up to one microcontroller

which means it can handle 8 devices having the same address , but in your case , the addresses already are different , so why you need I2C multiplexer.

your problem needs to dig deep into debugging , you can get your self a cheap logic analyzer like this cheap 10$ saleae clone analyzer to see what data is actually put into the bus , the analyzer will make your debugging way more easy than you think , like the below picture obtained from saleae official website and also this cheap saleae clone works perfect with logic software offered from saleae: enter image description here

but for your problem , I am guessing that it's due to pull resistors and the parasitic capacitance between the 2 buses , reading from I2C specification file, at section 7.1 , there is equation from minimum and maximum allowed pull up resistors according to nodes connected to the bus :

Rp(min) = (Vdd - Vol(max)) / Iol

Rp(max) = tr / (0.8473 * Cb)

where Vdd is 5V when using arduino , tr is the rise time maximum and it depends on MCU, Cb is estimated bus capacitance and you can get that from datasheet of every component in your bus line as for arduino its capacitance is specified in datasheet at page 264 saying

Capacitance for each I/O pin Ci – 10 pF

other symbols , you can get from the I2C specifications mentioned above , but your problem is due to pull up resistors I guess and you can't really know without debugging. I recommend you using logic analyzers.

2
  • But when I connect 4.7k resistors to SDA and SCL lines and Vcc, which comes in the range, the Serial monitor screen is totally white and shows no value. And when I do not connect any resistor, the temperature sensor is giving correct values but IMU sensor is giving fixed and wrong values. The temperature sensor I'm using is a module, the Bluerobotics Celsius Fast Response module, and the IMU sensor (MPU 9250) is a 'bare sensor', not a module. Could the problem be because of this? maybe the temperature module already has a built in pull up resistor and the IMU sensor doesn't?
    – ssmalik
    Commented Sep 1, 2022 at 2:44
  • @ssmalik ، if you are adding external pull-up resistors then make sure to turn off the arduino(Atmega328p) internal pull up resistors because if there is more than one pull up resistor on the same bus with different values , this will give you errors in reading data on the bus , also solving the problem requires debugging using things like logic analyzers as I said
    – abdo Salm
    Commented Sep 1, 2022 at 2:49
0

Since you did not give links I went on line and checked them. Be sure the I2C modules do not have pull up resistors. If so note the value. Adjust your external so the pull up to 3V3 is about 3.1K. You will need a level translator for both the IMU module and the Bluerobotics temperature sensor they are both 3V3 boars. Good news one set of level translators will work for both. Remember you will need pull ups on both sides of the translators, check as not all do.

Since you are just getting started you can pick one of the fine 3V3 micros in the Arduino or ESP series of boards. Simple starting point rule for pull up on I2C: 3.1K for 3V3 and 4.7K for 5V. Let us know how you do.

Bad News it is possible you damaged one or both of the I2C boards with 5V.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.