0.ht - site about electronics and stuff

[ main / thermal ]

Simple thermal camera using a FLIR Lepton module

My thermal camera from the front My thermal camera from the back

Thermal cameras are getting cheaper and more available these days. The FLIR Lepton is the first consumer-obtainable Thermal Imager component with an acceptable resolution (80x60). This is a simple, but quite usable thermal camera that I made using it. It consists of the following components:

My thermal camera from the
inside, front My thermal camera from the 
inside, back

My thermal camera from the 
inside, side view My thermal camera 
from the inside, bottom

The display, switch, step-up converter and the breakout board socket were soldered on a matrix board. The Teensy 3.1 and the battery case are glued to the board. The wiring is pretty tight and I had problems getting it all fit into such a tiny space. The Teensy 3.1 programming button is also under the Lepton module and you need to press it sometimes with a suitable tool (when there are problems with the automatic reset before programming). Why didn't I use a rechargeable battery? I might not need this camera very often - when it's time to use it a rechargeable battery is likely to be dead.

The case was designed and 3D-printed by a friend/coworker of mine, Kaji.

A case for the thermal camera

He told me that he had hard time drawing the case because I could not provide any measurements for it. He said that it was trial-and-error trying to measure the parts with a digital caliper. The shuttered Lepton Thermal imager has very thin copper wires on the side that make the electromagnet for the shutter. If one of these breaks then I don't know if it can ever be repaired. A NIR-transparent window should be made later (to protect the lens and mechanics of the sensor) from a suitable material (I tried a 10mm germanium disc, but the "optical" quality of it was quite bad. I will try to polish the metal disc at some point and try again).

The 80x60 output of the Lepton is read by the Teensy and dumped to the 160x128 LCD. The image is stretched 2x and this leaves 8 pixels on the screen for the status bar. This C-language operation happens in an acceptable time enough for the Lepton 9 FPS frame rate, but if one ever wants to change the code for the new 160x120 Lepton, or add some kind of a smoothing, assembly language might have to be used. The status bar shows the minimum and maximum temperature on the screen in Celsius(using a temperature conversion formula by Mark Ricklick found on the flir-lepton Google Forums). Most of the code is based on the breakout board manufacturer's demo files and Adafruit ST7735 routines combined. The palette is borrowed from the raspberry pi demo code on the same code pack. If the minimum and maximum values are too near to each other (if you point it at a wall or something), the palette shifts to the grayer area and leaves the blue/red/yellow part out - it looked better that way.

Below you can see some example images. The images are taken with another camera from the screen itself because I was too lazy to program a SD-card function for it. The display module actually has a SD-card socket but the pins are not connected anywhere. There also wasn't much space left on the board and I really should have thought of that at an earlier point...

Thinkpad laptop on a thermal 
camera My feet on a thermal 
camera

The left image is of a Thinkpad laptop. Notice how it is blowing hot air out of the left side and is making the table warmer on that spot. The internal WIFI card seems to be the hottest spot on the case. On the right image you can see my feet. Notice how my footsteps are visible on the floor for minutes after stepping on it.

Our cat on a thermal
camera Kitchen radiator on a 
thermal camera

On the left you can see our cat relaxing on a heated bathroom floor. On the right you can see our kitchen radiator. The hotter area on the left of the radiator is the dishwasher doing its washing cycle. The sides of the window look really cold, because it is -20 degrees Celsius outside.

Source and pinout

The Teensy 3.1 Arduino environment source code is here: thermalcam_source.tar.gz

DISCLAIMER: This source code is provided "as is". It might be several years old and I might have forgotten everything. Most likely there are no comments in the code and it might not even compile. Don't get disappointed if I don't reply to your e-mails about it.

The following pinout is probably used for this Teensy 3.1 code:

TFT Chip Select - 10
TFT Reset - 2
TFT DC - 9
Lepton Chip Select - 15
Lepton SDA - 18
Lepton SCL - 19
Lepton and TFT MOSI - 11
Lepton and TFT MISO - 12
Lepton and TFT Clock - 13
Battery voltage measurement (use a 10k:10k voltage divider) - 21 (A7)