Part

IR thermometer, MLX90614

Reads the temperature of what it points at, and its own, over SMBus at 0x5A.

See every part
  • 4 pins
  • 2 settings
  • In 1 project
  • In 1 lesson
Drawn live by the editor's own code, at the size you see it.
At a glance

The IR thermometer, MLX90614 in brief

What it is, and every setting the properties panel gives it.

The MLX90614, usually on the GY-906 breakout, is a non-contact infrared thermometer: a thermopile behind a window reads the temperature of whatever it points at, and a thermistor in the can reads the ambient. The board has four pins, VIN, GND, SCL and SDA, takes 3 to 5 volts and answers at SMBus address 0x5A, so on an Uno it wires to 5 V with SDA on A4 and SCL on A5, and on an ESP32 to 3.3 V with GPIO 21 and 22. Mokxi runs the datasheet’s SMBus read word, including the packet error code so a library that checks it is satisfied. RAM 0x06 holds the ambient and 0x07 the object, in fiftieths of a kelvin, and EEPROM writes need a correct code. Two sliders set the object temperature, -70 to 380 degrees Celsius, and the ambient, -40 to 125. The Adafruit_MLX90614 library works unchanged. Common mistakes are measuring something far away, which a real one’s 90 degree field of view blurs into the room, and sharing 0x5A with an MPR121. Emissivity’s effect, field of view and sleep mode are not modeled.

Family
Sensors
Pins
4
object
36.6
ambient
22
Pins

4 pins

Named as the editor names them, so a wire lands where you expect it.

Pin
What it does
VIN
Supply, 3 V to 5 V on the GY-906.
GND
Ground.
SCL
SMBus (I2C) clock.
SDA
SMBus data.
How to use it

How to use the MLX90614 with an Arduino

Wire VIN to 5 V, GND to GND, SDA to SDA and SCL to SCL. It shares the bus happily with an I2C LCD at 0x27, as in the fever thermometer, because it answers at 0x5A. Call mlx.begin() in setup() and stop with a message if it returns false: check SDA, SCL and power before anything else.

Then mlx.readObjectTempC() is the temperature of what it points at and mlx.readAmbientTempC() its own. Both return floats; the example multiplies by ten and rounds, so the 38.0 C fever test and the display work in whole tenths. Drag the object slider on the part past 38 and the LCD says FEVER while the piezo beeps.

Part pin
Board pin
VIN
5 V
GND
GND
SDA
SDA (A4)
SCL
SCL (A5)

The GY-906 runs from 3 V up, so on an ESP32 power it from 3.3 V and use GPIO 21 and 22 for SDA and SCL.

Arduino Uno: fever thermometerlive0.000 s 0.00x
Click to open it in the editor
This is the simulator itself, running here. Click anything to open it in the editor.
Object and ambient with the Adafruit library
#include <Wire.h>
#include <Adafruit_MLX90614.h>
Adafruit_MLX90614 mlx = Adafruit_MLX90614();
void setup() {
  Serial.begin(115200);
  if (!mlx.begin()) while (1) delay(10);
}
void loop() {
  Serial.println(mlx.readObjectTempC());
  delay(500);
}
How it is modeled

What is true about the IR thermometer, MLX90614, here

In its help article’s own words: what the simulation gets right, and where it stops.

Modeled

From the MLX90614 datasheet:

The read. An SMBus "read word": the command, a repeated start, then the low byte, the high byte and a packet error code (a CRC-8 over the whole exchange). The model computes the code the datasheet's way, so a library that checks it is satisfied.

The registers. RAM 0x06 is the ambient and 0x07 the object, in fiftieths of a kelvin: T = word x 0.02 - 273.15 C. 0x08, the second zone, answers with its error flag set on this single-zone part.

The EEPROM. The emissivity at 0x24 (0xFFFF for 1.0) and the address at 0x2E read back, and a write with a correct code is stored; a wrong code is refused.

The ranges. The ambient -40 to 125 C and the object -70 to 380 C.

Not modeled

The emissivity's effect on the reading, the field of view (it sees only the object on the slider), the chip's filter and its settling time, sleep mode and the PWM output.

From IR thermometer, MLX90614, in full.

Projects

See the IR thermometer, MLX90614 in a project

One built-in project uses it. It opens in the editor, already wired.

Lessons

Where it turns up in a lesson

One lesson places it in its own circuit.

Boards

The boards it is shown on

This board has a built-in project with the IR thermometer, MLX90614 in it.

Libraries

Arduino libraries for the IR thermometer, MLX90614

Built in, so the sketch compiles with nothing to install. Each page has the calls, the wiring and an example to run.

Wire up the IR thermometer, MLX90614

Open the editor and push it into the breadboard. It is free, and it runs on your own machine.