

The MLX90640 BAB is a high-resolution thermal imaging sensor designed to detect temperature variations across a wide field of view. It features a 32x24 pixel infrared (IR) array, enabling precise thermal imaging and non-contact temperature measurement. The sensor communicates via the I2C protocol, making it easy to integrate into microcontroller-based systems. Its compact design and high accuracy make it ideal for applications such as temperature monitoring, thermal imaging cameras, HVAC systems, and industrial process control.








The MLX90640 BAB module typically has the following pinout:
| Pin | Name | Description |
|---|---|---|
| 1 | VDD | Power supply (3.3V to 3.6V) |
| 2 | GND | Ground |
| 3 | SDA | I2C data line (connect to microcontroller SDA) |
| 4 | SCL | I2C clock line (connect to microcontroller SCL) |
| 5 | NC | Not connected (leave unconnected or floating) |
Below is an example of how to interface the MLX90640 BAB with an Arduino UNO using the Adafruit MLX90640 library:
#include <Wire.h>
#include <Adafruit_MLX90640.h>
// Create an instance of the MLX90640 object
Adafruit_MLX90640 mlx;
// Define the frame buffer to store thermal data
float frame[768]; // 32x24 = 768 pixels
void setup() {
Serial.begin(115200);
Wire.begin();
// Initialize the MLX90640 sensor
if (!mlx.begin(0x33)) { // Default I2C address is 0x33
Serial.println("Failed to find MLX90640 sensor!");
while (1);
}
// Set the refresh rate to 8Hz
mlx.setMode(MLX90640_CHESS);
mlx.setRefreshRate(MLX90640_8_HZ);
Serial.println("MLX90640 initialized successfully!");
}
void loop() {
// Read thermal data from the sensor
if (mlx.getFrame(frame) != 0) {
Serial.println("Failed to read frame data!");
return;
}
// Print the temperature values for each pixel
for (int i = 0; i < 768; i++) {
Serial.print(frame[i], 2); // Print temperature with 2 decimal places
Serial.print(" ");
if ((i + 1) % 32 == 0) { // New line after every 32 pixels
Serial.println();
}
}
delay(125); // Delay to match the 8Hz refresh rate
}
No Communication with the Sensor
Inaccurate Temperature Readings
Sensor Overheating
Frame Data Errors
Can the MLX90640 BAB detect human presence?
What is the maximum distance for accurate temperature measurement?
Can I use the MLX90640 BAB with a 5V microcontroller?
How do I change the I2C address of the sensor?