# Basics of Thermal Imaging

83,273

473

22

## Introduction: Basics of Thermal Imaging

If you've ever wanted to have "heat sensing vision," look no further! Thermal cameras are becoming cheaper and easier to use, which means they're more documented and accessible for hobbyists. In this Instructable, I'll provide an introduction to the physics behind thermography and few basic sensors that you can use in your next electronic project. Whether you want to give your robot a sense of temperature without touch, or want to find the source of a drafty window, thermography has a lot of practical uses. Let's jump in!

### Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

## Step 1: What Is a Thermal Image?

Before we dive into using thermal imaging sensors, let's define a few terms and go over the physics behind the cameras to better understand what we are actually doing. I'll do my best to reasonably explain the terms and concepts mentioned.

Thermal Image

A thermal image (thermogram) is a digital representation of a scene and a measure of the thermal radiation emitted by the pictured objects. Thermal images are captured via thermographic cameras, which are devices capable of sensing this radiation in the form of infrared light. A thermal image allows us to remotely sense the temperature of an object or at least accurately tell its temperature relative to its environment. This is useful as it allows us to essentially "see" in the dark as well as perceive the temperatures of many objects remotely.

## Step 2: What Is Thermal Radiation?

All matter above absolute zero (−459.67°F) emits electromagnetic radiation as a function of its temperature. This property is referred to as blackbody radiation. Around room temperature, most objects emit this radiation at infrared wavelengths. As their temperature increases, objects begin to emit light in the visible spectrum, beginning with a dim red glow before reaching a white hot (which means it's covering most of the visible spectrum) and eventually releasing most of that energy in ultraviolet wavelengths and beyond.

Infrared Light

Infrared light, or IR, consists of the long wavelengths of light just beyond our visual perception of nearer red wavelengths in the visible spectrum. All electromagnetic radiation carries energy, but infrared light is more readily absorbed by matter, which increases its kinetic energy, therefore increasing its temperature. Since all matter is emitting IR light as a result of blackbody radiation and is a function of its temperature, being able to accurately sense the IR radiation can allow us to create a thermal image.

## Step 3: How Do We Detect Thermal Radiation?

Now that we know we want to detect long IR wavelengths to get a sense of an objects temperature, how do we actually detect it? With sensors, of course! In this case, we'll talk about bolometers, since these are the types of sensors in the cameras we'll be discussing.

Bolometer

In a basic sense, a bolometer is a simple sensor that absorbs thermal radiation, and changes resistance as a result. This change in resistance can be electrically measured, and the incident radiation (which should be a function of the object's temperature) can be determined. A bolometer is a large thing, so in this case, the small array of sensors in the cameras are microbolometers.

## Step 4: What Is a Thermal Camera?

So, with an array of bolometers, we've got the basic means of detecting IR radiation from an object, which, as part of the thermal radiation as a function of the objects temperature, means we can begin to depict the thermal scene on our own terms. Thermal cameras need to be aware of a few properties in order to work properly. What are the thermal properties of the thing we are trying to measure? This depends on a few factors:

Absorption

Different materials absorb certain wavelengths of light at varying levels, affecting their thermal energy. Understanding absorption is relevant for the other factors influencing the radiation detected by the camera.

Transmission

Materials transmit certain wavelengths of light as well, absorbing some, reflecting others. Since no object is detected alone and in a vacuum, other sources of EM radiation will possibly be transmitted through the subject and into the camera as well.

Emission

For a given temperature, different materials emit thermal radiation at widely varying levels. For example, aluminum is highly emissive, while wood is an ineffective emitter. This property roughly correlates to electrical conductivity, while not a precise relationship, it is an easier way to remember and have a sense for how emissive an object is. This is one of the most important properties to recognize, as understanding that for a given equivalent temperature two dissimilar (in composition) materials will appear to be at different temperatures!

Reflectivity

All EM radiation can be reflected as well. Depending on the surface conditions of an object as well as its reflectivity, other sources of EM radiation may bounce off the subject and strike the camera sensors, which, being indistinguishable from the directly emitted radiation from the subject, will skew the thermal image as well. D'oh.

## Step 5: Thermal Camera Costs and Technology

If you've looked before, you may have noticed that thermal cameras, even very low resolution models, are wildly expensive, often costing many hundreds if not thousands of dollars. Why the steep price? If they're so useful, why aren't they becoming cheaper? Well, they are, but here's a few reasons why this is difficult:

Manufacturing

Use of, and therefore demand for, regular visible spectrum cameras is higher and the technologies, like most microelectronic production, is based around good old silicon. Most of the optical technologies for creating electronics are designed for working with silicon processes. Thermal focal-plane arrays (FPAs) require more exotic materials and must be built with separate hardware. Also, these exotic components cannot make up the rest of the supporting circuitry (processing, power management, memory etc), so they are bonded to a more common and easily made silicon-based circuit to handle those tasks. +\$

Calibration

Due to the nature of the manufacturing process, the sensors for each pixel are non-uniformly responsive, so this requires additional processing power for each one to create a uniform signal base. Given an identical source of thermal radiation, even two adjacent sensors will be inconsistent in response, which means the sensor unit as a whole needs to be calibrated. Calibration for each sensor can be done at the factory as well, but this takes extra time and testing since every sensor will be unique. +\$\$

Protection

Like regular cameras, protecting and focusing light involves the use of lenses and windows. While creating visibly transparent lenses is common and much easier, these kinds of lenses are opaque for the IR spectrum. Thermally transparent materials are, you guessed it, made out of exotic stuff as well, which means more custom, low-volume hardware for processing and manufacturing the lenses is required. +\$\$\$

## Step 6: Using the Melexis 90621

The first sensor we'll talk about and use is the Melexis 90621 (the 90620 pinout is compatible), which is a 16x4 pixel camera. You can pick one up here.

While you won't exactly be able to record an IMAX quality film with this kinds of sensor, 16x4 pixels is more than enough to detect a human, or the direction of motion from a living object. It has a temperature range -20 degrees to 200 degrees Celsius. What's more, this is an I2C device, so adding it to a sensor-heavy project won't cost any precious extra pins. The only catch to using the 90621 is a Vdd requirement of 2.6 volts. It is 3.3V tolerant, but Melexis suggests the lower voltage as this is the potential at which the sensor is calibrated (more accuracy!). It can also operate at 500hz per frame, which is plenty fast for most applications. Not to mention, it's quite tiny, being only 10 mm in diameter and 18 in length.

## Step 7: Simple Thermal Imaging Camera: Parts and Materials

Intel Edison with Arduino Breakout

Melexis 90621

5V boost converter

(2 meter) RGB Dot Star LED strip

(6600 mAh) LiPo battery

SPST switch

LM317 voltage regulator

logic level converter

1 uF electrolytic capacitor

(2x) 0.1 uF ceramic capacitor

(2x) 1K resistor

(2x) 4.7K resistor plywood sheet

## Step 8: Electrical Design

Power

Power is provided by a large (>5000mAh) LiPo battery which is immediately boosted from 3.7V to 5V. The 5V is fed into the Edison Arduino breakout board via a spliced micro USB cable (injecting power directly via the 5V pin is not recommended). The MLX90621 is calibrated to run best at 2.6V and requires less than 10mA, so a simple LM317 LDO regulator brings the 5V down for it. The DotStar strips are connected directly to the 5V out of the boost converter.

Control

The Intel Edison lives on an Arduino breakout board and controls the show. It communicates over I2C via a level shifter to the MLX90621 sensor. The Edison also communicates to the DotStar clock and data pins via two digital pins. The DotStar leds have a very basic shift-register control scheme, so they can be connected to any digital pins and defined in software.

## Step 9: Software

The thermal test rig is a simple Arduino sketch running on the Edison. You can find the sketch along with the library archived and attached above.

Program Flow

10 Get new thermal data from sensor and load into an array (16x4)

20 Map raw sensor values to 0 to 100C (The sensor can read beyond these ranges, but this is a simple test)

30 Map pixel temp values to color values in a new array with red increasing and blue decreasing towards 100

40 Shift out color value to DotStar strip

GOTO 10

## Step 10: Going Further With the FLIR Lepton

If you're looking for a few more pixels than the Melexis sensor, look no further than the FLIR Lepton module. FLIR recently began selling lower cost thermal camera modules that were meant to attach to cell phones. They also released the raw sensor, which allowed Pure Engineering to develop a breakout board to access the Lepton module's I2C and SPI interfaces. The unit has an 80x60 pixel resolution (ie ginormous) and can pop out frames at 9Hz. This isn't a technical limitation, but a political one, as high speed thermal imaging is useful for military purposes, so the units are export restricted. The Pure Engineering GitHub page has image capture software for the Intel Edison as well as other platforms.

236
36 4.9K
88 6.5K

## 22 Discussions

Can I ask sir if you can share to me on how you did the code to get the data from a thermal camera using arduino. I would really appreciate it sir. Please if you do have time

Sir, may I have your contact please, I want to build the drone with Raspi 2 and attached the Lepton as thermal imaging.
Iam already got the tutor for both (drone with raspi and thermal imaging with raspi), but i need some one whom teach me how to colaborate both to the one raspi. Thank you so much and wait for your feed back, please...

Great work and thanks for getting the Lepton/breakout module from us! We put a link to this in our Essential Resource section on our FLIR Lepton info page: https://groupgets.com/manufacturers/flir/products/flir-lepton

took me a year to learn bright objects are hot spots but outside everything gets bright and foggy and hard to see the real hot spots

This is extremely convenient as I was just playing with my Lepton a few days ago! I'm basically trying to find a micro controller board that the Lepton will buffer the frames to and output to a small LCD/TFT display so I can make a small, portable thermal optic. I would use a Pi, but it's common to get sync errors and hangups in the coding, so I'm thinking of using a microcontroller of some sort. Tricky part is that from what I've researched on the Flir Lepton Google Group forum, most microcontroller boards (even some with ARM processing) don't seem to be fast enough to process the data and send the frames. I might try a STM32 Nucleo or a STM32 Discovery board for the project. Very informative instructable!

Thanks! Those STM32 boards should definitely do the trick. One thing to note is that the Lepton technically spits out 27 fps, but only updates that output buffer every 3 frames, so it should allow for a bit slower capture time. I actually used the RasPi to capture the thermal images for this Instructable, however I was only able to get the Pi to work half the time. Check out this guy's work for more clearly written Lepton code. He's using a Teensy 3.1: https://github.com/maxritter/DIY-Thermocam

Awesome. I think I'm going to try the Pure Thermal 1 board first since it keeps the same size as the Sparkfun breakout and can also power and communicate with a TFT/OLED over UART as well as send data/power over USB. It should be able to keep the form factor extremely small (constrained mainly by the size of the battery and display + input buttons). I did look into the DIY-Thermocam using the modified Teensy 3.1. I might try a Teensy or a Nucleo board later to see if I can build one at a lower cost.

Great explanation of thermal imaging. I have been tinkering with this for a while and have developed a low cost, open source thermal camera system based on the Seek Thermal sensor and Raspberry Pi. The seek offers 204x154 pixel resolution and can also stream thermal MJPEG video via http. Here's a short video for those that are interested.

I myself have a seek thermal. It's a game changing piece of equipment. Very powerful tool. Amazing you have used it in open source configuration. Great job!

Thank you. Interesting, that looks like a great system to work with!

Impressive instructable. Factual and zero fiction. I applaud your effort! As a certified Level 2 Thermographer, you wrote the best instructable on IR thermography. Your DIY IR camera deserves an award from this site at the very least.

Wow, thank you so much. I had a lot of fun researching the physics behind all of this. Definitely a fun rabbit hole to fall into.

Thermography is very interesting to say the least. Great for rapid location of problems however other test instruments will be needed to verify the issues. The mere fact you are not in the field of predictive maintenance and wrote an excellent article, again mega kudos to you.

I was just searching for information on thermal imaging a few days ago, and there was not a lot out there. This is a nice description. Thanks!