Language: EN

arduino-y-el-termometro-infrarrojo-a-distancia-mlx90614

Arduino and the MLX90614 Infrared Thermometer

The MLX90614 is a non-contact infrared temperature sensor manufactured by Melexis. It is possible to connect these sensors with a programmable logic controller or processor like Arduino to measure the temperature of an object from a distance.

There are different models of the MLX90614, each with a three-letter suffix. The different sensors differ in operating voltage, the number of infrared sensors, and the position of the filter.

Communication is carried out via SMBus, a subset of I2C bus, making it easy to read and possible to connect more than one sensor simultaneously.

Infrared thermometers like the MLX90614 have a wide range of applications, including temperature control systems in thermal installations in buildings, industrial temperature control, motion detection, and health applications.

Price

The MLX90614 is a relatively expensive sensor. Among the cheaper models is the MLX90614ESF-BAA model, with a supply voltage of 3V, a viewing angle of 80º, a single infrared sensor, and an internal filter. It can be found for around 4€, by searching international sellers on eBay and AliExpress.

arduino-sensor-temperatura-infrarrojo-mlx90614-componente

The MLX90614ESF-DCI model, which has a 5º field of view, and can be seen in some projects to “emulate” a thermal camera through scanning, is much more expensive, around 20€.

There are other modules with the MLX90615 sensor, which is a smaller variation of the MLX90614, but in general we will not be interested since it has lower precision and is slightly more expensive.

How does the MLX90614 work

According to the Stefan-Boltzmann law, any object above absolute zero (ºK) emits radiation whose spectrum is proportional to its temperature. The MLX90614 collects this radiation and its output is an electrical signal proportional to the temperature of all the objects in its field of view.

arduino-sensor-temperatura-infrarrojo-mlx90614-radiacion-cuerpo-negro

Internally, the MLX90614 consists of a silicon chip with a thin micromachined membrane sensitive to infrared radiation, along with the necessary electronics to amplify and digitize the signal and calculate the temperature.

The assembly includes a low noise amplifier, a 17-bit ADC, a DSP (digital signal processor), and ambient temperature compensation.

arduino-sensor-temperatura-infrarrojo-mlx90614-interior

The MLX90614 comes factory calibrated over a wide temperature range: -40 to 85 °C for ambient temperature and -70 to 382 °C for object temperature. The standard accuracy is 0.5 °C with respect to ambient temperature, although there are medical versions that offer a resolution of 0.1ºC at temperatures between 35-38ºC.

arduino-sensor-temperatura-infrarrojo-mlx90614-precision

The MLX90614 has two output modes. The standard mode is SMBus, a subset of I2C, with a resolution of 0.02ºC. It can also use a 10-bit PWM output for continuous measurements, although with lower resolution of 0.14ºC.

It is important to note that the sensor reading is only stable when the sensor is in thermal equilibrium with the environment. Dirt on the sensor window can also affect it.

It is also important to understand that the MLX90614 is sensitive to all objects located in its field of view. The field of view angle depends on the model, and varies from 5º to 80ºC. At the widest angle of 80º, the measurement area at 0.5 has a diameter of 0.83 meters.

In other words, models with a smaller angle are suitable for point measurements in front of the sensor. Wide-angle sensors are designed to detect temperature increases in a large area, for example, for detecting faults in machinery.

Wiring diagram

The connection is simple, we just power the module from Arduino using GND and 5V and connect the SDA and SCL pins of Arduino with the corresponding pins of the sensor.

arduino-sensor-temperatura-infrarrojo-mlx90614-esquema

While the connection from the Arduino side would look like this.

arduino-sensor-temperatura-infrarrojo-mlx90614-conexion

On Arduino Uno, Nano, and Mini Pro, SDA is pin A4 and SCK is pin A5. For other Arduino models, check the pinout diagram accordingly.

Check that your board is compatible with 5V before connecting it to Arduino. If not, you will need to use a logic level adapter.

Code examples

To read the MLX90614, we will use the library developed by Sparkfun, available at this link.

The library provides code examples, which is advisable to review. The following example is a modification based on those available in the library, which reads the sensor and displays the results via serial port.

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

Adafruit_MLX90614 mlx = Adafruit_MLX90614();

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

  mlx.begin();  
}

void loop() {
  Serial.print("Ambient = ");
  Serial.print(mlx.readAmbientTempC()); 
  Serial.print("ºC\tObject = "); 
  Serial.print(mlx.readObjectTempC()); 
  Serial.println("ºC");
  delay(500);
}