Wiring
We'll be using the MLX90640 IR Thermal Camera Breakout to display an animated image comprised of thermal data to our notebook.
This breakout contains a 24x32 array of IR thermal sensors. When it's connected to the MCP2221, it returns an array of 768 individual infrared temperature readings over I2C. We'll read these values, manipulate, and display them in our Jupyter Notebook.
The MCP2221 and MLX90640 both have STEMMA QT connectors, so you can either wire it up on a breadboard or use a STEMMA QT cable.


Then, download the example Jupyter notebook:
Code Usage
In the Jupyter file browser, click Upload. From the file browser, select the MLX90640 Thermal Camera.ipynb example.
Click the Run button to execute the first cell. This cell first sets an environment variable so Blinka knows we're using the MCP2221 sensor.
Then, it installs the adafruit-circuitpython-mlx90640
library for interfacing with the thermal camera breakout .
The next code cell imports CircuitPython libraries such as board
, busio
, and adafruit_mlx90640
. Then, it initializes an I2C connection with the sensor and creates a mlx
object.
We also set the refresh rate to 1HZ for this notebook.
Before continuing, make sure your code prints the MLX was found on I2C.
If it the MCP2221 was unable to detect the MLX breakout, unplug the sensor and plug it back in. Then, restart the Jupyter kernel by clicking Kernel->Restart.
Click run on the next cell. This cell reads data from the thermal camera and splits it into a 32x24 array of thermal readings. We're using the numpy package so we can do perform fast manipulations to the data within the array.
The next cell plots the data read from the previous cell. Click run to see a heatmap of your data.
This sensor reads the data twice per frame, in a checker-board pattern, so it's normal to see a checker-board dither effect when moving the sensor around - the effect isn't noticable when things move slowly.
The final cell in this notebook produces a live heat-map from your thermal camera. Point the camera towards yourself and click run.
Note: This GIF has been sped up (2x), we suggest moving very slowly to avoid a dithering effect.
Page last edited March 08, 2024
Text editor powered by tinymce.