Measuring Temperature with the MLX90614 Infrared Sensor Using Arduino IDE

MLX90614 is a digital infrared temperature sensor developed and produced by Melexis. It can measure the surface temperature of an object without contact, achieving temperature measurement by measuring infrared radiation, making it very suitable for applications that require avoiding contact with the target object or need to measure temperature in high-temperature environments.

Here are some key features and functions of the MLX90614 infrared temperature sensor:
Non-contact temperature measurement: The MLX90614 uses infrared radiation technology to achieve temperature measurement of the surface of the target object without direct contact.
Digital output: This sensor outputs a digital signal that can be directly connected to a microcontroller or digital device for data processing and analysis.
High precision: The MLX90614 has very high temperature measurement accuracy, which can meet the requirements of many applications.
Dual temperature measurement: The sensor has two independent temperature measurement units, one for measuring the surface temperature of the target object and the other for measuring the temperature of the sensor chip.
Wide operating temperature range: The MLX90614 is suitable for a wide operating temperature range, including normal and high-temperature environments.
Low power consumption: The sensor has low power consumption characteristics, which can effectively save energy during use.
I2C bus interface: The MLX90614 uses a standard I2C bus interface, making it easy to communicate and integrate with various microcontrollers and other digital devices.
Compact design: The sensor is small in size and easy to integrate into various devices and systems.

Measuring Temperature with the MLX90614 Infrared Sensor Using Arduino IDE

In this issue, we will quickly implement the initialization and data acquisition of this temperature sensor using Arduino IDE and ESP32.
Arduino IDE (Integrated Development Environment) is a software tool for writing and uploading code to Arduino boards. It is a free and open-source software developed by the Arduino development team, aimed at simplifying the development and programming process for users of the Arduino platform.
This is also why I really like using Arduino IDE.

Measuring Temperature with the MLX90614 Infrared Sensor Using Arduino IDE

Install the MLX90614 library in Arduino IDE.

Measuring Temperature with the MLX90614 Infrared Sensor Using Arduino IDE

You can see the initialization content in its source file, which defaults to using Wire(D21, D22), so we will connect the sensor’s SCL to D21 and SDA to D22.
#include <Wire.h>//Include I2C library#include <Adafruit_MLX90614.h>//Include MLX library
Adafruit_MLX90614 mlx;//Define an mlx variable
void setup() {  // put your setup code here, to run once:  Serial.begin(115200);  Wire.begin();//Default initialize D21, D22  mlx.begin();//Default function only}
void loop() {  // put your main code here, to run repeatedly:    double Obj =  mlx.readObjectTempC();//Read object temperature    double Amb = mlx.readAmbientTempC();//Read ambient temperature    Serial.println("Object Temperature:" + String(Obj) + "\r\n" + "Ambient Temperature:" + String(Amb));    delay(1000);}
We only need to define a variable for MLX90614, call begin to initialize, and finally read the surface temperature and measurement temperature.
Then we output the temperature we measured.
Open the serial monitor to check.
  • Idle Temperature

Measuring Temperature with the MLX90614 Infrared Sensor Using Arduino IDE

You can see that when not measuring, the difference between the surface temperature and the ambient temperature is not very large.
  • Hand Temperature

Measuring Temperature with the MLX90614 Infrared Sensor Using Arduino IDE

After applying the palm, the temperature is about 36.49℃, which is roughly the human body temperature.
  • Liquid Temperature

Measuring Temperature with the MLX90614 Infrared Sensor Using Arduino IDE

Pointing at the liquid, it is about 26.91 degrees Celsius.
Then let’s modify the code here to add wireless transmission.
  • Refrigerator Fresh Layer

Measuring Temperature with the MLX90614 Infrared Sensor Using Arduino IDE

This is the data measured with the sensor placed in the refrigerator fresh layer.
  • Refrigerator Freezing Layer

Measuring Temperature with the MLX90614 Infrared Sensor Using Arduino IDE

Refrigerator freezing layer data

Leave a Comment

×