
Adafruit MLX90640 IR Thermal Camera
Created by Kattni Rembor
Last updated on 2021-02-09 12:10:57 PM EST

2
3
6
6
7
7
8
8
9
9
9
9
9
10
10
10
10
10
10
11
11
11
11
11
11
12
12
12
12
13
14
14
18
18
18
19
19
20
23
24
24
24
24
28
28
28
28
Guide Contents
Guide Contents
Overview
Pinouts
Power Pins
I2C Logic Pins
STEMMA Connectors
Arduino Libraries
Library Installation
Arcada Libraries
Install Libraries
Adafruit Arcada
If you aren't running Arduino IDE 1.8.10 or later, you'll need to install all of the following!
Adafruit NeoPixel
Adafruit FreeTouch
Adafruit Touchscreen
Adafruit SPIFlash
Adafruit Zero DMA
Adafruit GFX
Adafruit ST7735
Adafruit ILI9341
Adafruit LIS3DH
Adafruit Sensor
Adafruit ImageReader
ArduinoJson
Adafruit ZeroTimer
Adafruit TinyUSB
Adafruit WavePlayer
SdFat (Adafruit Fork)
Audio - Adafruit Fork
Arduino Docs
Arduino Thermal Camera
Loading the Example
Python & CircuitPython
CircuitPython Microcontroller Wiring
Python Computer Wiring
CircuitPython Installation of MLX90640 Library
Python Installation of MLX90640 Library
CircuitPython & Python Usage
Python Docs
CircuitPython Thermal Camera
CircuitPython Microcontroller Wiring
CircuitPython Installation of Additional Libraries
CircuitPython PyBadge/PyGamer Thermal Camera
Downloads
Files
Schematic
Fab Print
© Adafruit Industries https://learn.adafruit.com/adafruit-mlx90640-ir-thermal-camera Page 2 of 29

Overview
You can now add affordable heat-vision to your project with an Adafruit MLX90640 Thermal Camera
Breakout. This sensor contains a 24x32 array of IR thermal sensors. When connected to your
microcontroller (or Raspberry Pi) it will return an array of 768 individual infrared temperature readings
over I2C. It's like those fancy thermal cameras, but compact and simple enough for easy integration.
There are two versions: one with a wider 110°x70° field of view (https://adafru.it/IDi) and one with a
narrower 55°x35° field of view (https://adafru.it/HNe).
© Adafruit Industries https://learn.adafruit.com/adafruit-mlx90640-ir-thermal-camera Page 3 of 29

This part will measure temperatures ranging from -40°C to 300°C with an accuracy of +- 2°C (in the 0-
100°C range). With a maximum frame rate of 16 Hz (the theoretical limit is 32Hz but we were not able to
practically achieve it), It's perfect for creating your own human detector or mini thermal camera. We have
code for using this sensor on an Arduino or compatible (the sensor communicates over I2C) or on a
Raspberry Pi with Python. If using an Arduino-compatible, you'll need a processor with at least 20KB RAM
- a SAMD21 (M0) or SAMD51 (M4) chipset will do nicely. On the Pi, you can even perform interpolation
processing with help from the SciPy python library and get some pretty nice results!
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 noticeable when things move slowly.
© Adafruit Industries https://learn.adafruit.com/adafruit-mlx90640-ir-thermal-camera Page 4 of 29

To make it easy to use, we hand-soldered it on a breakout board with a 3.3V regulator and level shifting.
So you can use it with any 3V or 5V microcontroller or computer. We've even included SparkFun
qwiic (https://adafru.it/Fpw) compatible STEMMA QT (https://adafru.it/Ft4) connectors for the I2C bus
so you don't even need to solder! Just plug-n-play with any of our STEMMA QT (JST SH) cables.
Even better - We've done all the hard work here, with example code and supporting software libraries to
get you up in running in just a few lines of Arduino (https://adafru.it/IDj) or Python
code (https://adafru.it/IBv).
© Adafruit Industries https://learn.adafruit.com/adafruit-mlx90640-ir-thermal-camera Page 5 of 29

Pinouts
There is no difference between the breakout for the 55°x35° field of view and the 110°x70° field of view
thermal cameras. There is also no difference in the code used with either thermal camera. The only
difference is the length of the lens. The only way to tell which thermal camera breakout you have is to
identify the length of the lens. The longer lens, shown above on the left, is on the 55°x35° field of view
thermal camera and is approximately 11.25mm long. The shorter lens, shown above on the right, is on the
110°x70° field of view thermal camera and is approximately 5.7mm long.
Power Pins
VIN - this is the power pin. Since the sensor chip uses 3 VDC, we have included a voltage regulator
on board that will take 3-5VDC and safely convert it down. To power the board, give it the same
power as the logic level of your microcontroller - e.g. for a 5V microcontroller like Arduino, use 5V
3V - this is the 3.3V output from the voltage regulator, you can grab up to 100mA from this if you like
GND - common ground for power and logic
© Adafruit Industries https://learn.adafruit.com/adafruit-mlx90640-ir-thermal-camera Page 6 of 29

I2C Logic Pins
SCL - I2C clock pin, connect to your microcontroller I2C clock line. This pin is level shifted so you
can use 3-5V logic, and there's a 4.7K pullup on this pin.
SDA - I2C data pin, connect to your microcontroller I2C data line. This pin is level shifted so you can
use 3-5V logic, and there's a 4.7K pullup on this pin.
STEMMA Connectors
STEMMA QT (https://adafru.it/Ft4) - These connectors on the back of this breakout allow you to
connect to dev boards with STEMMA QT connectors or to other things with various associated
accessories (https://adafru.it/Ft6)
© Adafruit Industries https://learn.adafruit.com/adafruit-mlx90640-ir-thermal-camera Page 7 of 29

Arduino Libraries
You're going to need to install a few libraries to use this sensor. These are all in the Arduino Library
Manager, so they're quite easy to install.
Library Installation
You're going to need to install a few libraries to use this sensor. These are all in the Arduino Library
Manager, so they're quite easy to install.
You can install the Adafruit MLX90640 Library for Arduino using the Library Manager in the Arduino IDE.
Click the Manage Libraries... menu item, search for Adafruit MLX90640, and select the Adafruit
MLX90640 library:
Then follow the same process for the Adafruit BusIO library.
In the next page, you'll install all the libraries used for Arcada, which is another dependency.
© Adafruit Industries https://learn.adafruit.com/adafruit-mlx90640-ir-thermal-camera Page 8 of 29

Arcada Libraries
OK now that you have Arduino IDE set up, drivers installed if necessary and you've practiced uploading
code, you can start installing all the Libraries we'll be using to program it.
There's a lot of libraries!
Install Libraries
Open up the library manager...
And install the following libraries:
Adafruit Arcada
This library generalizes the hardware for you so you can read the joystick, draw to the display, read files,
etc. without having to worry about the underlying methods
If you use Arduino 1.8.10 or later, the IDE will automagically install all the libraries you need to run all
the Arcada demos when you install Arcada. We strongly recommend using the latest IDE so you don't
miss one of the libraries!
If you aren't running Arduino IDE 1.8.10 or later, you'll need to install
all
of the following!
Adafruit NeoPixel
This will let you light up the status LEDs on the front/back
© Adafruit Industries https://learn.adafruit.com/adafruit-mlx90640-ir-thermal-camera Page 9 of 29