FLIR Lepton Hookup Guide

Pages
Contributors: Nick Poole
Favorited Favorite 8

Introduction

Note: This tutorial was originally written for the FLiR Lepton [KIT-13233]. However, the FLiR Lepton 2.5 with Radiometry should function the same.

When our team found out that we’d be testing a Long Wave Infrared (LWIR) camera, there were two words that we couldn’t stop saying: Predator Vision. That’s right, we were finally going to be able to see the invisible world of heat, which would aid us greatly if we ever found ourselves hunting a team of special operatives in a remote jungle… or, you know, trying not to scald ourselves on a hot cup of tea.

As it happens, the FLIR Lepton is an excellent little module for the price and Pure Engineering has done a bang up job spinning the breakout board and documentation.

FLiR Dev Kit

KIT-13233
27 Retired

FLIR Radiometric Lepton Dev Kit

KIT-14654
3 Retired

There are, however, a few minor “gotchas” in the setup process and so we figured it was best if we shared what we learned in playing with this thing. But first… A bit of theory...

Suggested Videos

Having a hard time seeing the videos? Try viewing the videos in full screen mode.

Required Materials

To follow along with this tutorial, you will need the following hardware and software. You may not need everything though depending on what you have and your setup. Add the hardware to your cart, read through the guide, and adjust the cart as necessary.

Hardware

Today we’ll be setting up the Raspberry Pi example code as provided by Pure Engineering and featured in our product videos. At a minimum, we’ll be needing a Raspberry Pi... and not much else, actually. Just a handful of jumper wires as well as a monitor, keyboard, accompanying cables for your Raspberry Pi, and the FLIR Lepton camera of your choice.

Below is a wishlist of the suggested parts:

Software

The example code has been tested on a Raspberry Pi model B, but it should work fine on any model so long as you have Raspbian installed.

You will also need to install the QT dev tools and example. Check out the Software later in the tutorial for more information.

Suggested Reading

If you aren’t familiar with the following concepts, we recommend checking out these tutorials before continuing. This tutorial will assume you have a little bit of Raspberry Pi knowledge. If the Pi is new to you, have no fear. You can visit our Installing Raspbian and DOOM tutorial, if you need a primer. Also helpful is our Raspberry Pi GPIO tutorial. The Lepton uses SPI communication to send its video stream and it uses an I2C-like Communication protocol as the control interface. If you are unfamiliar with either of those communication methods, please visit the corresponding tutorials.

Serial Peripheral Interface (SPI)

SPI is commonly used to connect microcontrollers to peripherals such as sensors, shift registers, and SD cards.

I2C

An introduction to I2C, one of the main embedded communications protocols in use today.

Setting up Raspbian (and DOOM!)

How to load a Raspberry Pi up with Raspbian -- the most popular Pi Linux distribution. Then download, compile, install and run the classic: Doom.

Raspberry gPIo

How to use either Python or C++ to drive the I/O lines on a Raspberry Pi.

Theory

Electromagnetic radiation is all around (and within, and throughout) us and is comprised of everything from gamma radiation on the high frequency end to radio waves on the low frequency end. While most imaging sensors detect radiation in the visible spectrum (wavelengths from 380 to 700 nanometers), long wave infrared sensors detect radiation from 900 to 14,000 nanometers. This is known as the infrared spectrum, and it accounts for most of the thermal radiation emitted by objects near room temperature.

Electromagnetic Spectrum

Electromagnetic spectrum with visible light highlighted. Image courtesy of Wikimedia Commons.

The sensor inside the FLiR Lepton is a microbolometer array. Microbolometers are made up of materials which change resistance as they’re heated up by infrared radiation. By measuring this resistance, you can determine the temperature of the object that emitted the radiation and create a false-color image that encodes that data.

Thermal imaging of this type is often used in building inspection (to detect insulation leaks), automotive inspection (to monitor cooling performance), and medical diagnosis. Also, because of its ability to produce an image without visible light, thermal imaging is ideal for night vision cameras.

When it comes to robotics, thermal cameras are especially useful heat detectors because the image that they produce (by virtue of being, well, an image) can be processed using the same techniques and software as visible light images. Imagine using something like OpenCV to track, not just color centroids, but heat centroids! That’s right, you could be building heat-seeking robots right in your own home!

In fact, what are we waiting for? Let me give you the tour...

Hardware Overview

Listed below are some of the characteristics of the FLIR Lepton's specs. The cells highlighted in blue indicate the slight differences between the two versions of the FLIR Lepton camera module.

FLIR Lepton FLIR Lepton v2.5 w/ Radiometry
Resolution (h x v) 80 pixels x 60 pixels 80 pixels x 60 pixels
Spectral Range 8µm to 14µm 8µm to 14µm
Horizontal Field of View 51° 50°
Thermal Sensitivity < 50mK < 50mK
Frame Rate < 9Hz < 9Hz
Control Interface I2C I2C
Video Interface SPI SPI
Promised Time to Image < 0.5 sec < 1.2 sec (~0.5 sec in real world testing)
Integral Shutter
Radiometry 14-bit pixel value 14-bit pixel value, Kelvin
Operating Power ~150 mW ~150 mW

Hardware Hookup

Circuit Diagram

Connect the FLIR breakout to the Raspberry Pi GPIO according to the diagram below. If you need a refresher on how the GPIO pins are oriented, visit our Raspberry Pi GPIO tutorial. Make sure that your Lepton module is securely snapped into the socket on the breakout board.

Pinout

There are several methods of connecting and mounting your system together. If you used a breadboard and LCD touchscreen with the Pi, your setup should look similar to the image below.

Raspbery Pi Flir Lepton Thermal camera Setup

Congratulations, that’s the hardware part done. Now onto the software configuration!

Software

As I mentioned earlier, you’ll want to have the Raspbian OS installed on your Raspberry Pi. Boot it up, and open the Terminal program. Our first matter of business will be enabling the Pi’s SPI and I2C interfaces. Luckily, Raspbian makes this easy to do by including a utility called raspi-config. To run the utility just type:

language:bash
sudo raspi-config

You should be presented with the following screen as shown below. Click on the "Advanced Options" menu.

Raspberry Pi Software Configuration Tool Menu

Having a hard time seeing the circuit? Click on the image for a closer look.

Select SPI and follow the instructions on the following screens. After you've completed the SPI steps, do the same thing for I2C. When you exit raspi-config, it will ask if you want to reboot. Go ahead and do it so that the changes we just made will stick.

Configure The Raspberry Pi's SPI and I2C

Having a hard time seeing the circuit? Click on the image for a closer look.

QT Application

Pure Engineering’s example code is a QT application so we’ll need to get that dependency installed before we can compile it. Don’t worry, it’s easy to do. Make sure that the Pi has an Internet connection, and run the following command to install the QT dev tools:

language:bash
sudo apt-get install qt4-dev-tools

Which will look something like this...

Command Prompt

Raspberry Pi Video

Once installation is complete, go to the Pure Engineering GitHub repo to download the examples.

If you’re familiar with git, you can do this from the command line. For most people, it’s just as easy to browse to the above link, and click “Download ZIP”. You can download the file to whatever directory you like, then cd to that directory in Terminal, and unzip it using the following command:

language:bash
unzip LeptonModule-master.zip 

Unzip LeptonModule

Now cd into the unzipped folder "LeptonModule-master". First, we need to "make" the Lepton SDK. Use the cd command to navigate to the ".../software/raspberrypi_libs/leptonSDKEmb32PUB" directory and run the make command.

Once that process has completed, use the cd .. command twice to move back out of the folders. Then use the cd to move into the ".../raspberrypi_video" directory. This directory contains all of the files you need to compile the example code. run qmake && make:

Compile

Congratulations! You've just compiled the example code, and you're ready to run it. Simply type the following into your command line:

language:bash
sudo ./raspberrypi_video

Aim the camera at something hot or step in front of it to begin viewing heat signatures!

Thermal Image of Nick drinking a cup of hot coffee

Visualizing the insulating properties of my beard

Resources and Going Further

Now that you're successfully retrieving LWIR images from the Lepton module, you can dig into the example code and apply it to your own project!

For more information, check out the resources below:

Thermography has hundreds of applications. Spend some time just playing with the camera to see where you might find uses for it. Try piping the frames captured from your Lepton module into some computer vision software like SimpleCV! We'd love to see what you do with the FLiR Dev Kit so be sure to leave a comment and tell us all about it!

Need some inspiration for your next project? Check out some of these related tutorials:

Raspberry Pi Twitter Monitor

How to use a Raspberry Pi to monitor Twitter for hashtags and blink an LED.

Setting up a Raspberry Pi 3 as an Access Point

This guide will show you how to configure a Raspberry Pi as an access point and connect it to your local Ethernet network to share Internet to other WiFi devices.

Graph Sensor Data with Python and Matplotlib

Use matplotlib to create a real-time plot of temperature data collected from a TMP102 sensor connected to a Raspberry Pi.

Pi Servo pHAT (v2) Hookup Guide

This hookup guide will get you started with connecting and using the Pi Servo pHAT on a Raspberry Pi.

MLX90614 IR Thermometer Hookup Guide

How to use the MLX90614 or our SparkFun IR Thermometer Evaluation Board to take temperatures remotely, over short distances.

Qwiic GRID-Eye Infrared Array (AMG88xx) Hookup Guide

The Panasonic GRID-Eye (AMG88xx) 8x8 thermopile array serves as a functional low-resolution infrared camera. This means you have a square array of 64 pixels each capable of independent temperature detection. It’s like having thermal camera (or Predator’s vision), just in really low resolution.

Or check out the FLiRPiCam project which includes a 3D printed enclosure files: