How to connect Two MLX90614 Temperture Sensors

Hello, I have two MLX90614 Temperature sensors I want to connect them together so I can read both values. I have looked at the following forums but they didn't help me, it would just give me really high values: Connect TWO Adafruit MLX90614 - Programming Questions - Arduino Forum

Here is the documentation for the sensor, which I followed:
https://www.jaycar.com.au/medias/sys_master/images/9323686592542/XC3704-manualMain.pdf
https://www.jaycar.com.au/medias/sys_master/images/9323686625310/XC3704-dataSheetMain.pdf

Here is an sample code for connecting one of the temperature sensors, which I have tested and works.

/*************************************************** 
  This is a library example for the MLX90614 Temp Sensor

  Designed specifically to work with the MLX90614 sensors in the
  adafruit shop
  ----> https://www.adafruit.com/products/1747 3V version
  ----> https://www.adafruit.com/products/1748 5V version

  These sensors use I2C to communicate, 2 pins are required to  
  interface
  Adafruit invests time and resources providing this open source code, 
  please support Adafruit and open-source hardware by purchasing 
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries.  
  BSD license, all text above must be included in any redistribution
 ****************************************************/

#include <Wire.h>
#include <Adafruit_MLX90614.h>

Adafruit_MLX90614 mlx = Adafruit_MLX90614();

void setup() {
  Serial.begin(9600);

  Serial.println("Adafruit MLX90614 test");  

  mlx.begin();  
}

void loop() {
  Serial.print("Ambient = "); Serial.print(mlx.readAmbientTempC()); 
  Serial.print("*C\tObject = "); Serial.print(mlx.readObjectTempC()); Serial.println("*C");
  Serial.print("Ambient = "); Serial.print(mlx.readAmbientTempF()); 
  Serial.print("*F\tObject = "); Serial.print(mlx.readObjectTempF()); Serial.println("*F");

  Serial.println();
  delay(500);
}

The simplest way to connect two of these sensors is to use an I2C multiplexer.

pylon:
The simplest way to connect two of these sensors is to use an I2C multiplexer.

I think I'd just change one of the sensor's addresses.

According to Section 7.3.3 of the datasheet, the device's SMBus address is stored in location 0x00E of the EEPROM. All devices have a default SMBus address of 0x5A. So, you should connect a single device to your processor and run a short program to change its bus address to something other than 0x5A. Then, you can have two devices on the same bus. The Adafruit constructor allows specifying a custom address.

According to Section 7.3.3 of the datasheet, the device's SMBus address is stored in location 0x00E of the EEPROM. All devices have a default SMBus address of 0x5A. So, you should connect a single device to your processor and run a short program to change its bus address to something other than 0x5A. Then, you can have two devices on the same bus. The Adafruit constructor allows specifying a custom address.

You have to follow a special process to actually change that address and many posters here in the forum failed to get the address effectively changed. That's why I suggested the multiplexer.

Yes, after a little Google searching, I see that it's kind of involved and the datasheet is rather cryptic. Yet, there seems to be enough information available that changing the address is doable. Maybe start with this: MLX90614 IR_Temp_Sensor (change address) - I have spent so much time looking into how to cha… | Mbed

Sorry for the late reply, I used @gfvalvo link for changing the I2C address, so I changed one of the temp sesnors to 0x5B. I was then able to select the address when getting the temperture from both sensors, here is an sample code.

#include <Wire.h>
#include <Adafruit_MLX90614.h>
#define leftTemp 0x5A //Defines the address of two temp sesnors
#define rightTemp 0x5B
Adafruit_MLX90614 mlx;

float getLeftTemp(){ // function that returns the object temp in C
  mlx.AddrSet(leftTemp); 
  return mlx.readObjectTempC();
}
float getRightTemp(){
  mlx.AddrSet(rightTemp); 
  return mlx.readObjectTempC();
}
void setup() {
  Serial.begin(9600); 
  mlx.begin(); 
}

void loop() {
  Serial.print("Left:");
  Serial.println(getLeftTemp());
  delay(250);
   Serial.print("Right:");
  Serial.println(getRightTemp());
  delay(1000);
}