Thermal Imaging Embedded System (STM32 + MLX90640)
A portable handheld thermal camera that captures, processes, and displays live infrared data in real time.
Author: Ionescu Andrei
GitHub Project Link: https://github.com/UPB-PMRust-Students/fils-project-2026-ionescuaandrei
Description
This project is a battery-powered embedded thermal imaging system built on STM32, using the MLX90640 (32x24 IR array) to capture temperature frames and render them on a TFT display.
Motivation
I chose this project because it combines real-time data acquisition, embedded data processing, and graphical rendering in a single portable system. It is a practical and technically challenging alternative to simpler IoT projects.
Architecture
Main software and system components:
- Sensor Acquisition Module: reads raw IR frames from MLX90640 over I2C.
- Processing Pipeline: calibration, normalization, temperature-to-color mapping.
- Rendering Engine: draws thermal image and overlays on TFT display.
- Storage Manager: saves captured frames to microSD.
- UI Controller: joystick-driven menus and capture actions.
- Communication Module (optional): sends frames to mobile app via WiFi.
Log
Week 5 - 11 May
- Got the hardware working on the breadboard.
- Next step is moving to a protoboard with soldering.
- The thermal camera is running, but I am still tuning it to work perfectly.
- The app menu is still buggy, but I will handle that next week.


Week 12 - 18 May
- Tried to use I²C as the communication protocol for the MLX90640; failed due to missing 4.7 kΩ pull-up resistors on SDA/SCL.
- Pivoted to the GY-MCU90640BAB bridge board which speaks UART (PA9 TX / PA10 RX, 115200 baud) — gives a reliable frame stream straight out of the box.
- Boosted and tuned the thermal math and physics pipeline (dechess FPN correction, 3×3 median, spatial smoothing, auto-range).
Week 19 - 25 May
- Finished the UI menu and all joystick controls (Up/Down/Left/Right + Press).
- Tried to solder everything onto a protoboard — worked for one day, then the layout broke. Instead of chasing solder-joint debugging, migrated back to the breadboard.
- Started enhancing the aesthetics with a custom box so the whole device looks like a real camera.
- The AliExpress SD card module turned out to be dead — switched to the SD slot on the back of the TFT module. If the SD card still fails, the firmware now falls back to on-chip STM32 flash storage so captured photos persist across power cycles.

Week 26 May - 1 June
- Built a professional-grade thermal image pipeline based on the FLIR Lepton AGC literature: percentile auto-range (P2/P98) with EMA-damped bounds, FLIR-style histogram-equalisation AGC with plateau clipping and a linear-percent term, temporal EMA frame blending for noise reduction, and switched the active palette to FLIR Ironbow.
- Added per-screen joystick guidance legend bars on every UI screen so first-time users can operate the device without instructions.
- Implemented a photo delete flow with a red confirmation modal (Right = prompt, Press = confirm, Left = cancel) — works for both the SD and on-chip flash backends.
- Polished the menu UI: bigger title bar with accent line, roomier menu rows, friendlier item labels.
- Force-pushed the cleaned-up state to GitHub and removed ~3500 stale
target/build artefacts from version control.


Hardware
The system uses an STM32 NUCLEO-U545RE-Q for development, an MLX90640 thermal sensor, a TFT display for visualization, a microSD module for storage, and a joystick for navigation. An ESP8266/ESP32 module can be added for WiFi transfer to a mobile app.
Schematics
Bill of Materials
| Device | Usage | Price |
|---|---|---|
| STM32 NUCLEO-U545RE-Q | Main controller | 125 RON |
| MLX90640 | Thermal sensor (32x24 IR array) | ~150 RON |
| TFT Display | Real-time thermal visualization | ~40 RON |
| microSD Module | Frame storage | ~15 RON |
| Joystick Module | Menu navigation and input | ~10 RON |
| ESP8266/ESP32 | Optional WiFi communication | ~25 RON |
| Battery / Power Bank | Portable power supply | ~50 RON |
| Misc. Wires and Connectors | Integration accessories | ~50 RON |
Software
| Library | Description | Usage |
|---|---|---|
| embassy-stm32 | Async HAL for STM32 | Hardware access for I2C/SPI/UART/GPIO |
| embassy-executor | Async task executor | Schedules concurrent firmware tasks |
| embassy-time | Embedded timers | Frame timing and periodic operations |
| embedded-hal | HAL traits | Driver abstraction across peripherals |
| mlx9064x | MLX90640 driver | Sensor frame acquisition and temperature extraction |
| embedded-graphics | 2D drawing library | Rendering thermal pixels and UI overlays |
| st7735-lcd / ili9341 | TFT display drivers | Sending rendered buffers to the display |
| heapless | No-std data structures | Fixed-capacity buffers without allocator |
| embedded-sdmmc | FAT filesystem support | Saving captured thermal frames |
| express | Node.js web framework | Lightweight API backend for mobile add-on |
| multer / sharp | Upload and image processing | Frame upload handling and optional JPEG encoding |
| expo-image / expo-media-library | React Native media tools | Display and save captured images on mobile |
| axios | HTTP client | API communication from mobile app |
| zustand | State management | Local app state for stream/history/settings |
Links
- OpenTemp Thermal Imager Project
- mlx9064x crate documentation
- Embassy framework
- MLX90640 Datasheet Page
- Project Inspo
- FLIR Lepton — Basic AGC for radiometric images — the AGC / histogram-EQ pipeline driving the live thermal view is built on this.