Go Down

Topic: MLX90614 sensor (Read 1 time) previous topic - next topic


Hello all,
I am trying to use the ir thermometer sensor "MLX90614".

I Connected the sensor to the arduino and I am runnig this code;
Code: [Select]
#include <i2cmaster.h>

void setup(){

i2c_init(); //Initialise the i2c bus
PORTC = (1 << PORTC4) | (1 << PORTC5);//enable pullups

void loop(){
    int dev = 0x5A<<1;
    int data_low = 0;
    int data_high = 0;
    int pec = 0;
    // read
    data_low = i2c_readAck(); //Read 1 byte and then send ack
    data_high = i2c_readAck(); //Read 1 byte and then send ack
    pec = i2c_readNak();
    //This converts high and low bytes together and processes temperature, MSB is a error bit and is ignored for temps
    double tempFactor = 0.02; // 0.02 degrees per LSB (measurement resolution of the MLX90614)
    double tempData = 0x0000; // zero out the data
    int frac; // data past the decimal point
    // This masks off the error bit of the high byte, then moves it left 8 bits and adds the low byte.
    tempData = (double)(((data_high & 0x007F) << 8) + data_low);
    tempData = (tempData * tempFactor)-0.01;
    float celcius = tempData - 273.15;
    float fahrenheit = (celcius*1.8) + 32;

    Serial.print("Celcius: ");

    Serial.print("Fahrenheit: ");

    delay(1000); // wait a second before printing again

The code himself is running good, my problem is the measurements.

When I am putting my hand 5cm infront of the sensor I am geting result of 22+-, but when I am taking my hand away(15-20cm) the result are changing,.

Is this sensor has some distance limit?

Thank you.


There is no distance limit. The sensor reports the average temperature of everything in its field of view, which is a cone of roughly 90 degrees. As almost always, if you have questions for how a device works, the data sheet is a fantastic resource!


Practically speaking, it averages its field of view.

Take your hot soldering iron and slowly move it into the field of view of the device-
and then get closer to it.  It's averaging that hot iron and everything it sees as
the background, and outputting that as one number.

There are several different fields of view available- they seem to do it with lensing.




Feb 28, 2014, 10:33 pm Last Edit: Feb 28, 2014, 10:36 pm by BN.barak Reason: 1
Ok guys, thank you for the information!
I found several exmaples for multiple sensros(codes), but I didnt found any circulate(the datasheet doesnt spesificate capasitor and resistors values. And he is workign in 3.3v). Does any one have an example ?
BTW, when I attach 2 sensors to the same pins( analog 4 and 5), the I2C scaner cant find anything.
Thank you


Of course two sensors will interfere with each other, until you have changed the device address of one.
Get one working first. http://bildr.org/2011/02/mlx90614-arduino/


I am sorry, maybe I wasn't clear. I made one of them works, but when I attach 2 sensors to the arduino the I2C scanner doesn't find any of them.

What's the best method to connect 2 sensors?


Of course two sensors will interfere with each other, until you have changed the device address of one.

See the data sheet on how to change the device address of one sensor.


And I did change the address. Now I have 0x5A and 0x57. But when I try to scan them all in the same time , the scan returns me black. When I scan them individualy they are working perfect.


But when I try to scan them all in the same time , the scan returns me black.
What does that mean?
Post your code, using the code tags (# button) and some sample output.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131