Building a Thermal Camera: Part 1

Get Started with Altium Upverter, Sign Up Now

Upverter Expert - Building a Thermal Camera_ Part 1.jpg

I have a couple of upcoming projects where a thermal camera would be very handy. These days, there are some amazingly feature-rich and relatively low-cost thermal cameras that can plug into your phone available on the market. Many of those utilize FLIR’s Lepton sensors, which are quite affordable for thermal sensors. Simply buying a thermal camera is a little boring. It’s considerably more fun to build one yourself. The commercial thermal cameras I’ve seen using FLIR Lepton sensors don’t appear to be using the latest revision, the Lepton 3.5, which is ratiometric and of higher resolution, thus giving better range. I don’t necessarily need the ratiometric output or the higher maximum temperature for my applications, but the high resolution is definitely welcome. In this article, I will be discussing what a thermal camera is, and how to build one instead of settling for a ready-made commercial one. As with my other projects on this blog, we will be going through the process of making the project together. I find this approach more purposeful than me finishing the project on my own, then writing just the successful steps, as it allows us to learn from mistakes together, and in turn, to understand why the final component choices and design decisions are better than their counterparts.

What is a Thermal Camera

We’ve briefly discussed thermal cameras, but what about regular ones? A typical camera, like a digital SLR or the camera in your phone, has a sensor that is sensitive to visible light and also extends a bit into near infrared and ultraviolet. These cameras process the sensor signal using bandpass filters to block the infrared and ultraviolet, and then a bayer array to allow software to determine the red, green, and blue levels of each pixel. You can therefore modify a regular camera to see just infrared—which gives some very interesting pictures. Note that because the camera is now only seeing infrared, the picture is black and white and has no colour information.

IR ImageNear Infrared photo of green foliage, Source: Mark Harris

Thermal cameras can’t see visible light at all—they see infrared—but not the infrared your typical camera’s sensor can see. A thermal camera sees radiated heat, which consists of long wave infrared. If you’ve felt heat radiating from a hot surface, or sat in outdoor seating at a restaurant that has heat lamps, that heat is long wave infrared. A typical camera is sensitive to 800-900nm infrared, which is why you can see the infrared LED in your TV remote with your phone’s camera. Thermal cameras see 10,000-14,000nm wavelengths instead. This means they can’t use a regular CCD or CMOS sensor, and until recent decades, the sensors needed to be chilled to near absolute zero to have any sensitivity at all. The Microbolometer array that makes up the camera is sensitive to heat, so building a camera that can see temperatures lower than ambient was a challenge until recent decades.

Because thermal cameras, like the near-infrared camera, only see one band, or ‘color’, its output is also interpreted as black and white. That being said, the FLIR Lepton, and many other thermal cameras can apply false color to thermal images allowing a greater range of temperatures to be displayed to the user. Typically, you will see this effect as ‘cold’ colors such as blue being used for lower temperatures, and ‘warm’ colours such as orange, red, and white being used for higher temperatures.

What is a Thermal Camera Useful For?

Thermal cameras are widely used for military and security applications. Although this was their traditional market, dramatically lower costs in recent years now allow for a wider range of commercial uses. When you’re evaluating the first prototypes of your new circuit board, for example, a thermal camera can show you which components are hot, and reveal how well heat is dissipated through your board. If you’re dealing with many watts of thermal dissipation for amplifiers, radios, power supplies, or motor drivers, a thermal camera can help immensely. Furthermore, if you’re trying to reduce your circuit board size, a thermal camera will quickly show which areas are not dissipating heat, and therefore can be removed. On the other hand, if your board is running much hotter than expected, you can still use a thermal camera to quickly see which areas of the board are not removing heat as efficiently as you had planned. Even if you are not trying to optimise the thermal capabilities of your circuit board, a thermal camera can allow you to rapidly analyze which components are overheating or performing badly when stress testing a board. This can allow you to see that a MOSFET or inductor in a power supply might need to be changed out for something more efficient, for example. Ultimately, using a thermal camera can save a lot of time glueing temperature sensors or thermocouples to every component you think might get hot, and looking through graphs of the component performance under load.

Other Components for the Project

In addition to the FLIR Lepton 3.5 sensor, we’re going to need some other components so we can read and display the image. As far as projects go, building a thermal camera is quite simple if you use components that are a little expensive instead of trying to cut on costs.


The FLIR Lepton 3.5 has a resolution of 160×120 pixels, which means we ideally want a display with that many pixels, and not a lot more. To make software development easier, it would be great not to have to deal with scaling the image. For my project, I want something fairly compact, so a big beautiful display that needs image scaling isn’t going to suit my requirements in any case.

A friend has been using a lot of cheap SPI displays featuring the ST7735S controller, which look really amazing in his devices. Given the price of displays using the ST7735S controller, it’s difficult to justify using anything else for a prototype.

On an online marketplace, I found a number of 1.8 inch 160×128 pixel displays, either on a breakout board or just the display. These will be perfect, as I can use the breakout board for testing, then integrate the display into a 3D printed enclosure to save space. These displays are also readily available at electronics prototyping/maker supply sites for similar prices, which are much easier to order from if you are in North America rather than the United Kingdom.

I generally don’t like buying displays and such from online marketplaces, as I’m never quite confident about what I’m getting. I’m only willing to take that risk for this project based on my friend’s good experience. The breakout board I have purchased claims to be an SPI display, but the pins are marked as SCL/SDA, which would make it I2C, yet it also has a chip select pin. During the next article in this series where we build the project on a breadboard, things could get interesting when trying to interface with the display!


Now that the display and the sensor are defined, we have an idea of what sort of processor capabilities we might need. I’m only going to be building one or two of these cameras, so the cost of the microcontroller is mostly irrelevant compared to the cost of the thermal camera module. I’d really like to store the whole image frame in RAM without having to use external RAM on the microcontroller, so I’m looking for a controller that has enough RAM for a basic application, plus 128x160x24bits of memory – 491,520bits (62,440bytes) + application. This will allow me to do my own color scheme on the data if I want, or perform any transforms I want to add down the road. The x24bits is for the 8 bits per red, green and blue colour channels.

I’d like to use a microcontroller supported by both the microC Pro for ARM compiler and the online MBED compiler, as I’m not sure which I will use for this project yet. It would also be great if I already have the dev board for it, which means I’m looking at STM32 controllers, as the NXP LPC and Kinetis boards I have which are MBED compatible are not supported by microC Pro. STMicroelectronics tend to incorporate far more RAM and flash in their ARM Cortex controllers than anyone else, which is great for an application like this.

I’m using the STM32F413 as a starting point for another project on the blog, so let’s use that as the starting point for this project too. It’s got 320 kilobytes of RAM, which would allow me to double buffer the image and do all sorts of processing on it if I wanted to in the future. As the code written for the STM32F4 is compatible across the series, we can switch to a cheaper option after we have the firmware developed and have a clearer idea of the memory requirements. This is one thing I really like about STMicroelectronics ‘cheap dev boards’ philosophy: it allows very easy testing of multiple controllers for your project, typically at a lower cost than a single board from a competing vendor.

Thermal Camera Breakout

To save time making a PCB just to mount the thermal camera module on, I would really like to find a breakout board for the FLIR Lepton 3.5. A breakout board should have the multiple voltages the camera module requires taken care of, and just give me the signals I need. When the Lepton series was first released, it caused a lot of excitement and there were several breakout boards available. Sadly, it seems to be much harder to find one now.

I managed to find a breakout board in stock on Digi-Key, however it appears to be a last time buy item. Sparkfun and others, which sold breakout boards for the Lepton, no longer seem to stock them either, which is a bit disappointing. The breakout board predates the Lepton 3.5, however, after digging through the datasheets it appears that the entire Lepton series is pin compatible, just varying in the SPI command set as new capabilities and higher resolutions have been added. 

The most readily available dev board for the Lepton series at the time of writing is a very cool board that has an onboard STM32F4, which turns the thermal camera module into a USB webcam. As neat as this is, it’s not much use to me for building my own camera system using the Lepton on a breadboard!

Coming Up Next Time

Once the selected components are delivered, we’ll start evaluating them to ensure they are the right choice before commiting to a PCB using them. This will give us a high probability of success on the first revision of the circuit board, as well as confirm that each pin we used on the microcontroller is valid for our purposes. We’ll also get to the bottom of the interesting markings on the display board, and determine if it’s bright and clear enough for our little thermal camera.

You can sign up for free and get access to the best browser-based PCB editor, schematic editor, and component database. Visit Upverter today to learn more.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s