Connecting up to the MLX90620

So i got the MLX90620 and im going to turn it in to a very cheap very low res thermal imaging camera as many would want to do with it. But i’m having problems. I new to I2C on the arduino, and in fact it is the first time I have ever used I2C. I do realize that this is not something that I should to start my experience with I2C but I figured if I can use this sensor, I could use any TWI device. So far I have the sensor hooked up correctly and I’m able to scan for it on a I2C scanner I found on the net. But if I use the code I wrote to try to get the information of one pixel, I get -1 on the Serial Monitor.

I have looked at the other topic on here and it is extremely outdated and you can’t get the I2Cmaster library there anymore. So I figured that this would be a good place and time to start a new and updated topic on it. This is a really cool sensor and I think it could open up a lot more projects if we can get this thing working :grin:

Here is my code:

#include <Wire.h>

void setup(){

Serial.begin(9600);

delay(10);

Wire.begin();

delay(10);

}

void loop(){
sensorRead();
delay(100);

}

void sensorRead(){

Wire.beginTransmission(0x50); //
Wire.write(0x02); //opCode
Wire.write(0x00); //startAddress
Wire.write(0x00); //addressStep
Wire.write(0x01); //numberOfReads
Wire.endTransmission();
Wire.requestFrom(0x50, 2); //there is a LSbytes and a MSbyte to be read here

while(Wire.available())
{

}

Serial.println(Wire.read()); //I think this is were the error is
Serial.println(Wire.read());

}

I realize its probably some simple mistake but hey, learn as you go!

while(Wire.available() < 2) // <<<<<<<<<

as you want to read 2 bytes, they should be there

Ok i added that but now I don't get anything in the serial monitor. could it be that im just not communicating properly