ESP32 Thermal Camera PCB: How AIVON Rapid Prototyping Delivered a Working Handheld Tool
Key Moment
- 0:00 Introduction & Project Overview
- 1:30 AIVON PCB Sponsorship
- 2:06 MLX90640 Sensor Explained
- 3:31 Hardware Design & Schematic
- 4:26 PCB Layout & 3D View
- 4:52 Ordering the Custom PCB
- 5:17 Assembling the Board
- 6:29 Coding & Custom Library
- 8:08 Uploading the Code
- 8:31 Connecting to Wi-Fi & Live Thermal View
- 9:07 Testing the Heat Vision Camera
- 9:43 Outro & Resources
Project Background
In the world of maker electronics and professional troubleshooting tools, the ability to visualize heat in real time opens powerful new possibilities. A maker set out to create a compact, battery-powered thermal imaging camera built around the MLX90640 far-infrared array and an ESP32 microcontroller. The goal was ambitious yet practical: capture a full 32 × 24 temperature matrix (768 measurement points), convert the raw data into a smooth live heatmap through bilinear interpolation, frame smoothing, contrast enhancement and selectable color palettes, then stream that image wirelessly from the ESP32's own web server so any phone browser could view it.
The finished device had to run from a single LiPo cell, charge cleanly via USB-C, remain small enough to feel truly handheld, and stay useful for everyday electronics troubleshooting, presence detection or simple thermal monitoring. Achieving that level of integration required treating the circuit board not as a simple carrier for modules, but as a carefully engineered, manufacturable part of the complete system. The project moved from concept to a working instrument only when the PCB design and fabrication received the same attention as the firmware and thermal algorithms.
This video explores exactly how that happened—highlighting the design decisions, the real-world prototype adjustments, and the manufacturing discipline that turned a promising idea into a reliable tool.
What This Video Covers
The video walks through the complete journey of the ESP32 + MLX90640 thermal camera board. It begins with the system architecture and the decision to use a 2-layer FR-4 design. It then examines the front-side-only component placement, the power path built around the TPS63020 buck-boost and BQ24092D charger, and the clean I²C interface to the MLX90640. Viewers see how the raw 32 × 24 matrix is transformed into a live, interpolated heatmap served directly from the ESP32 web server.
Practical manufacturing lessons are covered in detail: early prototype value tweaks under real battery and Wi-Fi load, the importance of clean power and ground for sensor stability, solder-mask opening definitions, via treatment, and the necessity of proper stamp holes on panels. The video also shows the final assembled boards arriving from AIVON, the quality of the pads and plating that made dense 0603 hand assembly straightforward, and how that manufacturing consistency allowed the maker to focus on software rather than fighting hardware issues. Finally, it presents a practical DFM checklist tailored to compact battery-powered thermal-sensor boards and looks ahead to how similar care can accelerate other IoT and sensor projects.
Project Highlights and Key Features
- Full 32 × 24 (768-point) thermal matrix from the factory-calibrated MLX90640, covering –40 °C to 300 °C with approximately ±1 °C accuracy and two field-of-view options.
- Real-time bilinear interpolation, frame smoothing, contrast enhancement and selectable color palettes delivered as a smooth heatmap to any phone browser via the ESP32's built-in web server.
- Continuous display of minimum, maximum, average and center temperatures plus hot/cold markers.
- Complete power architecture: single LiPo cell, USB-C charging, auto-reset transistors eliminating the need for boot buttons, and a stable 3.3 V rail across the full battery range.
- Strictly front-side component placement on a compact 2-layer FR-4 board using 0603 passives, simplifying both hand assembly and visual inspection.
- Clean, short I²C runs and local decoupling that keep the sensitive MLX90640 free of supply noise and ground bounce.
- Standard 1.6 mm thickness, 1 oz copper and smooth HASL/ENIG-class finish optimized for reliable soldering of the ESP32 module and fine-pitch parts.
- Practical DFM features locked in before production: explicit via tenting decisions, proper stamp-hole patterns, adequate copper-to-hole clearances and carefully placed silkscreen.
Challenges Encountered During Development
Early prototypes quickly revealed the realities of battery-powered sensor design. Capacitor and resistor values in the power path needed adjustment once the actual current draw of the MLX90640 plus Wi-Fi load was measured under real conditions. Supply noise or ground bounce on the 3.3 V rail immediately translated into frame errors, underscoring the need for tight local decoupling and continuous ground returns.
On the manufacturing side, common 2-layer FR-4 pitfalls appeared: mixed solder-mask openings (some vias intended to be tented, others left open), potential missing stamp holes on solid panel tabs that risk cracking during handling or depanelization, and the need for precise small-hole compensation to avoid unintended copper exposure. Component density on the front side also demanded careful pad design and thermal reliefs so that hand assembly of 0603 parts and the ESP32 module would remain reliable. Without early attention to these details, the project risked multiple board spins simply to correct manufacturability issues rather than advancing the thermal imaging software.
How AIVON PCB Helps
Once the final Gerbers were ready, the maker uploaded the files, selected standard FR-4 parameters, board thickness and solder-mask color, and ordered a small prototype run through AIVON. Approximately one week later the boards arrived. Pad flatness, silkscreen clarity and through-hole plating consistency were excellent, making the dense front-side layout straightforward to assemble by hand. No lifted pads, no bridging from rough plating, and no silkscreen interference occurred.
AIVON's CAM review process routinely resolves exactly the issues that had appeared on earlier similar boards—clarifying mixed via tenting versus open windows, locking small-hole compensation, and verifying stamp-hole patterns on solid tabs. That same early attention to mask definition, via treatment and panel mechanical strength meant the thermal-camera boards arrived ready to perform. Clean copper and plating kept the charger-plus-buck-boost power path quiet; short, well-defined I²C runs remained solid; and the auto-reset circuitry functioned on the first firmware upload.
Because the hardware stopped being the limiting factor, the maker could concentrate on the custom library, the web interface and the interpolation algorithms. The result was a transition from "prototype that almost works" to "tool you can actually carry and trust." AIVON's combination of rapid turnaround, expert DFM feedback and consistent fabrication quality compressed the path from design freeze to usable units, delivering the manufacturing reliability that complex or high-volume boards also receive—even on a compact 2-layer project.
Conclusion
What began as a desire to make heat visible in real time became a practical handheld instrument because the circuit board was designed and manufactured with the same care as the firmware. A well-executed 2-layer FR-4 board, combined with disciplined power architecture and front-side layout, provided a solid foundation for the ESP32 and MLX90640. The finished camera is smaller, cleaner and more reliable than any collection of breakout modules could have been.
If you are developing a thermal, battery-powered or IoT project, the distance from sketch to working prototype is shorter than it appears—provided the board underneath is treated as a precision part of the system.
FAQ
Q1: Is a 2-layer board enough for a compact ESP32 + MLX90640 thermal camera, or do I need 4 layers?
A1: For this size and function a well-laid-out 2-layer FR-4 board is usually sufficient. Keep high-current paths short and wide, give the sensor a clean local ground and decoupling, and avoid routing noisy traces under the MLX90640. Four layers help only if you later add high-speed interfaces or much denser routing.
Q2: What surface finish and board thickness work best for hand assembly of 0603 parts and an ESP32 module?
A2: Standard 1.6 mm FR-4 with a smooth HASL or ENIG finish is ideal. Flat, well-plated pads make 0603 soldering and module placement far more reliable. Avoid very thin boards unless mechanical constraints force it—they flex more during hand soldering.
Q3: How do I avoid solder-mask opening conflicts on a 2-layer board?
A3: Clearly state in the fabrication notes which vias should be tented and which should remain open. Also specify whether small vias need zero compensation. Mixed Gerber data versus order defaults is one of the most common triggers for CAM questions on 2-layer boards.
Q4: Do I need stamp holes when ordering a small 2-layer panel?
A4: Yes if the panel uses solid tabs or has zero process edge. Missing stamp holes can cause boards to crack during handling, plating or depanelization. Adding the fabricator's standard pitch and diameter early prevents that risk.
Q5: Are there specific DFM points that matter most for a battery-powered thermal-sensor board?
A5: Yes—local decoupling right at the sensor, continuous ground return for I²C, thermal reliefs on large pads, clear separation between the switching regulator and the MLX90640, and clean solder-mask definition around vias and pads.
Hi everyone, it's me Ha from How to Electronics. Today I am going to show you how I designed a high-resolution thermal imaging camera using MLX90640 and ESP32-based PCB board. The device is portable and operated using a battery.
This is the MLX90640 far infrared thermal sensor with a 32x24 pixel array. It means it can provide 768 individual temperature measurement points for thermal image generation.
In this video, I will show you a thermal camera on a web server. The thermal data is processed as a 32x24 infrared temperature matrix and converted into a smooth thermal heat map for visualization. The web interface includes enhanced thermal image processing features such as bilinear interpolation, color palette mapping, frame smoothing, contrast enhancement, and hot cold temperature markers. The website also displays useful real-time values including minimum temperature, maximum temperature, average temperature, and center temperature.
So, let's get started and see how to build this portable DIY thermal imaging camera.
The PCB used in this project is sponsored by Aivon, a global leader in PCB manufacturing and assembly. Aivon provides high-quality PCBs with fast production and delivery times. For new users, there is currently a special campaign that includes free shipping and generous discounts, making PCB prototyping far more affordable. You can get a PCB at $1 and PCBA service as low as $35 only and with free shipping.
Let's have an overview of the MLX90640 sensor. First, the MLX90640 is an advanced infrared thermal camera module from Melexis. Recognized as a sophisticated temperature monitoring tool, this sensor captures data in an array of 32x24, providing a resolution of 768 pixels. Each pixel functions as an independent IR sensor, delivering individual temperature readings.
The MLX90640 is equipped with a built-in lens that offers a field of view of either 55° or 110°, making it versatile for both close range and broader area detection. It operates at a voltage of 3.3 volts and features a variable frame rate from 0.5 hertz up to 64 hertz. The frequency is adjustable depending on the application needs. The temperature resolution of the MLX90640 is approximately 0.1° C and it can measure temperatures from -40° C up to 300°.
This sensor works on I2C protocol which means that only four pins are used for interfacing with the microcontroller. There are some versions of MLX90640 that support the UART communication protocol as well.
Let us take a look at the hardware design part of the project. Starting from here, the board has a USB type-C port for charging the battery. The charging is managed by the BQ24092D IC. An onboard LED indicates power status. A 3.7 volt lithium ion or lipo battery is connected through a JST connector. A slide switch is included to turn the entire system on or off. The TPS63020 buck boost converter ensures a regulated 3.3 volt supply for the ESP32 and other peripherals. Programming the ESP32 is easy through the PROG header which connects to an external FTDI module. MLX90640 sensor can be connected to the I2C pins using the jumper wires.
After designing the schematic, I converted it into a compact PCB layout. All of the components are placed on the front side for easier assembly. The routing is done based on signal requirements and component placement.
Here is the 2D view of the board from the front side and also from the back side. Similarly, here is a 3D view of the board. The 3D view looks awesome.
So, the next step is to order the PCB. The Gerber files were generated and uploaded to Aivon. Uploading the Gerber file is simple. Just select the board parameters like material, thickness, solder mask, color, and quantity. And here you can see the total quote of just $1. And shipping is also free. If you want to order a PCB at just $1, click the first link in the description.
I placed the order and within a few days I received these high quality PCBs. The finish, silk screen, and through-hole plating were excellent.
Next, I soldered all of the SMD components, resistors, capacitors, transistors, ICs, LEDs, USB port, ESP32 room module, slide switch, JST battery connector, and header pins. The assembly was smooth and the board looks professional once completed.
To test, I first connected a 3.7 volt lithium ion battery and slid the switch to power on. To test charging, I plugged in a USB-C cable and the red LED turned on showing the battery power status. Finally, using the jumper wires, I connected the MLX90640 sensor. The thermal image sensor is not fixated on the board, and the reason for that is that it should be movable as it needs to be placed in some 3D encasing with direction facing on any object.
Now, let's move on to the coding part. We will develop a C++ code to interface MLX90640 with ESP32 and visualize the thermal image on a web page. For this project, we have created our own MLX90640 Arduino library to make the code easier to organize and use with ESP32. You can download the library from our website article.
The code for this project is divided into two main files, thermal_image.ino and webpage.h. The thermal_image.ino file contains the main ESP32 program including Wi-Fi setup, MLX90640 initialization, thermal data reading, and web server handling. The webpage.h file contains all of the HTML, CSS, and JavaScript code used to create the live web view.
In this code, the MLX90640 communicates with ESP32 over I2C bus. After initializing the sensor, the code reads the thermal frame data, calculates the minimum, maximum, average, and center temperature values, and sends this data to the web page. The ESP32 also hosts a real-time web server using its built-in Wi-Fi capability. The website displays the live thermal image as a smooth heat map in the browser. To make the thermal view more detailed and visually clear, the website interface uses interpolation, color mapping, frame smoothing, and enhanced contrast.
Once the hardware assembly is complete, it's time to upload the code. To upload the code, connect your FTDI module directly to the PROG header on the PCB. In the Arduino IDE, go to tools board and then select ESP32 dev module. Then choose the correct COM port for your FTDI adapter. Finally, click the upload button. The code will be uploaded to the ESP32 board.
After uploading, power the device and wait for the ESP32 Wi-Fi network to appear. Connect your phone or computer to the ESP32 Wi-Fi network. The password is 12345678. Then open a browser and go to 192.168.4.1. The website will display a live thermal image from the MLX90640 thermal camera.
The heat map shows temperature differences in front of the sensor. Warmer objects such as your hand or face will appear in brighter/hotter colors while cooler background areas will appear in darker or cooler colors.
To test the sensor, move your hand slowly in front of the camera and observe the thermal image changing in real time on the web page. The web page also shows useful temperature values such as minimum temperature, maximum temperature, average temperature, and center temperature. You can use the webpage controls to change the color palette, enable smooth view, view hot/cold markers, and adjust the thermal image display.
And that's all from the video part today. All of the detailed written guide related to this project can be found in the website article of how to electronics. You can find the bill of materials, schematic, PCB, Gerber file, source code, program, and other instructions here.
So why not drop a like and hit the subscribe button. Finally, thank you so much for watching. See you in the next video.