Arduino + MLX90614 Infrared Thermometer Module

Hello,

Does anybody has some experience with connecting the MLX90614 Infrared Thermometer Module to an Arduino board ????

I have some problems with it.....
I hope somebody can help me, because I really don't know how to do this.

Thank you!
Kind regards

Can you tell us how you've connected the sensor to the Arduino? And can you show us the sketch code, with an explanation of what goes wrong?

Hi Anachrocomputer,

I've connected the the +5V and the ground of the sensor to the +5V and ground of my Arduino board. The I/O pin of my sensor is connected with the analogepin 3 of my Arduino board.

This is the basic code I wrote:

int analogPin = 3;
int val = 0;

void setup()
{
Serial.begin(9600);
}

void loop()
{
pinMode(analogPin, OUTPUT);
analogWrite(analogPin, 'END');
analogWrite(analogPin, '!TEMR');
delay(100);
pinMode(analogPin, INPUT);
val = analogRead(analogPin);
Serial.println(val, DEC);
delay(1000);
}

The 'END' is because they said in the manual of the sensor that it is good to do this the first time, to be sure that all pins are set to inputs.
The "!TEMR" is to read sensor data.

If I look into my serial monitor, I can see that he gives me the value of 1023 every second.

It's my first try with Arduino....

Kind regards.

The device you described is a serial digital device, not analogue.
You need to connect it with one of the serial libraries to a digital pin.

You need to write strings to the device, and then read back the serial responses.

You're writing PWM to one of the digital pins (digital pin 3), then trying to read back analogue values from a completely different pin, analogue pin 3.

This simply won't work.

Hi AWOL,

Ok thank you. I will try that.
Is it something like this: Arduino Playground - OneWire

I realise now that my first code was way to basic and totally wrong to do this.
Is it possible that I can damage my I/O pin if my timing isn't right?

Kind regards

IIRC, it's not 1-wire, it's I2C (aka two wire), using the Wire.h library.

-j

No, not I2C, according to this:

http://www.parallax.com/Portals/0/Downloads/docs/prod/sens/28040-28042-IRThermometer-v2.0.pdf

Only five pins, of which two are power and ground, one reset, one alarm and one serial.

Hi,

I'm also trying to interface to an MLX90614 (by Melexis). I am using an Arduino Mini Pro. I have written the following code using the Wire libraries but it just returns 255 for both bytes of data.

#include <Wire.h>

#define THERM_ADDRESS 0x5A

void setup(){

Serial.begin(9600);
Wire.begin();
Wire.beginTransmission(THERM_ADDRESS);
Wire.send(0x02);
Wire.send(0x00);
Wire.endTransmission();

}

void loop(){

Wire.beginTransmission(THERM_ADDRESS);
Wire.send(0x07);

Wire.beginTransmission(THERM_ADDRESS);
Wire.requestFrom(THERM_ADDRESS,2);

if(Wire.available()){
int temp1 = Wire.receive();

Serial.print("Temp 1: ");
Serial.print(temp1);
}

if(Wire.available()){
int temp2 = Wire.receive();
Serial.print(" Temp 2: ");
Serial.println(temp2);
}

Wire.endTransmission();
}

Any thoughts on what I could be doing wrong? I have also tried using the address 0x00 which should also work according to the datasheet but got the same result.

Thanks! :smiley:

No, not I2C, according to this:

My mistake; that's what I get for trusting my memory. There's another Melexis with a very similar part number that is I2C. I played with it for a short time, then gave it to the student actually working on the project. not sure it ever made it into the application; IIRC the specs were a little sub-optimal for his very specialized application.

sorry to muddy the waters.

-j

Check my Blog , I can read it use New Software Serial

#include <NewSoftSerial.h>

NewSoftSerial Temp90(2, 3);
NewSoftSerial Temp10(4, 5);

int LED = 13;
int RESET = 12;

void setup() 
{ 
  pinMode(LED,OUTPUT);
  pinMode(RESET,OUTPUT);
  
  digitalWrite(LED,HIGH);
  digitalWrite(RESET,LOW);
  delay(10);
  pinMode(RESET,INPUT);
  
  Temp90.begin(4800);
  Temp10.begin(4800);
  Serial.begin(115200);
  delay(100); 
  
  Temp90.print(0,BYTE);
  Temp90.print("!TEMc");
  Temp90.print(53,BYTE);
  Temp90.print(7,BYTE);
  delay(1000);
  digitalWrite(LED,LOW);
  pinMode(3,INPUT);
} 
 
void loop() 
{ 
  checkTemp();
} 

int checkTemp()
{
  char rByte[10] ;
  char rChar;
  static int Read = 0;
  static int rcount=0;
  int Temp1;
  int Temp2;
  int Temp3;
  while (Temp90.available() > 0) {
    rChar = Temp90.read();
    if (rChar == 'T') {
      Read = 1;
      rcount = 0;
    }
    if (Read == 1) {
      rByte[rcount] = rChar;
      rcount++;
    }
  }
  
  if (rcount >= 6) {
    if ((rByte[0] == 'T') && (rByte[1] == 'E') && (rByte[2] == 'M')) {
      Temp1 = rByte[4] + rByte[5]*256;
      Temp2 = (Temp1/100);
      if (Temp1*2 < 27315) {
        Temp3 = ((27315-(Temp1*2))/100);
      }
      else
      {
        Temp3 = (Temp1/100*2)-273;
      }
      Serial.print(rcount);   Serial.print("/");
      Serial.print(Temp1,DEC);Serial.print(" ");
      Serial.print(Temp2,DEC);Serial.print(" ");
      Serial.println(Temp3,DEC);
      
      rcount = 0;
      Read = 0;
      digitalWrite(LED,HIGH);
      delay(500);
      digitalWrite(LED,LOW);
      delay(500);
    }
  }
}

I have the same problem :-?
I bought the Parallax MLX90614 Infrared Thermometer Module and have no idea how to get it working. The code posted above only seems to work for the Melexis MLX90614 and not the parallax module i have. Can somebody help me please ?

Thanks for any answer

I can not run the Parallax MLX90614 Infrared Thermometer Module. I'm thinking in comeback the equipment.

Here I have some alternatives, Some one say me advice?

Please find attached find a working code based on the SoftwareSerial library. I have connected the SIG signal to the Arduino pin 2 & 3 and the RST signal to pin12.

#include <SoftwareSerial.h>

/====================================================
/ Connect MLX90614 SIG signal to Arduino pin 2 and 3
/====================================================
/

SoftwareSerial Temp90(2, 3);
int LED=13; /* for the show */
int RESET=12;

void setup()
{
pinMode(2,OUTPUT);
pinMode(3,OUTPUT);
pinMode(RESET,OUTPUT);

digitalWrite(RESET,HIGH);
delay(50);
digitalWrite(RESET,LOW);
delay(100);
digitalWrite(RESET,HIGH);

Temp90.begin(2400);
Serial.begin(115200);
delay(100);
Temp90.print(0,BYTE);
Temp90.print("!TEMc");
Temp90.print(0x5A,BYTE);
Temp90.print(7,BYTE);
digitalWrite(LED,HIGH);
delay(1000);
digitalWrite(LED,LOW);
pinMode(2,INPUT);
pinMode(3,INPUT);
delay(10);
}

//---------------------------------

void loop()
{
Acqu_Temp();

}

//----------------------------------

int Acqu_Temp()
{
static char rByte[10];
char rChar;
static int Read=0;
static int rcount=0;
int Temp1, Temp2, Temp3;

rChar = Temp90.read();
if (rChar == 'T') {
rByte[0]=rChar;
rChar=Temp90.read();
if(rChar=='E')
{
rByte[1]=rChar;
rChar=Temp90.read();
if(rChar=='M')
{
rByte[2]=rChar;
rByte[3]=Temp90.read();
rByte[4]=Temp90.read();
rByte[5]=Temp90.read();
Temp1 = rByte[4] + rByte[5]256;
Temp2 = (Temp1/100);
if (Temp1
2 < 27315) {
Temp3 = ((27315-(Temp12))/100);
}
else
Temp3 = (Temp1/100
2)-273;
Serial.print("Temperature= ");
Serial.print(Temp3,DEC);
Serial.println(" Degrees Celsius");
}
}
}
digitalWrite(LED,HIGH);
delay(500);
digitalWrite(LED,LOW);
delay(500);

}

Here a working version with the irq driven NewSoftSerial library.
It is a quasi copy of the code posted by Tze-Chien Chu.

#include <NewSoftSerial.h>

NewSoftSerial Temp90(2, 3);

int LED = 13;
int RESET = 12;

void setup()
{
pinMode(LED,OUTPUT);
pinMode(RESET,OUTPUT);

digitalWrite(LED,HIGH);
digitalWrite(RESET,LOW);
delay(10);
pinMode(RESET,INPUT);

Temp90.begin(4800);

Serial.begin(115200);
delay(100);

Temp90.print(0,BYTE);
Temp90.print("!TEMz");
Temp90.print(0x5A,BYTE);
Temp90.print(7,BYTE);
delay(1000);
digitalWrite(LED,LOW);
pinMode(3,INPUT);
}

void loop()
{
checkTemp();
}

int checkTemp()
{
char rByte[10] ;
char rChar;
static int Read = 0;
static int rcount=0;
int Temp1;
int Temp2;
int Temp3;
while (Temp90.available() > 0) {
rChar = Temp90.read();
if (rChar == 'T') {
Read = 1;
rcount = 0;
}
if (Read == 1) {
rByte[rcount] = rChar;
rcount++;
}
}

if (rcount >= 6) {
if ((rByte[0] == 'T') && (rByte[1] == 'E') && (rByte[2] == 'M')) {
Temp1 = rByte[4] + rByte[5]256;
Temp2 = (Temp1/100);
if (Temp1
2 < 27315) {
Temp3 = ((27315-(Temp12))/100);
}
else
{
Temp3 = (Temp1/100
2)-273;
}
Serial.print("Temperature= ");
Serial.print(Temp3,DEC);
Serial.println(" degrees Celsius");

rcount = 0;
Read = 0;
digitalWrite(LED,HIGH);
delay(500);
digitalWrite(LED,LOW);
delay(500);
}
}
}