How it started

It was May 2017 when I bumped into a web page about a challenge organized by FLIR® and the BeagleBoard.org Foundation: the BeagleBone Blue challenge with FLIR Lepton. I know FLIR cameras very well, and it was clear in my head how useful they can be for robotic applications. Pairing a FLIR® Lepton3 thermal sensor with the BeagleBone Blue single board computer was the right starting point to put that idea into practice, and so the project SmarTC, Smart Thermal Camera, was born.

The idea

As a computer engineer specialized in robotics, computer vision and artificial intelligence, I wanted to use the FLIR Lepton3 LWIR (Long Wave Infrared) camera to create an intelligent sensor, capable of better understanding the environment where a robot operates:

  • with a LWIR sensor, the robot can better distinguish the obstacles around it and separate animated (hot) objects from inanimate (cold) ones, reacting to their movements according to their classification;
  • the same sensor can detect humans and animals, making robots safer;
  • a thermal sensor does not need visible light, so the robot can keep working safely in the dark, at night or during an electrical fault.

The combination of the Lepton3 sensor and the computational power of the BeagleBone Blue could result in a smart thermal camera useful for autonomous domestic robots or autonomous flying drones.

From finalist to winner

I submitted my idea and crossed my fingers. On August 1st, 2017, I received an email from the judging panel telling me that I was one of the five finalists. A few days later a Lepton3 thermal camera and a BeagleBone Blue arrived, and the real work started.

It was not easy to get started with the Lepton3. I ran into a lot of trouble writing stable C/C++ code to acquire thermal images on the BeagleBone Blue, but with the help of previous work done on the former Lepton sensors, and a lot of patience from Jason Kridner (the father of the Beagle board family), I finally reached my goal: a thermal video stream in my hands.

In the end SmarTC won the challenge: FLIR announced it in the news post Lepton 3/BeagleBone Blue contest winner, and the project is also listed on the BeagleBoard.org projects page. The full write-up I submitted is on Hackster.io.

Talking to the Lepton3

The Lepton3 interface is made of two buses:

  • SPI, used to continuously stream the thermal frames;
  • I2C, used to send control commands and to read the status of the sensor.

Everything is described in two FLIR documents, the Lepton 3 Long Wave Infrared (LWIR) Datasheet and the Lepton Software Interface Description Document (IDD). Understanding both in detail is necessary to deal with the Lepton3… and I understood this statement only after ten days of panic.

The Lepton3 in its white 3D printed case on a perfboard, wired to a BeagleBone Blue in a green case, with an oscilloscope probe clipped to the bus
SPI and I2C test: the Lepton3 wired to the BeagleBone Blue, with the oscilloscope probe on the bus

The 3D printed case

To protect the sensor and mount it on a robot, I designed a small 3D printed case for the Lepton3 breakout board: a front half that holds the board with an opening for the lens, and a back cover with ventilation slots.

FLIR Lepton3 breakout board next to the two halves of its 3D printed case The two white 3D printed parts of the Lepton3 case seen from the inside Back cover of the Lepton3 case with diagonal ventilation slots Lepton3 breakout board seated in the front half of the case, with the back cover beside it The closed 3D printed case with the Lepton3 lens visible, mounted on a perfboard
The 3D printed case I designed for the FLIR Lepton3 breakout board.

The work, step by step

These videos show the progress of the project, step by step.

Flir Lepton3 on BeagleBone Blue #1

Flir Lepton3 on BeagleBone Blue #1 Plays from YouTube, which may set cookies. Privacy · Watch on YouTube

Flir Lepton3 on BeagleBone Blue #2

Flir Lepton3 on BeagleBone Blue #2 Plays from YouTube, which may set cookies. Privacy · Watch on YouTube

Flir Lepton3 on BeagleBone Blue #3

Flir Lepton3 on BeagleBone Blue #3 Plays from YouTube, which may set cookies. Privacy · Watch on YouTube

Flir Lepton3 on BeagleBone Blue #4 [RGB]

Flir Lepton3 on BeagleBone Blue #4 [RGB] Plays from YouTube, which may set cookies. Privacy · Watch on YouTube

Flir Lepton3 on BeagleBone Blue #5 [RGB + GStreamer + WiFi]

Flir Lepton3 on BeagleBone Blue #5 [RGB+GStreamer+WiFi] Plays from YouTube, which may set cookies. Privacy · Watch on YouTube

The final video

The final video presents the basis of the algorithm I wanted to apply to robotics:

SmarTC - Winner of the "Lepton3 & BeagleBone Blue Challenge" (2017) Plays from YouTube, which may set cookies. Privacy · Watch on YouTube

Source code

The source code I wrote for the challenge is publicly available on GitHub: Myzhar/Lepton3_BBB, a grabber for the BeagleBone Blue that acquires thermal images from the Lepton3 sensor.

What came next

When the challenge ended, my plan was to bring everything I had learned into the MyzharBot project, giving the robot the ability to see temperature and to navigate in the dark, and to exploit more of the BeagleBone Blue, mainly its 9-axis IMU and its motor control capabilities.

The Lepton3 came back a few years later on a different platform: in 2020 I connected the same sensor to an NVIDIA® Jetson™ Nano. That work is now the tutorial Using a FLIR Lepton3 Thermal Camera with NVIDIA® Jetson.