Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

How to Use Adafruit MLX90640 Thermal Camera: Examples, Pinouts, and Specs

Image of Adafruit MLX90640 Thermal CameraDesign with Adafruit MLX90640 Thermal Camera in Cirkit Designer

Introduction

The Adafruit MLX90640 Thermal Camera is a sophisticated infrared thermal imaging module that offers a 32x24 array of temperature readings, translating to 768 individual temperature measurements. This module is capable of detecting temperatures ranging from -40°C to 300°C, making it suitable for a wide array of applications including human presence detection, HVAC control, medical imaging, and more. Its I2C interface facilitates easy integration with microcontrollers such as the Arduino UNO.

Explore Projects Built with Adafruit MLX90640 Thermal Camera

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of Raspberry Pi 5 and MLX90640 Thermal Camera Imaging System with Battery Backup: A project utilizing Adafruit MLX90640 Thermal Camera in a practical application
Raspberry Pi 5 and MLX90640 Thermal Camera Imaging System with Battery Backup

This circuit features a Raspberry Pi 5 connected to an Adafruit MLX90640 Thermal Camera via I2C communication lines (GPIO 2 and GPIO 3 for SDA and SCL, respectively) and powered by a 24/12V buck converter. The buck converter steps down voltage from a 3S 10A Li-ion 18650 battery pack, which is managed by a charger protection board and charged through a lipo battery charger module. The Raspberry Pi runs code to capture and process thermal images from the camera.

Open Project in Cirkit Designer
Image of Arduino Mega 2560 Based Motion-Activated Thermal Camera with Bluetooth Connectivity: A project utilizing Adafruit MLX90640 Thermal Camera in a practical application
Arduino Mega 2560 Based Motion-Activated Thermal Camera with Bluetooth Connectivity

This circuit features an Arduino Mega 2560 microcontroller interfaced with a PIR motion sensor, a Bluetooth HC-06 module, and an Adafruit MLX90640 thermal camera. The Arduino controls an LED through a resistor, receives motion detection signals, communicates via Bluetooth, and processes thermal images. The microcontroller's code structure is set up but contains no specific functionality yet.

Open Project in Cirkit Designer
Image of Raspberry Pi 4B and mlx90614 Infrared Thermometer with Logic Level Conversion: A project utilizing Adafruit MLX90640 Thermal Camera in a practical application
Raspberry Pi 4B and mlx90614 Infrared Thermometer with Logic Level Conversion

This circuit connects a Raspberry Pi 4B to an MLX90614 infrared temperature sensor using an Adafruit 4-channel I2C-safe Bi-directional Logic Level Converter. The level converter is used to safely step down the 5V I2C signals from the Raspberry Pi to the 3.3V needed by the MLX90614 sensor, ensuring compatibility between the devices. Ground connections are shared among all components, and the sensor is powered by the Raspberry Pi's 5V supply through the level converter.

Open Project in Cirkit Designer

Technical Specifications

Key Technical Details

Pin Configuration and Descriptions

Pin Number Name Description
1 VDD Power supply (3.3V to 5V)
2 SDA I2C Data Line
3 SCL I2C Clock Line
4 GND Ground

Usage Instructions

Integration with a Circuit

  1. Power Supply: Connect the VDD pin to a 3.3V or 5V power supply from your microcontroller board.
  2. Data Line: Connect the SDA pin to the I2C data line (SDA) on your microcontroller.
  3. Clock Line: Connect the SCL pin to the I2C clock line (SCL) on your microcontroller.
  4. Ground: Connect the GND pin to the ground on your microcontroller.

Important Considerations and Best Practices

Example Code for Arduino UNO

#include <Wire.h>
#include <Adafruit_MLX90640.h>

Adafruit_MLX90640 mlx;

void setup() {
  Serial.begin(9600);
  while (!Serial); // Wait for Serial to be ready
  Serial.println("MLX90640 test");

  if (!mlx.begin()) {
    Serial.println("Failed to initialize MLX90640!");
    while (1);
  }
  Serial.println("MLX90640 initialized successfully");
}

void loop() {
  float mlx90640Frame[32 * 24]; // Buffer to store temperature readings

  // Capture the frame at the lowest resolution to increase the frame rate
  mlx.setMode(MLX90640_INTERLEAVED);

  // Request a frame capture
  if (mlx.getFrame(mlx90640Frame) == 0) {
    for (int i = 0; i < 24; i++) {
      for (int j = 0; j < 32; j++) {
        float temp = mlx90640Frame[i * 32 + j];
        Serial.print(temp);
        Serial.print(",");
      }
      Serial.println();
    }
  } else {
    Serial.println("Failed to read frame");
  }
  delay(1000); // Wait for 1 second before capturing next frame
}

Troubleshooting and FAQs

Common Issues

Solutions and Tips

FAQs

Q: Can the MLX90640 be used to measure human body temperature? A: Yes, the MLX90640 can be used for human temperature detection, but it requires proper calibration and possibly additional optics for accurate measurements.

Q: What is the maximum distance at which the MLX90640 can accurately measure temperature? A: The maximum distance depends on the object size and the sensor's field of view. For small objects, the sensor should be closer to ensure accuracy.

Q: How can I increase the frame rate of the thermal camera? A: You can increase the frame rate by reducing the resolution or changing the refresh rate settings in the library, but this may affect the temperature accuracy and range.