Create Makers

MLX 90614 Contactless Infrared Temperature Sensor

MLX 90614 Contactless Infrared Temperature Sensor

Disclosure: Some of the links below are affiliate links and we only earn a small commission if you purchase through our links at no additional cost to you. The earning mainly used for maintaining the website.

One of the easiest ways to measure temperature is to place a thermometer close to an object. And this requires some physical contact with that object.

Forget about physical contact to measure the temperature. A Contactless Infrared temperature sensor, the MLX90614, can measure the temperature without even touching the object.

This tutorial covers the basics of the MLX90614 interface with Arduino to read the temperature in Degree Celsius and Fahrenheit.

Working Principle of Infrared Temperature Sensor

According to Stefan-Boltzmann law, the infrared radiation from the black body per unit surface area is directly proportional to the power of four of the black body’s temperatures.

Infrared Radiation

So, what this sensor does. There are an IR-sensitive thermopile detector and a signal-conditioning chip that converts infrared energy into electrical energy.

MLX90614 Tutorial Starter Pack

  1. Arduino Uno/Mega/Nano
  2. MLX90614
  3. Breadboard
  4. Jumper Wires

Wiring MLX90614 Module to Arduino

Before making any wiring, make sure to check your MLX90614 sensor model. I am using the “BAA” option code.

Absolute Maximum Rating for MLX90614
Absolute Maximum Rating for MLX90614, extracted from Melexis, Datasheet for MLX90614, page 7

As can see from the “BAA” model, the safe supply voltage is around 3.6V. The module does have a 5V regulator, but I have burned the module when connected to 5V from the Arduino.

The wiring is easy and only has four pins to connect.

Vin

3.3V

GND

Ground

SCL

SCL/A5

SDA

SDA/A4

MLX90614 Module PinoutVINGNDSCLSDA

Arduino Program For MLX90614

Interfacing with Arduino is easy and has no complexity here. First, download and include libraries for MLX90614. Second, write the codes. You have made it. Sound too simple? That simple.

#include <Wire.h>
#include <Adafruit_MLX90614>

Adafruit_MLX90614 mlx = Adafruit_MLX90614();

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


void loop() {
  Serial.print("Ambient = ");
  Serial.print(mlx.readAmbientTempF());
  Serial.print("*F ");
  Serial.print("*Object = ");
  Serial.print(mlx.readObjectTempF());
  Serial.print("*F\t");

  Serial.print("Ambient = ");
  Serial.print(mlx.readAmbientTempC());
  Serial.print("*C ");
  Serial.print("*Object = ");
  Serial.print(mlx.readObjectTempC());
  Serial.println("*C");
  delay(250);
}

Libraries for Programming MLX90614

Go to Tools > Manage Libraries

Search for “mlx90614”. Select “Adafruit MLX90614 Library” by Adafruit. In my case is the second library. Click to install if you have not.

Go to Sketch > Include Library. Select “Adafruit MLX90614 Library”.

Go to Sketch > Include Library. Select “Wire”.

#include <Wire.h>
#include <Adafruit_MLX90614>

<Wire.h>: Allows communication with I2C/TWI devices.

Adafruit_MLX90614.h>: Library for MLX90614 to work with Arduino.

Declare Variables

Adafruit_MLX90614 mlx = Adafruit_MLX90614();

Create “mlx” as an object of class “Adafruit_MLX90614”. Any name will do, not necessary to be “mlx”. Pass object “mlx” as an argument to function “Adafruit_MLX90614”.

Void setup()

Codes will run once here.

Serial.begin(9600);

Start communication at desired speed (baud – data rate in bits per second). So that Arduino can send data to computer at Serial Monitor.

mlx.begin();

Initialize MLX90614 sensor.

Void loop()

Codes will run repeatedly here.

As we have already created “mlx” as object of the class “Adafruit_MLX90614”, we can now pass the function to it. For this tutorial we use:

  1. mlx.readAmbientTempC();
  2. mlx.readObjectTempC();
  3. mlx.readAmbientTempF();
  4. mlx.readObjectTempF();

Temperature in Degree Celsius

Serial.print(mlx.readAmbientTempC());

To read ambient temperature in degree Celsius.

Serial.print(mlx.readObjectTempC());

To read object temperature in degree Celsius.

Serial.print("Ambient = ");
Serial.print(mlx.readAmbientTempC());
Serial.print("*C ");
Serial.print("Object = ");
Serial.print(mlx.readObjectTempC());
Serial.println("*C");

Temperature in Degree Fahrenheit

Serial.print(mlx.readAmbientTempF());

To read ambient temperature in degree Fahrenheit.

Serial.print(mlx.readObjectTempF());

To read object temperature in degree Fahrenheit.

Serial.print("Ambient = ");
Serial.print(mlx.readAmbientTempF());
Serial.print("*F ");
Serial.print("Object = ");
Serial.print(mlx.readObjectTempF());
Serial.println("*F");

Nay! We Love Videos

Bye Bye

We have covered up reading temperature in Degree Celsius (“mlx.readAmbientTempC()” and “mlx.readObjectTemC()”) and Fahrenheit (“mlx.readAmbientTempF()” and “mlx.readObjectTemF()”) using the MLX90614 contactless infrared temperature sensor.

Hope you find this tutorial helpful in your projects. Subscribe to our newsletter for more tutorials.

Subscribe
Notify of
guest
0 Comments
Oldest
Newest
Inline Feedbacks
View all comments