tCam-Mini is a small wireless streaming thermal imaging camera I designed to make it easy to get and use radiometric data from a Flir Lepton 3.5 sensor. I am interested in the radiometric data because it includes the temperature of every pixel in the scene allowing all kinds of interesting thermographic analysis. Of course that data can also be turned into the beautiful false-color images everyone associates with thermal imaging.
I designed a PCB but tCam-Mini can also be built using commonly available development boards and a few extra components. I describe that build here.
Update 9-26-2023
I recently found an awesome library on github that allows the ESP32 to generate monochrome composite analog video (NTSC or PAL formats). A couple of days of hacking and I had a mash-up of my original tCam-Mini firmware and this library called tCamMiniAnalog that allows a tCam-Mini (from Group Gets or home-built) to output analog video with just one resistor. You can find the docs, code and instructions at a new github repo here. It's kinda fun. Looks like an old-school thermal imaging camera but would also be a great way to make an inexpensive camera for a drone with a commonly available analog transmitter.
Update - 8-22-2023
Firmware 3.2 is released that officially supports the new Lepton 3.1R. This is a radiometric imager like the Lepton 3.5 with the same resolution and performance specs but has an almost 90° field of view. The new firmware doesn't add any functionality but does correctly identify the 3.1R. It can be gotten through the Desktop app or the tCam Serial Firmware Updater available from my website.
I designed a new version of the tCam-Mini PCB and am happy to say (in this era of parts shortages) that Group Gets managed to build some. Revision 4 modernizes with a USB-C connector and also sports a new Hardware Interface supported in FW 2.0 and beyond (current firmware version is 2.1, available on my website and in the repository). There's even a version that has an external antenna, great for applications like flying the camera on a drone.
Designed so I could use tCam-Mini as the imager for tCam, the hardware interface allows direct connection of tCam-Mini to another micro-controller or SBC. It allows tCam-Mini to handle all Lepton VoSPI related issues and provides the same high-level interface as WiFi. It consists of a serial port running at 230,400 baud and a slave SPI port. The same json commands and responses are transmitted over the serial port with one exception. Instead of sending an image over the serial port (which would be too slow) the camera sends a new "image_ready" json packet that also includes the length of the image. Then the controller can use a SPI master to read the image from the slave SPI port on tCam-Mini. Full details can be found in the github tCam-Mini readme file. The 3.3v logic-level hardware interface is activated when the MODE input is detected low at boot (otherwise the WiFi interface is activated).
Finally, there's also - finally - the tCamView iOS app for accessing tCam-Mini in a mobile environment. It can be downloaded from the App store and documented on my website.
Group Gets is having a campaign pairing a Lepton FS with a tCam-Mini for $129. My commission and their profit on these units is pretty much zero but the campaign is a good way to get an inexpensive thermal imaging camera.
https://groupgets.com/campaigns/978-tcam-mini-with-lepton-fs
In addition, I've release FW 2.0 for tCam-Mini which improves performance, adds support for Lepton 3.0 and over-the-air FW updates (when used with the updated version 2.0.0 Desktop app). The new FW will only work on tCam-Mini's based on Revision 3 ESP32 silicon with at least 8 MB Flash memory to hold the multiple OTA partitions. The new FW (along with programming utility) and updated app can be found on my website.
https://danjuliodesigns.com/products/tcam_mini.html
Update - 2-18-2021The tCam-Mini PCB version will be a Group Gets campaign if you'd rather not wire one up for yourself.
The whole design can be found in a repository on GitHub along with my other experiments with the Flir Lepton 3.5. In fact I documented my experience getting to know how to effectively use the Lepton at hackaday.io.
I also wrote a companion desktop application to view and analyze the data. It runs on Linux, Mac OS X and Windows computers.
The tCam-Mini camera exposes the full capabilities of the Lepton.
- The camera can operate in either Radiometric/TLinear (each pixel contains temperature data) or AGC modes (no temperature data in each pixel but better images).
- Simple json-based command set with communication of a TCP/IP Socket. Makes interfacing with the camera very simple from a custom application.
- AP or STA Wifi modes (static or DHCP-served IPV4 address).
- Single image or streaming data modes.
- Control over camera emissivity, gain and spotmeter location.
The desktop application makes it easy to use the camera and analyze the data from it.
- Display images or streams with multiple palettes.
- Save and load images or streams in files preserving the radiometric data for use later or by other applications. Two file formats: image and video (described in the github repository).
- Export images as jpg, png or tiff files.
- Copy current image to computer's clipboard.
- Histogram display and analysis of pixel populations.
- Spotmeter and up to four additional markers showing temperature at various points in an image.
- Graphing function to plot spotmeter and marker data over time.
- Graph baseline mode to allow comparing temperatures to a reference point in the scene (for example to compare a temperature to a blackbody constant).
- Export graph data in a text file for analysis by other programs.
- Print graph (or create a PDF on computers that can print to PDF).
I don't recommend building tCam-Mini on a breadboard because of the fairly high signaling rates involved (16 MHz for the Lepton SPI bus). It's better to build it, with short point-to-point wiring, on a protoboard as shown below.
tCam-Mini requires use of an ESP32 WROVER module because it has a PSRAM chip that the camera uses for big buffers. Most common ESP32 dev boards are based on the WROOM module. These will not work because they lack the PSRAM expansion memory. If you decide to use a different ESP32 development board, be sure to pick one based on the WROVER.
The wiring diagram is shown below. There are only a handful of connections and most are only between two points.
Be very careful with the Lepton module. Not only is it the most expensive part of this camera, it's also fairly delicate. Be especially careful putting pressure on the lens assembly because it has a small shutter in it that is moved in front of the sensor occasionally for the camera to perform a FFC (calibration step). I can tell you from personal experience that watching that shutter assembly fall apart is a very disheartening moment...
Loading FirmwareThe github repository contains the ESP32 IDF project (source code) for the camera. It also contains precompiled binaries which eliminate the need to install the IDF on your computer and compile the code (although you can if you wish but that process is beyond the scope of this story). You can find the firmware files at this location.
The TTGO module I bought had a Revision 1 ESP32 chip on it. I am using Revision 3 ESP32 chips for my PCB design and compile for them. Unfortunately that code will not run on previous revision silicon. If you know your TTGO module has a Revision 3 ESP32 chip on it then you can directly use the firmware in that directory. Otherwise you should use the firmware compiled specifically for the Revision 1 chip found in the "ESP32_v1_silicon" sub-directory.
Espressif provides a utility program for programming the ESP32 using precompiled binary files. You can find this in my github repository here. Unfortunately the utility is Windows-only so you'll need a Windows computer too.
Please refer to the readme in the github repository for a full set of instructions on how to program an ESP32, including some useful pictures, but essentially you will perform the following steps.
- Download and unzip the Espressif utility program somewhere on your PC.
- Download and store the precompiled firmware binaries you wish to program. There are three files that make up a complete set of firmware to program: bootloader.bin, partitions_singleapp.bin and tCam.bin.
- Connect the TTGO T7 board to your computer with a USB cable and make sure it sees the camera as a serial port (COM port). Make a note of the COM port associated with the camera. You'll need to select it in the utility program.
- Start the Espressif utility program by executing the flash_download_tools_v3.6.8 program.
- Select the ESP32 Download tool from the selection it provides.
- Load the three firmware files and tell the program where to store them in ESP32 flash memory, as well as setup the programming parameters, baud rate and serial port. For the TTGO T7, you will select a 32Mbit (4MB) flash size.
- Program the ESP32.
After programming has been successfully performed (about 10-20 seconds) and the utility program displays the word "FINISH" then you can reboot the camera by pressing the reset button on the TTGO T7 board (or unplug and replug the USB cable).
The dual-color LED provides helpful status. If all goes well you should see it first turn red briefly followed by a slowly blinking yellow. This indicates the camera has successfully booted and is waiting for a computer to connect to its Wifi. A blinking red pattern indicates a fault - probably wiring to the Lepton module. The complete set of patterns are documented here. In addition the camera outputs diagnostic information via its USB serial port (115200 baud). You can use a utility like coolterm, linux screen or even the Arduino serial monitor to see this information.
Don't panic if the camera doesn't boot. It's probably a wiring error. Double check your wiring and make sure there are good solder joints and no shorts, etc. A voltmeter can also be used to probe the lepton module to make sure it's getting power.
Install Desktop ApplicationThe Desktop application comes in three zip files, one for each platform that it supports. It is 64-bit code so won't work on a 32-bit environment. Unzip the application in a known location. You will execute it from this location by double-clicking on the application binary icon in the unzipped folder.
- tcam/tcam for Linux (you might need to make the file executable)
- tcam for OS X
- tcam/tcam.exe for Windows
I build the application using the xojo development environment. At this time I haven't packaged or signed the application for inclusion in the various computer manufacturer's online stores so their built-in security might bring up a dialog box asking if you trust this application. For Mac OS X you might have to change the Security&Privacy System Preference to allow apps from the store and developers. A similar authorization may be required on Windows.
You can run the application before you build a camera. There are some example image and video files you can load to get a feel how it operates, and even generate a graph of the video file (be sure to add some markers after loading the video file before starting the graph).
OperationThe tCam-Mini board can be powered using a USB to USB-MicroB cable plugged into a computer or USB power adapter/charger. It requires a 5V power supply with at least 500 mA capability (although the board typically runs between 200-300 mA current consumption).
Initially the tCam-Mini will act as a WiFi access point (AP) like a home router and advertise a SSID with the form "tCam-Mini-XXXX" where "XXXX" is four hexadecimal characters.
You will need to connect your computer to this Wifi network to talk to tCam-Mini. Be sure to have downloaded, unzipped and installed the companion Desktop application before you disconnect from your existing home network. Using the desktop application you can later reconfigure tCam-Mini to connect to your existing Wifi network so your computer can talk to both tCam-Mini and the internet.
First connect your computer's Wifi to the tCam-Mini. Then start the application. Click the Preferences button on the application's toolbar.
Make sure the IP address is "192.168.4.1". This is the camera's default address. Clicking the refresh icon next to the Camera IP Address fills in the text field with the computer's current network but with the least significant octet set to "1". This is most useful when the camera has been changed to operate on your existing network - you only have to change the lowest octet to match the camera. Hit Apply if you make any changes.
Click the Connect button. You should be rewarded with an update on the status line showing a connection to your camera.
Woo-hoo! Now take a picture. Your hand will do :-) Unless you've already change the palette, it'll be a grayscale image. But you can change the palette at any time.
Congratulations, you're now a thermographer. There are more instructions on how to use the application in the github repository. Play around! One thing you might want to do is put your camera on your existing home network and give it a static IP address so you'll always know how to connect to it. When the camera is connected, click the Setting button on the toolbar and select the "Wifi/Network" tab in the window that pops up.
The window above shows a new configuration to put the camera on an existing network. You'll substitute your real values as necessary for the ones shown here as placeholders.
- De-select the "Camera is Access Point" checkbox.
- Put your network's SSID in the SSID text field.
- Put your network's password in the Password text field (click the eye icon to see it).
- Make sure the Enable Camera WiFi checkbox remains set.
- [Optional] Set a static IP address in the Camera Client Static Address text field. If you don't set a static IP then the camera will get a DHCP served IP address from your wifi router and you'll have to log into it or use a utility such as Fing to figure out what the camera's IP address is.
Clicking Apply will set the camera immediately with the new Wifi parameters and it will attempt to connect to your network. You'll need to reconnect your computer to the network and open the Preferences again to set the camera's new IP address.
The Desktop application stores the preferences so you should only have to set them once.
You can always reset the camera back to its factory default state if you forget what network the camera is connected to or what its IP address is by pressing and holding the button down for more than five seconds. The LED will quickly blink yellow while it performs the reset.
Have fun! I hope you enjoy using this camera as much as I do.
Comments