Using 2x i2c interface devices/sensors with Arduino UNO R3

Yep, my Arduino UNO R3 has delivered to me few weeks ago, and I started to do my project.

The sensor and devices I use are 1 LCD 1602 and 1 MLX90614 refer to the post. However, as they are using i2c interface while I'm not sure I've understood how i2c works exactly.

What I know is that UNO R3 has a built-in pull-up resistor so I should be able to connect them both to the same two i2c pins by soldering them into 1 cable for SDA and 1 cable for SCL and plug them into Arduino's SDA and SCL pins, and they should work without any problems.

Is that right?

I have just written the code for them:

#include <LiquidCrystal_I2C.h>
#include <Adafruit_MLX90614.h>

LiquidCrystal_I2C lcd(0x27, 16, 2); // I2C address 0x27, 16 column and 2 rows
Adafruit_MLX90614 mlx = Adafruit_MLX90614();


void setup()
{
  lcd.init();
  lcd.backlight();
  mlx.begin();
}


void loop()
{
  lcd.clear();                 // clear display
  lcd.setCursor(0, 0);         // move cursor to   (0, 0)
  lcd.print("Temp:");          // print message at (0, 0)
  lcd.print((mlx.readObjectTempC()));         
  lcd.print((char)223);
  lcd.print("C");
  delay(2000);                 // display the above for two seconds

}

Is that okay? Thanks for all helping for this project!

Sort of. You're correct you can connect all SCL's and SDA's together (Arduino, 1602, MLX90614). Whether the pullups that are present on the sensor boards will be sufficient is hard to tell, but with sufficiently short wires, they usually are. The internal pullups on the Arduino are certainly not adequate by themselves, but fortunately, virtually all I2C sensor modules have 10k pullups on board. Two boards means 5k effectively, which should work fine with short cables.

Does it compile?
Does it work as intended?
You're in control!

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.