Are you new to using Arduino? No worries, you can get started using our series of guides on
Getting Started with Arduino.

You can learn more about Arduino libraries by reading this guide from Adafruit.

Follow your board's guide on installing Arduino IDE, and support for the board you have, like the PyBadge, for example. Then install the Adafruit Arcada libraries (there's a lot of them!).

Once done, install the Adafruit_MLX90640 library.

Now, even as I write, I've learned that the Adafruit_EPD and Adafruit_BusIO libraries are required as well, which prompts me to make this caution.

Adafruit's libraries are like any other ecosystem, changing and adapting. New languages and development tools can create new dependencies, and yesterday's requirements for a project might be different from today's. It's happened to me, so I recommend keeping the Adafruit Support Forums as a permanent bookmark.

Test the Circuit

Included with the library are two example sketches which can confirm that the sensor is functioning. MLX90640_simpletest is like a Hello World for your circuit. Compile it in your Arduino IDE, upload it, run it, and it should begin sending serial text that you can view in the serial console.

After sending the status of some of the sensor's hardware settings, the sketch goes on to serial print ASCII art images of the temperature pattern sensed by the MLX90640.

Look for this pair of lines near the head of the sketch.



By changing which one of the two is uncommented, the ASCII art output will be replaced by arrays of numeric values.

The other example sketch, MLX90640_arcadacam, presents the array of temperatures as a color image on the TFT screen.  Have a look around at your fascinating thermal world!


Enabling TinyUSB

One other important detail needs attention before proceeding.  If, like me, your images will be captured to built-in flash memory, like that on a PyBadge, look to the Arduino window menu bar. Choose this setting, Tools > USB Stack > TinyUSB.  It's an essential step in giving your computer access to QSPI flash storage as a virtual USB external drive. It's a handy way to read the images you'll capture.

The other settings in the list? I leave them at their standard values. You may want to change them for higher performance, whatever you prefer.

Congratulations!  Your hardware is ready for the next step, the full camera sketch.

This guide was first published on Mar 27, 2020. It was last updated on Jun 16, 2024.

This page (Support Libraries) was last updated on Mar 08, 2024.

Text editor powered by tinymce.