MLX90615 I2C Communication

I am not able to get the I2C to work with the Melexis MLX90615 IR Temperature Sensor. I also have an LMS303 Accelerometer/Compass connected which works fine.
Finer scrutiny of the MLX90615 datasheet shows that the SMBus protocol requires a Repeated Start instead of a stop/start between the SlaveAddress.Command Packet and the Read Address packet.

Does the imp I2C support the Repeated Start mode of operation? How do I enable this?

We don’t support repeated start, but I’ve never seen a device that got upset with this. Can you read/write anything? It should appear by default at address (0x5b<<1).

btw, that’s a really sweet part!

Unfortunately there does not appear to be anyway to get this device to work. The device is also theoretically able to communicate at address 0x00 but all I ever get back (whether using 0x5B<<1 or 0x00) is 0xFFFFFF. The STOP bit after ADDR/COMMAND bytes resets the MLX90615 communication block, so when you send the Read Command, it is in the wrong state. At least that is what appears to happen.

They have a more complex part MLX90620 which is a 16x4 IR array. Good example of using it with an iPhone on Kickstarter.

Very strange. We’ll get one from Digikey and take a look. Not sure why I skipped the repeated start implementation here, apart from having never needed it on anything ever before in several million devices at Apple :slight_smile:

btw do you have the code you’re using that you can post? Looking more at the spec, it seems that it defaults to PWM mode and so you need to drop SCL for >39ms to switch it to SMBus, then use a clock rate of no higher than 100kHz.

Agree, this is a bit of an odd interface. The SMBus output is the default. See Page 5 of the data sheet. To get into PWM mode you have to write to the config register bit 0, then cycle power (8.5.2 in the data sheet). Then, as you said, you can drop SCL to get to switch to SMBus mode. As delivered the device default is SMBus.
The write cycle also requires the Repeated Start. Here are the essential program statements for this device as I have them. I’m happy for you to access my device directly if you need to.
// set the I2C clock speed. We can do 10 kHz, 50 kHz, 100 kHz, or 400 kHz
// MLX90615 maximum is 100KHz and minimum is 10kHz.

function initIR()
// MLX claims the device will respond to address 0x00
hardware.i2c89.write( 0x00, “\x00”);
// Allow the communication block to timeout.


function readIR() {

// Send command 2 to register address 7 which makes x27 
hardware.i2c89.write( 0xB6, "\\x27");
local irObjectTemp = 0xB6,"",3 );

if( irObjectTemp != null )
    server.log(format("To Raw %02X%02X%02X", irObjectTemp[2],irObjectTemp[1],irObjectTemp[0]));    
    server.log("IR Read FAIL");


function getReadings()
// readMag();
// readAccelBulk();
// rollNPitch();
// calcHeading();
// server.log(format(“Heading %.2f Pitch %.2f Roll %.2f”, heading * 180/3.14159, pitch 180/3.14159, roll180/3.14159 ));

imp.wakeup(2.0, getReadings);


imp.configure(“CompassAccel”, [], [compassPort,headingPort,rollPort,pitchPort]);


@hugo , did you have a chance to look at a repeated start implementation for I2C ? I want to use the MLX90615 on a new design

@deonsmt Were you ever able to do a repeated start implementation for the i2c?

No, I never got this sensor to work. Others have got the MLX90614 sensor to work though. See this link:

I don’t see any communication difference in the data sheets other than addresses but the two MLX90615 devices I tried did not respond at all. The pinouts are different so just be aware of that.

@deonsmt Thanks a lot for sending this across! I think I understand now why I was getting an error. Thanks a ton. (y)

If you get the 90615 to work, please let me know!