The MLX90614 reads temperature from the infrared light an object gives off, so it measures without touching. The GY-906 module (about ₹600) is popular for motor and bearing checks, cooking projects and contactless thermometers.
It is an I2C device at 0x5A. On the Uno it wires to SDA/SCL and, on boards with a regulator, to 5V. It reports two numbers: the object temperature it is looking at, and the ambient temperature of the sensor itself.
The quirks section below matters more than the code here. The sensor sees a wide cone, not a dot, so distance, shiny surfaces and glass all change the reading. The sketch prints both temperatures twice a second.
Wiring
| Arduino Uno R3 | MLX90614 IR thermometer (GY-906) | Wire | Notes |
|---|---|---|---|
| 5V | VIN | red | GY-906 boards with a small regulator (3 pins, often marked 662K) take 5 V. A bare sensor without one needs 3.3V. |
| GND | GND | black | |
| SCL | SCL | yellow | Same signal as A5 |
| SDA | SDA | blue | Same signal as A4 |
3.3 V (5 V versions with regulator) part, 5 V board. Check the chip marking: MLX90614BAA is a 3 V part, MLX90614AAA is 5 V. Most GY-906 boards with a regulator accept 3.3–5 V; power 3 V-only boards from 3.3 V.
Board quirks
- The board’s I2C pull-ups sit at its 3.3 V rail. The Uno reads 3.3 V as a HIGH, so the GY-906 works directly. Look for the regulator before feeding it 5 V.
- The common BAA version sees a 90° cone: at 5 cm it averages a spot about 10 cm wide. Hold the object close and fill that cone, or the reading mixes in the background.
- Shiny metal reflects IR and reads far too low (a hot steel pan can read like room temperature). Put a strip of black electrical tape on it and measure the tape.
- It isn’t a medical thermometer: skin reads 1–3 °C below body temperature and depends on distance. Fine for “is the motor hot?”, not for fever screening.
Code
// MLX90614 (GY-906) non-contact IR thermometer on an Arduino Uno R3, I2C at 0x5A.
// VIN → 5V (GY-906 has a regulator), GND → GND, SCL → SCL (A5), SDA → SDA (A4).
#include <Wire.h>
#include <Adafruit_MLX90614.h>
Adafruit_MLX90614 mlx;
void setup() {
Serial.begin(9600);
if (!mlx.begin()) {
Serial.println(F("MLX90614 not found at 0x5A - check SDA/SCL and power"));
for (;;) {}
}
Serial.println(F("MLX90614 ready. Hold objects 2-5 cm in front of the sensor."));
}
void loop() {
Serial.print(F("Object "));
Serial.print(mlx.readObjectTempC(), 1);
Serial.print(F(" C Ambient "));
Serial.print(mlx.readAmbientTempC(), 1);
Serial.println(F(" C"));
delay(500);
}// MLX90614 (GY-906) non-contact IR thermometer on an Arduino Uno R3, I2C at 0x5A.
// VIN → 5V (GY-906 has a regulator), GND → GND, SCL → SCL (A5), SDA → SDA (A4).
#include <Wire.h>
#include <Adafruit_MLX90614.h>
Adafruit_MLX90614 mlx;
void setup() {
Serial.begin(9600);
if (!mlx.begin()) {
Serial.println(F("MLX90614 not found at 0x5A - check SDA/SCL and power"));
for (;;) {}
}
Serial.println(F("MLX90614 ready. Hold objects 2-5 cm in front of the sensor."));
}
void loop() {
Serial.print(F("Object "));
Serial.print(mlx.readObjectTempC(), 1);
Serial.print(F(" C Ambient "));
Serial.print(mlx.readAmbientTempC(), 1);
Serial.println(F(" C"));
delay(500);
}Library: Adafruit MLX90614 Library (Adafruit) — compiled with Adafruit MLX90614 Library 2.1.7.
Expected serial output
MLX90614 ready. Hold objects 2-5 cm in front of the sensor.
Object 29.4 C Ambient 28.7 C
Object 61.8 C Ambient 28.8 CMLX90614 ready. Hold objects 2-5 cm in front of the sensor. Object 29.4 C Ambient 28.7 C Object 61.8 C Ambient 28.8 C
Common errors
“MLX90614 not found at 0x5A”
Check SDA/SCL and power, then run the I2C scanner. A reading of 0x5A means the wiring is fine.
Object always reads close to ambient
Too far away or aimed past the object. Move to 2–5 cm, and remember glass and plastic film block IR — you can’t measure through a window.
Object reads 1037.6 °C or −273 °C
A failed I2C read returns garbage. Shorten the wires and add 4.7 kΩ pull-ups from SDA and SCL to 3.3V if the board has none.