MLX90614 Infrared Non-contact Temperature Sensor
The MLX90614 series module is a set of general-purpose infrared temperature measurement modules. The module has been calibrated and linearized before leaving the factory, offering advantages such as non-contact operation, small size, high accuracy, and low cost. Both the measured target temperature and the ambient temperature can be output through a single channel, with two output interfaces. This makes it suitable for applications in automotive air conditioning, indoor heating, home appliances, handheld devices, and medical equipment, among others.Temperature measurement methods can be divided into contact and non-contact types. Contact temperature measurement only measures the temperature after thermal equilibrium between the measured object and the temperature sensor, which has a longer response time and is highly susceptible to environmental temperature. In contrast, infrared temperature measurement determines the object's temperature based on its infrared radiation energy, without contacting the object. It is not affected by the temperature distribution field of the object being measured, has high temperature resolution, fast response, a wide temperature range, no upper temperature limit, and good stability. For these reasons, we choose the MLX90614 as the infrared temperature measurement module.
The communication between the microcontroller and the MLX90614 infrared temperature module is based on a "class IIC" communication protocol, which means the communication method is similar to IIC but not exactly the same. It has another name called SMBus (System Management Bus). SMBus was proposed by Intel in 1995 as an efficient, synchronous serial bus. SMBus only uses two signal lines: a bidirectional data line and a clock signal line. It allows the CPU to communicate with various peripheral interface devices in a serial manner, improving data transfer speeds and reducing the resource occupation of devices. Additionally, even without an SMBus interface on the microcontroller, software simulation can be used.
Module Source
Purchase Link:
https://item.taobao.com/item.htm?spm=a1z09.2.0.0.204e2e8d2hPeAl&id=609920555320&_u=h2t4uge53d5e
Baidu Netdisk Download Link: https://pan.baidu.com/s/1AsEBvVCiNAvTKqTeGSA60w
Password: g06n
Specifications
Operating Voltage: 4.5~5.5V
Operating Current:1.3~2.5mA
Communication Method:I2C
Hardware Connection
- VCC: Connect to the 5V of the development board.
- GND: Connect to the GND of the development board.
- SCL (Clock Line): Connect to A5 (SCL) on the development board.
- SDA (Data Line): Connect to A4 (SDA) on the development board.
Usage Method
Install Library
To read the temperature from the MLX90614, we can use the Adafruit_MLX90614
library. It can be installed via the Arduino IDE's Library Manager: Open Arduino IDE, go to Tools > Manage Libraries, then search for MLX90614
and install the Adafruit MLX90614 Library
.
Enter the code:
This code first uses the Adafruit_MLX90614
library to initialize the sensor, then in the loop, it reads the ambient temperature and object temperature, and finally outputs the readings through the serial monitor. The example code will output the temperature readings in Celsius, but if needed, you can modify the methods (e.g., using readAmbientTempF()
and readObjectTempF()
) to read the temperature in Fahrenheit instead.
/******************************************************************************
* Test Hardware: LCSC ColorEasyDuino Development Board
* Version Number: V1.0
* Modified By: www.lckfb.com
* Modification Date: April 8, 2024
* Function Overview:
*****************************************************************************
* Open-source development board hardware and software information and related projects hardware and software information on official website
* Development board official website: www.lckfb.com
* Technical support resident forum, any technical problems are welcome at any time to exchange learning
* LCSC Forum: club.szlcsc.com
* Follow our Bilibili account: [立创开发板], stay toned to our latest news!
* We focus on cultivating Chinese engineers rather than profiting from board sales.
******************************************************************************/
#include <Wire.h>
#include <Adafruit_MLX90614.h>
Adafruit_MLX90614 mlx = Adafruit_MLX90614();
void setup() {
Serial.begin(9600);
if (!mlx.begin()) {
Serial.println("Couldn't find MLX90614 sensor!");
while (1);
}
}
void loop() {
Serial.print("Ambient = "); Serial.print(mlx.readAmbientTempC());
Serial.print("*C\tObject = "); Serial.print(mlx.readObjectTempC()); Serial.println("*C");
delay(500); // 稍作延迟
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Usage Testing
The serial output shows "Ambient" as the ambient temperature, and "Object" as the temperature of the measured object.