Public Lab Research note

Thermal Flashlight Using MLX90614 IR Evaluation Board From Sparkfun

by ajawitz | January 22, 2014 19:44 22 Jan 19:44 | #9962 | #9962

What I want to do

I would like to build a Thermal Flashlight that is very similar to the current recommended method on- only instead of wiring in a standalone IR sensor, I would like to use the Evaluation Board for MLX90614 IR Thermometer from Sparkfun.


The advantage of using the evaluation board over the standalone component is the board includes its own ATMega328 chip. In other words, you don't need to connect it to an Arduino Uno because it already has one embedded into it on a much smaller footprint. This should make it much easier to do what this guy was trying to do on Instructables- only without having to stuff an entire Arduino Uno into the flashlight body. Additionally, it might help with the Visualight project by serving as a template for replacing the ATMega328 with a USB-capable chip like the ATMega32u4 or an ATTiny84.


Even though the included "example sketch" from Sparkfun isn't even written for Arduino, it works out of the box with the same sketch that the Thermal Flashlight is based on at-
Because the ATMega328 can not communicate via USB by itself, it has to be connected through an FTDI-Serial adapter like Adafruit's "FTDI Friend" or SeeedStudio's "UArtsBee" which is what I'm using. The Arduino IDE must be set to connect to an "Arduino Pro/Pro Mini (3.3v 8 MHz)w/ATmega328" and the temperature readings will start streaming to the serial monitor at 9600 Baud. So far so good. Now the tricky part is outputting these values to the RGB LEDs. Sparkfun did include at least four analog/digital outputs labelled "PC0-PC4" along with "SCL" and "SDA' for serial. Unfortunately, simply changing the "int REDPin" from "6" to "PC2" etc... in the Arduino Sketch didn't seem to work.


However, I was able to use the eval board as if it were a standalone sensor by connecting 3.3v + GND, SCL to A5 on the Arduino and SDA to A4 on the Arduino.

Next Steps

EDIT: While I've been able to complete the circuit by connecting the eval board to an Arduino Uno as if it were a standalone sensor, this still doesn't achieve my goal of reducing the overall footprint so as to fit inside a modified flashlight. As an interim step, I'll see if I can replace an Arduino Uno with an Arduino Micro which will reduce the footprint significantly, though not as much as if I can finally figure out how to enable the Eval Boards outputs for the RGB LEDs.

As the Micro is based on an ATmega32u4, it will also help test any hypothesis about upgrading the Eval Board to work with USB support.

There is a Schematic for the IR Eval Board-


Or it can be found at this link.


Wow, very neat! The Visualight has USB built in, which is nice, and can also act as a keyboard device -- so Leif was talking about making it literally type the temperature every second.

Reply to this comment...

The biggest reason (for me) for using the Visualight was that it has a really bright RGB LED setup, aside from being compact. That was the stumbling block with previous versions.

Reply to this comment...

RE: Visualight Brightness- Interesting... This could be a major asset to one of my other projects-

Also, It does appear that the Visualight is based on an ATmega32u4, so if one were to make an updated version of the IR Eval board by replacing the ATmega328 with the 32u4 one could theoretically merge the schematic design into that of the Visualight build. Is there a Github repo for the Visualight+Thermal Flashlight project? If not I was thinking of forking the Visualight repo and merging it with the Eagle Files, Schematics etc... from the Sparkfun page-

For those in need of a translation the ATmega328 is basically an Arduino Uno, while the ATmega32u4 is used on newer boards like the Leonardo, Esplora, Micro, Yun etc... The primary difference is the 328 communicates through a hardware serial connection. This means that the module on its own can't actually communicate directly via USB, which is why I needed an FTDI Adapter to program the IR Evaluation Board directly. The Uno compensates for this by adding a second Atmega16U2-based microcontroller which is programmed to function as an on-board USB-serial converter. The ATmega32u4 on the other hand creates a "virtual" serial port (aka "SoftwareSerial") allowing it to use the USB without a converter. Not only does this make the overall cost significantly lower, but it allows for much more flexibility as you can define any inputs/outputs as serial connections. It does have a trade off however in that it can make otherwise simple communications much more complicated. I've found tinkerers hailing from an electrical engineering background tend to prefer the reliability of a hardware serial connection while programmers tend to favor the software serial because it gives them more flexibility if they know what they're doing.

While I can claim no expertise in either field, I tend to avoid using software serial when I can help it... We'll see if my caution is justified in the present case once I try the current flashlight sketch with the (32u4-based) Arduino Micro ...


Reply to this comment...

Huh, i think you know a lot more than I do about ATmegas!

We're thinking of doing our own modded version of the Visualight board in some quantity, or perhaps a daughterboard with the Melexis on it. That, plugged into a 2xAA USB battery booster could be a cheap and tiny all-inclusive flashlight.

But the Sparkfun board is also open source. Besides the need for an FTDI cable, do you see other advantages to the Sparkfun board as the basis for our flashlight board.

Reply to this comment...

Its more that the Sparkfun Board presents a roadmap of sorts for integrating the Melexis Sensor directly into the flashlight board. Since the Virtualight is already based on the 32u4 any modification would be more akin to using the Virtualight as the basis for a redesign of the Sparkfun Board. This is of course assuming that the Sparkfun Board configuration could successfully be upgraded to use the 32u4 chip and/or there isn't already a simpler method for interfacing the Melexis sensor to the Virtualight. As I mentioned earlier though, even without thermal sensory support, it might be interesting to look into potential horticultural applications for a modded Virtualight...

Reply to this comment...

Hi, great discussion. Probably the best thing here would be for us to build our own custom board including a high speed interface for capturing streams. I'll be looking for the new MLX90640 this fall (32x24) in which case we could build an 8x8 sensor array (128x96) and have something like the Lepton Camera from FLIR albeit double the resolution and half the price. -james

Reply to this comment...

Login to comment.