MLX90614 - write_word_data


I’ve connected the MLX90614 IR sensor to I2C bus of Jetson Nano using the PyMLX90614 python library.
I’m able to get temperature values from the sensor:

from smbus2 import SMBus
from mlx90614 import MLX90614

TemperatureModule._bus = SMBus(i2cBus)
TemperatureModule._sensor = MLX90614(1, 0x5A)
temperature = TemperatureModule._sensor.get_object_1()
temperature = TemperatureModule._sensor.get_ambient()

Now I’d like to modify some values like SMBUs address (0x0E) or Emissivity(0x04), which is possible by writting to the sensor’s EEPROM. As per the datasheet, the MLX90614 supports Read Word and Write word SMBUS commands.

The mlx90614 library does not include APIs for that (writting), so I’m implementing them myself using the write_word_data function from smbus2:

data = round(65535 * emissivity) # Emissivity is a value between 0.1 and 1.0
TemperatureModule._bus.write_word_data(0x5A, 0x24, 0x00)
TemperatureModule._bus.write_word_data(0x5A, 0x24, int(data))

Sadly is not working.
I appreciate your comments.

Have a check if i2cget -w to check if read word is working.

i2cget -w and i2cset -w are working
Even _sensor.get_object_1() which uses read_word_data from SMBus library is working, but not write_word_data.

That could be the python function not implement well.
Have a check the source of i2cset to modify it to try.

@c.valdezg which version/breakout of the MLX90614 are you using? I’m unable to get mine detected on any of the Jetson Platforms. I tested on the Xavier NX and the Nano Developer kits. The same sensor works well on a RaspberryPi and an Arduino with the Adafruit Library: