Thermal Camera - ESP32 + MLX90640 - Entry Level Thermal Leak Finder Application

Agentic Coding / 2026-11-01

← Back to Hub

Always Wanted a Thermal Camera

I've always wanted a thermal camera, but professional ones are expensive — often costing hundreds or even thousands of dollars. So I decided to build an entry-level one with the help of AI to code the software application. This time, Codex was used by submitting all the desired information and requirements upfront, and the main major areas of the application seemed to be running fine after the first attempt to upload the code to the device.

The hardware used this time is an ESP32-32U module and an MLX90640 ESF-BAB infrared thermal camera module, able to produce 32×24 pixel-wise resolution — that's 768 individual thermal pixels. It's not FLIR-grade, but for an entry-level exploration tool, it delivers genuinely useful thermal imagery at a fraction of the cost.

ESP32LeakFinder application architecture diagram showing the hardware layer, firmware layer, API endpoints, web dashboard, and storage architecture
The complete architecture flow of the ESP32LeakFinder application — from the MLX90640 sensor through the ESP32 firmware to the mobile web dashboard.
ESP32LeakFinder application graph showing navigation flow, thermal data pipeline, configuration dependencies, capture output, and storage routing
The application feature graph — mobile dashboard navigation, thermal data acquisition pipeline, configuration dependencies, capture output, and internal/external storage routing.

The Idea — Real-Life Use Cases

The idea came from needing this kind of device in a few real-life situations — locating leaking pipes, checking insulation, and inspecting plumbing within walls. All commercial devices seemed expensive for occasional use. Although after the initial test and research, I found that it's not easy to find a leaking pipe that is 50cm underground using a thermal approach alone. But for hot water pipes within the wall of a shower room, or for general thermal pattern observation, it is still fun and interesting to see it running.

Hardware — Two Simple Components

The beauty of this project is its simplicity. The entire hardware setup consists of just two modules connected via I²C:

ESP32-32U module and MLX90640ESF-BAB infrared thermal sensor — the two hardware components used in this project
The two hardware components: one ESP32-32U microcontroller module and one MLX90640ESF-BAB infrared thermal camera module.
Hardware list:
• ESP32-WROOM-32U — Dual-core 240 MHz, Wi-Fi, 4 MB flash, runs the web server and sensor driver
• MLX90640ESF-BAB — 32×24 far-infrared thermal array, 55°×35° field of view, I²C interface
• Wiring: SDA → GPIO25, SCL → GPIO26, power from ESP32 3.3V to sensor VIN

Four Hours from Idea to Working Device

The total time invested in this project was surprisingly short — roughly a 4-hour project from concept to first working test:

1h
Researching & sourcing the required hardware components
1h
Learning wiring & I²C communication between ESP32 and MLX90640
1h
Entering desired requirements into Codex for code generation
1h
Uploading firmware & testing the initial major functionality

The Application — Mobile Web Dashboard

The ESP32 creates its own Wi-Fi access point. Once connected with a phone, the entire application runs through a mobile-friendly web dashboard served directly by the microcontroller — no cloud, no internet required. The dashboard provides a live thermal view with a colour palette, adjustable refresh rates from 0.2 to 32 fps, image saving, and even MP4 video recording handled entirely by the phone's browser.

ESP32LeakFinder application running on a mobile phone showing the live thermal view with colour palette
The ESP32LeakFinder application running on a mobile phone — live thermal view with auto-scaled colour palette, hottest (+) and coldest (O) markers, and temperature readings.

Field Test — Pool Pipe & The Reality

The pool pipe had leaked years ago and was repaired, but the exact location of the original break was never confirmed. The hope was to use the thermal camera to find the layout of the underground piping by detecting temperature differences between the pipe and surrounding ground. Unfortunately, no luck finding the pipe in the evening cold weather — at roughly 50cm depth, the thermal signature simply doesn't reach the surface in a way that a 32×24 sensor can reliably detect.

Live field test using the thermal camera to search for a leaking pool pipe underground
Live testing — hoping to locate the underground pool pipe using thermal contrast.
Live test results — no clear pipe signature detected in cold evening conditions
Result — no pipe signature detected; ground temperature was too uniform at depth.
Lessons learned: Thermal imaging has real physical limitations. Underground pipes at 50cm depth don't produce enough surface thermal contrast for a consumer-grade sensor to detect reliably, especially in cool ambient conditions. However, this setup could be more useful for detecting hot water pipes within walls, checking insulation gaps, or observing surface-level temperature patterns.

Final Lap — Device in Action

Below is a video demonstration of the device in action, following the firmware upload to the ESP32 system. Despite the limitations discovered during field testing, the thermal camera performs well as a general-purpose thermal observation tool and the entire software stack worked on the first upload — a testament to what AI-assisted coding can achieve.

Testing the device following firmware upload to the ESP32 system — the live thermal view, colour palette, and temperature markers all working as expected.

What's Next?

While the underground pipe detection didn't pan out as hoped, this project opened up new ideas. The thermal camera could still be useful for inspecting hot water pipes within shower room walls, checking window insulation, monitoring electronics for overheating, or even as an educational tool. The total investment — both time and money — was minimal compared to a commercial thermal camera, and the satisfaction of building something functional with AI assistance in just 4 hours is hard to beat.