Skip to main content
Version: FILS English

Thermal Imaging Embedded System (STM32 + MLX90640)

A portable handheld thermal camera that captures, processes, and displays live infrared data in real time.

info

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.
Thermal camera prototype 1Thermal camera prototype 2

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.
Thermal camera protoboard attempt

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.
Final thermal camera output 1Final thermal camera output 2

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

Thermal camera hardware schematic

Bill of Materials

DeviceUsagePrice
STM32 NUCLEO-U545RE-QMain controller125 RON
MLX90640Thermal sensor (32x24 IR array)~150 RON
TFT DisplayReal-time thermal visualization~40 RON
microSD ModuleFrame storage~15 RON
Joystick ModuleMenu navigation and input~10 RON
ESP8266/ESP32Optional WiFi communication~25 RON
Battery / Power BankPortable power supply~50 RON
Misc. Wires and ConnectorsIntegration accessories~50 RON

Software

LibraryDescriptionUsage
embassy-stm32Async HAL for STM32Hardware access for I2C/SPI/UART/GPIO
embassy-executorAsync task executorSchedules concurrent firmware tasks
embassy-timeEmbedded timersFrame timing and periodic operations
embedded-halHAL traitsDriver abstraction across peripherals
mlx9064xMLX90640 driverSensor frame acquisition and temperature extraction
embedded-graphics2D drawing libraryRendering thermal pixels and UI overlays
st7735-lcd / ili9341TFT display driversSending rendered buffers to the display
heaplessNo-std data structuresFixed-capacity buffers without allocator
embedded-sdmmcFAT filesystem supportSaving captured thermal frames
expressNode.js web frameworkLightweight API backend for mobile add-on
multer / sharpUpload and image processingFrame upload handling and optional JPEG encoding
expo-image / expo-media-libraryReact Native media toolsDisplay and save captured images on mobile
axiosHTTP clientAPI communication from mobile app
zustandState managementLocal app state for stream/history/settings
  1. OpenTemp Thermal Imager Project
  2. mlx9064x crate documentation
  3. Embassy framework
  4. MLX90640 Datasheet Page
  5. Project Inspo
  6. FLIR Lepton — Basic AGC for radiometric images — the AGC / histogram-EQ pipeline driving the live thermal view is built on this.