Skip to content

How to use MLX90614 IR Temperature Sensor Module with Arduino

Introduction:

The MLX90614 is an Infra-Red temperature sensor for non contact temperature measurements. The temperature sensor comes factory calibrated with a digital PWM and SMBus (System Management Bus) output.

Circuit:

Connect the pins of MLX90614 with the following pins of Arduino UNO, as shown below.

Arduino UNOMLX90614
3.3VVCC(Red)
GNDGND(Green)
A4SDA(Black)
A5SCL(Yellow)

NOTE

  • MLX90614 should be powered to the maximum of 3v (Do not connect it to the vcc of Arduino as it gives out 5v).
  • The connections (colored wires) of the ready module may change from time to time, any changes in the connections will be updated in the future articles on the same.

Install Required Libraries:

  •  https://github.com/adafruit/Adafruit-MLX90614-Library

The libraries can either be downloaded from GitHub and add the ZIP file in Arduino IDE using add .zip library( Sketch à Include LibraryàAdd .Zip Library) or you can install the libraries directly from Arduino IDE from Manage libraries.

#include <Wire.h>
#include <Adafruit_MLX90614.h>
Adafruit_MLX90614 mlx = Adafruit_MLX90614();
void setup () 
{
  Serial.begin(9600);
  Serial.println("Adafruit MLX90614 test"); 
  mlx.begin ();  
  mlx.writeEmissivityReg (62258);
  Serial.print("Emisivity: ");
  Serial.println(mlx. readEmissivityReg ());
}
void loop () 
{
Serial.print("Ambient = "); 
Serial.print(mlx. readAmbientTempC ()); 
Serial.print("*C\tObject = "); 
Serial.print(mlx. readObjectTempC ()); 
Serial.println("*C");
Serial.print("Ambient = "); 
Serial.print(mlx. readAmbientTempF ()); 
Serial.print("*F\tObject = "); 
Serial.print(mlx. readObjectTempF ()); 
Serial.println("*F");
Serial.println();
delay (500);
}

Upload the above code to the Arduino, once the code is uploaded, open the serial monitor and set the baud rate to 9600.Place the object to be measured at certain height and observe the temperature readings on the serial monitor.

Emissivity:

Emissivity is the measure of an object’s ability to emit infrared energy. Emitted energy indicates the temperature of the object. Emissivity can have a value from 0 (shiny mirror) to 1.0 (blackbody). Most organic, painted, or oxidized surfaces have emissivity values close to 0.95.

How to improve accuracy of the temperature sensor?

We can improve the accuracy of the temperature sensor by setting the correct Emissivity of the object we are trying to measure. Emissivity is the measure of an object’s ability to emit infrared energy. A perfect black body has an emissivity equal to 1. Aluminum foil has an emissivity of 0.07 and a paper has an emissivity of 0.9. To get accurate temperature results, you need to tell the MLX90614 the emissivity of the object we are trying to measure. Human Skin has an emissivity of 0.95. To get accurate temperature readings of the human skin we set the emissivity of the MLX90614 by using this function – write EmissivityReg (uint16_t ereg). Here ereg variable accepts values between 0 to 65536 for emissivity between 0.00 and 1.00.

To calculate the value of ereg, we use this formula

                                                                Ereg = 65536 *(object emissivity)-1

Leave a Reply

Your email address will not be published. Required fields are marked *

Exit mobile version