Infrared Temperature Sensor

From Diustou Wiki
Infrared Temperature Sensor

Contact-less Infrared Temperature Sensor


Categories: Modules, Sensors

Brand: 丢石头





Related products



Contact_less Infrared Temperature Sensor

How to use


  1. VCC: 3.3V~5V
  2. GND: GND

Communication Protocol

This sensor has both digital PWM and SMBus (System Management Bus) output. In this document, we only introduce SMBus communication. SMBus is a 2 wires interface based on I2C principle. You can treat SMBus as a simplified I2C. Start Signal: SCL is HIGH, SDA hops from HIGH to LOW, begin to transmit data.


Stop signal: SCL is HIGH, SDA hops from LOW to HIGH, transmission is finished. ACK: Every time Master (Slave) receives 8-bits data from Slave (Master), it will send an ACK back to the sender to inform that data has been transmitted successfully by holding the SDA inactive for a whole SCL period


Every time Slave Device (SD) receives every 8-bits data, it will respond an ACK/NACK.

  1. Master Devices (MD) will send an address of SD after initializing communication. Only the corresponding SD who can recognize the address will confirm, others keep silent.
  2. If no any SD confirm the address, MD will cut off the communication and send the information again.

Note: The calculation result of PEC is based on all the bits except START, REPEATED START, STOP, ACK and NACK. PEC is a polynomial (X8+X2+X1+1) of CRC-8. Every byte is transmitted MSB first.

Read Timing of SMBus

  1. MD will send a Start signal, then 8-bits data to SD. The data are combined with the 7-bits address of SD and “Read” operation bit. SD will respond an ACK back after receiving.
  2. MD send an 8-bits command to SD, the SD will reply an ACK.
  3. MD send an Start signal and the 8-bits data which is combined with the 7-bits address of SD and “Read” operation bit again. SD will reply an ACK and send the data on its register to MD after receiving them.

Note: MD should send an ACK back every time it receives a byte. If MD receives PEC, it will send the Stop signal to stop communicating after ACK.

Write Timing of SMBus

  1. MD send a Start signal, and send an 8-bits data which is combined with 7-bits address of SD and “Write” operation bit to SD. SD will respond an ACK signal.
  2. The MD send an 8-bits command to SD and get the ACK from SD.
  3. MD send low bytes of data first, after get the ACK it will send the high bytes. Get the ACK then send the PEC bytes.
  4. At the last send the Stop signal to stop the communication.

RAM registers of MLX90614


EEPROM Registers of MLX90614


Commands of MLX90614


Note*: xxxxx stands for the low 5 bits of the address of RAM/ EEPROM registers which are read and written Note**: Like Read command. MLX90614 will respond PEC after send 16-bits data. Only 4 bits of PEC are necessary for MD. MD will stop communicating after send the last byte. The difference between Read and Read Identifier is that Read Identifier don’t repeat start bit. Read Identifier:

  • Data[7] - EEBUSY – The operation Read/Write on EEPROM is ongoing, High active.
  • Data[6] – Unused
  • Data[5] - EE_DEAD - EEPROM occurs Double Fault. Active High
  • Data[4] - INIT – POR is initializing. Active Low.
  • Data[3] – Nonexecution.
  • Data[2..0] and Data[8..15] – 0.

Program analysis

According to the protocol of SMBus and its timing we can know that. Master will send a Start signal at the beginning. Then send an 8-bits data which is combined with 7-bits address of Slave and Read/Write operation bit. If there is only one MLX90614 sensor, the 7-bits address is 0x00 by default. If there are more than one MLX90614 on the bus, we can change the Slave address on EEPROM. With the Start signal, if we want to read the MLX90614, we need to send (SA<<1) + 0 = 0x00 next. If we want to write, we need to send (SA<<1) + 1 = 0x01 next. According to the RAM register address form above, the address of Ambient Temperature register is 0x06, and it is 0x07 of Object Temperature register on RAM. With the command form, we can know the operation code that access RAM is 0x00, and 0x20 access the EEPROM. Generally, we read temperature value from RAM, needn’t to read the EEPROM. To access the Ambient Temperature register on RAM, the command is: 0x00 | 0x06 = 0x06. And use command: 0x00 | 0x07 = 0x07 to access the Object Temperature register. Using STM32F code as examples, the driver uses PB8 and PB9 to simulate the timing of SMBus. The driver code is on smbus.c file. We read the data of ambient and object temperature according the timing introduced above, then calculate the ambient temperature and object temperature refer to datasheet. Celsius degree(°C): ((TempData_H <<8) + TempData_L )*0.02 - 273.15

Measure Principle

For non-contact infrared temperature measuring module, Field of view (FOV) is a very important concept. The FOV is determined by the 50% radiation signal received by the thermoelectric pile. And it is related to spindle axis of sensor. The temperature detected is the weighted mean of the object temperature detected on FOV. So, the value is most correct while the object cover the whole FOV.


The sensor of this module is MLX90614ESF-BCC, the figure above is the FOV figure of BCC , FOV = 35°. It is that: Radius of the measured object÷Distance from the sensor probe = tan35°, It is that if the radius of the measured object is 5CM, the Max measure distance is 7CM (Ensure that the temperature value is accurate) General FOV figures of BAA:


Comparing these two sensors, the result of the operational test: Take the temperature of palm as reference, if the BCC is within 7CM of the palm, the temperature is almost invariant. If the distance increased to 15CM, the temperature only reduces 1°C. As the BAA, the temperature has changed fast when it is 2CM away from the palm. Temperature reduces 1°C when the distance increased to 4CM. It is obvious that BCC is better than BAA in performance. The distance and accuracy of measurement is relative to FOV, the FOV smaller, the performance is better.

Operation Phenomenon

Using NUCLEO-F103RB and Arduino UNO development as examples.

  1. Connecting the VCC of infrared temperature sensor to NUCLEO-F103RB’s 3.3V or 5V. GND to GND, SCL to PB8 and SDA to PB9
  2. Open the code with keil.\ MDK-ARM \ Infrared-Temperature-Sensor-Code.uvprojx, Compile it and Download
  3. Open the serial software, choose the correct Port and set: Baudreate: 115200; DataBit: 8; StopBit: 1; ParityBit: None; Control flow: None
  • Arduino UNO
  1. Connecting the VCC of infrared temperature sensor to NUCLEO-F103RB’s 3.3V or 5V. GND to GND, SCL to SCL and SDA to SDA
  2. Copy the WaveShare_MLX90614 folder to Arduino\libraries folder which is under the installation directory of Arduino IDE. Click File --> Examples --> WaveShare_MLX90614--> WaveShare_MLX90614 to open the code. Compile it and Upload.
  3. Click Tools -> Port to choose Port of Arduino board, open the serial monito, set it as line ending, 115200baud.
  • Expected Result

Make the probe of the sensor facing a heat source, like the palm, then the serial will print the data measured as below:





Icon-mail.png Contact us

Working hours: 09:00-18:00 (UTC+8 Monday to Saturday)