Configuring MLX90614 Sensor in PWM Mode

Do any of you have any experience with using the MLX90614 in PWM mode? I tried writing the recommended value, 0000001000000111, to the appropriate register, 0x02, but my sensor doesn’t seem to have changed. I still cannot read any analog voltage and SMBUS hasn’t been disabled. Similar code seems to work when I assess temperature, but I can’t get this to work.

#include <i2cmaster.h>

  void setup(){
  Serial.begin(9600);
  
  i2c_init(); //Initialise the i2c bus
}

void loop(){
    int dev = 0x5A<<1;
    unsigned int data_l = 0;
    unsigned int data_h = 0;
    int pec = 0;

    i2c_start_wait(dev+I2C_WRITE);
    
    i2c_write(0x02); //Register Address to write to
    
    i2c_write(0x00); //Erase low byte (write 0)
    i2c_write(0x00); //Erase high byte (write 0)
    i2c_write(0x207); 
    i2c_stop();
    
    i2c_start_wait(dev+I2C_WRITE);
    i2c_write(0x02);  
    
    i2c_rep_start(dev+I2C_READ);
    data_l = i2c_readAck(); //Read 1 byte and then send ack
    data_h = i2c_readAck(); //Read 1 byte and then send ack
    pec = i2c_readNak();
    i2c_stop();
        
    Serial.println(data_l, DEC);
    Serial.println(data_l, HEX);
    Serial.println(data_h, DEC);
    Serial.println(data_h, HEX);

    delay(1000);
}

Here are the PDFs where I got the recommended value and register.

solble:
I still cannot read any analog voltage

Are you trying to read an analog voltage output or are you trying to read a PWM duty cycle?

Hello,

I am trying to read the PWM output but accidentally referred to it as analog voltage. I was under the assumption that I would need to take in the analog output of the 90614 PWM pin into my MCU via an ADC and use MLX’s provided equations to calculate the temperature.

solble:
I was under the assumption that I would need to take in the analog output of the 90614 PWM pin into my MCU via an ADC and use MLX's provided equations to calculate the temperature.

Nah, you should use the pulsin() function to determine the duty cycle. then you can correlate the duty cycle to temperature

You write 0x207. That's not a byte.