Simple Thermal Camera

A thermal camera using a 32 * 24 pixel sensor. Designed to allow lots of substitutions due to the parts shortage!

Public Chat
Similar projects worth following
Simple Thermal Camera using MLX90640 sensor. Accepts different breakouts or the bare sensor, depending on what's available. This design is inspired by Adafruit's work at but doesn't require a PyBadge dev board, or quite so many libraries. All my work is published under a CC-SA licence. If I've inappropriately derived any part of this project from your work, please let me know :-)


Thermal imaging is a very useful tool for applications as diverse as home renovations (e.g for checking home insulation or for monitoring wear and tear on power tools) automotive repair and maintenance, or electronics. Being able to see, at a glance, the relative temperatures of different objects can make a range of design and diagnostic tasks much faster.

While the price of imaging sensors in the visible-light spectrum has plummeted in recent decades, long-wave infrared imaging remains a relatively expensive niche market. Commercial off-the-shelf (COTS) solutions exist, but are relatively expensive. Prices for a ready-to-use thermal camera begin at around USD500 and only go up from there. This places them out of reach of the casual hobbyist, student, or DIYer.

Due to the COVID19 pandemic in 2020-21, all thermal imaging tools and components have become scarce. A quick search of online electronics suppliers (Digikey, element14) shows that ~80% of all thermal imaging equipment is unavailable as of June 2021. As of June 2021, there is also an ongoing chip shortage which has affected availability of many of the supporting electronics components, from microcontrollers (MCUs) to passives like capacitors:

Presented here is a homemade device that can use the MLX90640 thermal sensor from Melexis. This sensor is available from Digikey, who can also supply a selection of breakout boards from Adafruit and Sparkfun.

This project builds on previous work published by Adafruit* for use with their MLX90640 breakout. The design presented here should be compatible with a wider range of 32-bit Arduino development boards and sensor packages. This should help the reader avoid some of the aforementioned supply chain issues. *

The design presented here has been assembled for under USD150, a significant saving compared to a COTS option. It also has the advantage that it can be customised to your needs, or to suit local availability of components.


During the COVID19 pandemic, some parties have attempted to use thermal imaging as a diagnostic tool to identify people infected with COVID19, in a similar way as thermal imaging was used to identify SARS-positive patients during that earlier epidemic. Thermal imaging is NOT effective for COVID19, for a range of reasons.

  • There is often a delay between being infected (and infectious) and showing symptoms.
  • Not all patients ever develop a fever.
  • Using skin temperature to diagnose fever is unreliable for any disease, not just COVID19.
  • The MLX90640 sensor is NOT rated for medical use, and does not have the resolution or accuracy required for diagnosing fever temperatures in humans.

It may be tempting to use a tool like this to try and help out with the pandemic response, or to get funding for your work, or just to try and get more attention or views for your project online. Please don’t do this.


The Melexis MLX90640 sensor is an array of 32 x24 thermopiles that are sensitive to thermal radiation. This is usually radiation in the wavelengths of 8-14µm (but I couldn't find the specifics in the datasheet - let me know if you find this info for the MLX90640!) This is a lower resolution than a commercial thermal camera, but good enough for hobbyist work. It communicates with the MCU via the I2C bus. Melexis have excellent documentation for both the sensor and its communication protocol. Sparkfun has published some suggestions for simulating higher resolution with software interpolation but this design uses the native resolution of the sensor.

The carrier PCB is the heart of the physical design. This PCB was designed to suit any of 4 different breakout boards for the MLX90640 sensor, and could also...

Read more »

  • Rework of Sparkfun SEN-14844

    nrwest03/31/2022 at 04:00 0 comments

    TL;DR: The sensor was shorting against the groundplane of the red breakout PCB. By desoldering the sensor from the breakout board, adding some insulation to the PCB, then re-attaching the sensor, I was able to fix the intermittent fault where the thermal camera would hang during startup....


    To troubleshoot the sensor, I first downloaded a simple arduino sketch to scan the I2C bus. Search for "i2c scanner arduino" to get something similar. The scan detected my sensor every time, so I could be confident that the sensor wasn't 100% dead. However, the next step, to query the sensor for its serial number, usually failed. After reading through many threads online, I eventually emailed Sparkfun's tech support. Their reply was very quick, and helpfully pointed me to the thread at

    To be honest, nothing in the thread looked like the fault that I was seeing with my setup. I measured the resistances as suggested in the thread and everything checked out OK. But this is the trouble with an intermittent fault - sometimes it _looks_ OK! Being too impatient to wait for a replacement breakout board, it seemed worth a shot to to attempt the rework. I desoldered my breakout board from the thermal camera PCB. I then (carefully!) desoldered the sensor from the breakout PCB. After cleaning up the excess solder from the holes in the breakout PCB, I added a few layers of Kapton tape to insulate the breakout PCB from the sensor, then soldered the sensor back onto the PCB. I then resoldered the breakout PCB to the main PCB of the thermal camera. Success!

    I was very surprised when this worked - intermittent faults are often difficult to isolate and repair, but this one was a win. I think for version 2 of my camera PCB, I will add a footprint for just the bare sensor and do away with the breakouts altogether. They are great for prototyping, but for such a simple circuit there's no advantage to using a breakout in the final product. This also aligns with my goal of trying to work around the global parts shortage - it seems foolish to design a PCB to be reliant on the third-party vendor of the breakout boards.

    Having said that, I have been very impressed by the technical support from Sparkfun - thanks again!

    MLX90640 sensor removed from breakout board
    MLX90640 sensor removed from breakout board
    mounting holes cleaned up, PCB insulated with 3 layers of Kapton tape
    Mounting holes cleaned up, PCB insulated with 3 layers of Kapton tape

  • Issues

    nrwest01/04/2022 at 08:00 0 comments

    v0.1 has been sitting on my desk for a few months now. It mostly "just works" but recently I've been running into issues with the MLX90640 sensor not being recognised.  When I get time I'll look at the I2C lines on the oscilloscope and try to work out what's going on. The Arduino software is a mess (this is why I haven't shared it yet, sorry!) but this doesn't explain the intermittent faults. More updates to follow....

  • PCB v0.1 design and errata

    nrwest09/12/2021 at 04:35 0 comments

    Before I send a new PCB design for fabrication, it's good to double check a few items:

    • Test points, for all power supply voltages, all the signals I will be using, and, if space permits, unused pins of ICs and microcontrollers, in case I want to add features later
    • Silkscreen labels for all components and signals.
      • this includes polarity markings for polarised components like diodes and electrolytic capacitors, and + and - signs for batteries or power supply.
      • It's also a good idea to mark anything that can easily be mixed up, for example, the colours of different LEDs
    • mounting holes. Even if they don't get used for mounting the PCB in the final product, they can be used to hold the PCB down during testing or assembly, and are also useful for passing wires through
    • Board name and revision number. Even if I think it's a one-off.

    Back when PCBs cost over $10 per square centimetre, it was important to minimise their size. Now that they are cheaper, I think improving usability of the PCB is usually a good trade off. Of course there will be exceptions!

    During the present chip shortage, it's often a good idea to provide accommodation for component substitutions, if possible. This might include:

    • allowing for different pin spacing on passive components like resistors and capacitors
    • making room for differrent modules (like I have in this design, to accommodate the Adafruit or Sparkfun breakouts, or the bare Melexis sensor.

    So, when I got the shiny v0.1 PCBs from the factory, I noticed that I had made one mistake and somehow swapped the SCK and MOSI lines for the screen on the schematic! Stupid. I had to mend this on the v0.1 PCB by manually soldering wires at R6 and R7. After a bit of testing, I also noticed that the readout for battery voltage is quite noisy. My oscilloscope shows ~230mV of ripple at ~150Hz on the input side of the DC-DC converter. The noise seems similar regardless of whether the unit is running from batteries or a lab power supply. Regardless of the cause, a capacitor between the ADC pin and ground helps smooth out some of this noise.  To fix the v0.1 board I added a 1µF SMD capacitor (the first value I had at hand) in parallel with R9. Before I added the capacitor, ADC readings would fluctuate by ~50, the capacitor reduced them to ~3. It’s probably better to use a couple of caps of different values to remove different frequencies of ripple, but the 1µF is definitely "good enough."

    There may be other mistakes that become apparent as I do more testing. There will definitely be features I want to add, and the community might have suggestions too! at some point I would like to do a second revision of the PCB, but at this stage I don't have enough information to commit to a v0.2. The v0.1 is more than sufficient for testing.

  • Testing

    nrwest08/22/2021 at 07:46 0 comments

    It works!

    The bottle of beer on my desk shows up colder than the background, and there are two power adapters that appear as warm spots behind that. There are a couple more pictures of the camera in action in the Gallery.

  • More assembly notes

    nrwest08/22/2021 at 07:20 0 comments

    I had hoped that I could use header pins on the screen to sit in a socket on the carrier board. This would have allowed me to detach the screen easily if i needed to make modifications, measurements or repairs to the thermal camera.

    The detachable screen worked well enough for testing, but would often go blank if it received a slight push in the wrong direction.

    So I desoldered the socket and header pins, and replaced them with short lengths of insulated hookup wire. Now the screen is much more reliable! There is enough "flex" in the wires that it is easier to fit the screen into its matching cutout in the case. You can't see it in the pictures, but there's a piece of foam behind the screen to keep it level with the main PCB and gently push it into the cutout in the lid of the case, so that everything is held snugly without rattling.

    The switch was the smallest "latching" switch I could find in stock at Digikey. I 3D printed a round button for the switch, because is it easier to make a round hole in the case than a square one :-)

    You can also see in the photo that the MCU needs to be mounted as low as possible in its socket, so that the lid of the case will still fit.

  • Assembly notes

    nrwest08/21/2021 at 08:55 0 comments

    1. Two unused mounting points in the "top" of the case need to be removed to provide clearance for the screen.
    2. The top of the case also needs holes for the switches, and a big rectangular cutout for the screen. Start with smaller holes than you think you need, then check for alignment. You can also use the PCB as a guide, or a copy of the PCB printed on paper. If you use a paper printout, you can drill right through it if necessary.
    3. Depending on the DC-DC module, you may need to modify it to fit. I had to remove the big USB socket and then cut down the module's PCB. A hacksaw with very fine teeth works, or you can deeply score the PCB with a knife and then bend it until it snaps along the cut.

  • Sanity check the PCB

    nrwest08/21/2021 at 08:16 0 comments

    Before I sent the PCBs files away to be fabricated, I like to print them on paper to look for mistakes and to check the PCB will actually fit where it's supposed to. You can also poke holes in the printout to check for alignment of mounting holes and that connectors etc will fit OK.
    It's not foolproof but it costs virtually nothing to do.

  • Enclosure Assembly

    nrwest08/18/2021 at 05:43 0 comments

    Making the case pretty would be much easier if you have a laser cutter or a CNC mill. I have neither! I've tried to minimise the number of straight cuts and square holes required, by using round buttons wherever possible.

    I suppose you could also 3D print a case, to avoid any cutting at all. If there is demand, maybe I will design one! For now though, the Serpac “HP65” series of enclosures seem quite easy to find, cheap to buy, and reasonably straightforward to modify.

    One thing that gave me trouble was getting a well-placed hole for the lens to poke out the "back" of the camera. I achieved this after attaching the Sparkfun MLX90640 breakout to the main PCB carrier board. Then I put a ilttle bit of Blu-Tac on the case where I thought the lens would go. I smeared the Blu-Tac out so it was flat and covered a few square centimetres. Then I carefully laid the carrier board over the case, so the lens left an impression in the soft Blu Tac. this gave me a location for a pilot hole. When the pilot hole was drilled, I could remove the Blu-Tac and enlarge the hole to suit my lens. If your hole looks a bit messy, I've made 3D printable bezel to hide the cutout.

    Mark for locating the lens cutout

View all 8 project logs

Enjoy this project?



Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates