Hardware
I’m using the MLX90640 with 32x24 px on a breakout from Sparkfun, you can get it with 55° or 110 ° FOV, see IR / thermal camera for detecting brood nest and winter cluster
You need a “stronger” microcontroller, an Arduino Uno ist not sufficient, so I tried the ESP32 Feather for this task:
in addition I use the TFT FeatherWing a 2.4" display with 320 x 240 pixel. You can nicely stick the ESP32 Feather on the back of this display.
Initial Setup
https://learn.sparkfun.com/tutorials/qwiic-ir-array-mlx90640-hookup-guide
Wiring
MLX90640 -- Feather Wing TFT / Feather Huzzah32
-----------------------------------------------
GND -- GND
3.3V -- 3V3
SDA -- SDA
SCL -- SCL
mlx90640_feather-wing-tft_v0.1.fzz (400.7 KB)
Library and code
There is no lib to install! you have to copy the required files from the demo examples in the same folder as the actual code.
- code: GitHub - sparkfun/SparkFun_MLX90640_Arduino_Example: Controlling and reading from the MLX90640 IR array thermal imaging sensor
(you can read on the sparkfun git page, that the Melexis lib is already in the code samples included, but this not a “normal” installable Arduino lib file!) - the Sparkfun code is based on this “lib”: GitHub - melexis/mlx90640-library: MLX90640 library functions
Problems with the defaul ESP32 Arduino core, use the fork from stickbreaker!
-
Modifications to work with the ESP32 · Issue #2 · sparkfun/SparkFun_MLX90640_Arduino_Example · GitHub
– on this page read the comment from tdicola, Oct 13, 2018
– you have to use the fork of the ESP32 Arduino core here: GitHub - stickbreaker/arduino-esp32: Arduino core for the ESP32 - this was very tricky, and it took me hours to manage it!
– you have to uninstall the Arduino ESP32 core on the Arduino IDE (in case you have installed it already)
– then follow the manual installation instructions GitHub - stickbreaker/arduino-esp32: Arduino core for the ESP32
– the instruction is for the official espressif development repository, so you have to change the source location
fromhttps://github.com/espressif/arduino-esp32.git
tohttps://github.com/stickbreaker/arduino-esp32.git
- don’t forget to make the changes in the
MLX90650_I2C_Driver.cpp
'sMLX90650_I2CRead
function as written in the comment from tdicola - make also the changes mentioned by PeterAJansen in the same file
MLX90640_I2C_Driver.cpp
! - sometimes it helps to wait a long time till git clones all data, really wait an grab a coffee or beer!
- it did not work in the first time, so restarting Windows and / or the Arduino IDE could help also
- btw. I’m on Win10 with the Arduino “App” 1.8.8
- the
Example1_BasicReadings.ino
outputs only the first 10 pixel readings, in case you wonder that change it to 768 (32 x 24px) in linle 92
Test output to Processing
Yeeeaaaaahhhh! It’s working! And makes nice pics with the Processing example
Other projects with TFT display
what a fortuity: it’s for the same 320x240 ILI9341 display, we have used for the (lower resolution) AMG8833 TFT FeatherWing - 2.4 320x240 Touchscreen For All Feathers ID: 3315 - $29.95 : Adafruit Industries, Unique & fun DIY electronics and kits so let’s try to get it working with the MLX90640
TFT display pins default in the library are not the one we need for the Adadfruit Feather Wing
So I changed in User_Setup.h
// For ESP32 Dev board (only tested with ILI9341 display)
// The hardware SPI can be mapped to any pins
#define TFT_MISO 48
#define TFT_MOSI 49
#define TFT_SCLK 50
#define TFT_CS 15 // Chip select control pin
#define TFT_DC 33 // Data Command control pin
//#define TFT_RST 2 // Reset pin (could connect to RST pin)
#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST