How cn-vik/thermal_imaging_camera works
This is an ESP32-S3 thermal-imaging camera using an MLX90640 sensor and an ST7789 LCD. At startup, the firmware initializes the display and LVGL, creates the thermal UI, and launches a capture task. That task obtains sensor frames, converts them to temperatures, applies image processing and colorization, and updates the displayed image and HUD. The excerpts show these main runtime paths; peripheral hardware and some internal processing details are represented only where the source supports them.
Main entry points: app_main.c Application startup · ir_mlx90640_app.c Thermal task · lvgl_demo_ui.c Thermal HUD · MLX90640_API.c Sensor calibration
Components 11
Firmware startup
- Application startup
project/spi_lcd/main/app_main.c
Sensor pipeline
- Thermal task
project/spi_lcd/main/ir_mlx90640_app.c - Sensor calibration
project/spi_lcd/main/mlx90640/MLX90640_API.c - MLX I2C driver
project/spi_lcd/main/mlx90640/MLX90640_I2C_Driver.c - Thermal rendering
project/spi_lcd/main/ir_mlx90640_app.c
Display and UI
- Thermal HUD
project/spi_lcd/main/lvgl_demo_ui.c - LVGL display runtime
project/spi_lcd/main/app_main.c
Device hardware
- I2C bus layer
project/spi_lcd/main/bsp/bsp_i2c.c - MLX90640 sensor
- ST7789 display
Other components
- Camera viewer
Connections 13
- Application startup → LVGL display runtime: initializes
project/spi_lcd/main/app_main.c - Application startup → Thermal task: starts task
project/spi_lcd/main/app_main.c - Application startup → Thermal HUD: creates UI
project/spi_lcd/main/app_main.c - Application startup → ST7789 display: configures SPI
project/spi_lcd/main/app_main.c - Thermal task → Sensor calibration: reads frames
project/spi_lcd/main/ir_mlx90640_app.c - Sensor calibration → MLX I2C driver: reads sensor registers
project/spi_lcd/main/mlx90640/MLX90640_API.c - MLX I2C driver → I2C bus layer: uses I2C bus
project/spi_lcd/main/mlx90640/MLX90640_I2C_Driver.c - I2C bus layer → MLX90640 sensor: transfers sensor data
project/spi_lcd/main/bsp/bsp_i2c.c - Thermal task → Thermal rendering: processes temperatures
project/spi_lcd/main/ir_mlx90640_app.c - Thermal rendering → Thermal HUD: updates image and HUD
project/spi_lcd/main/ir_mlx90640_app.c - Thermal HUD → LVGL display runtime: uses LVGL widgets
project/spi_lcd/main/lvgl_demo_ui.c - LVGL display runtime → ST7789 display: flushes display
project/spi_lcd/main/app_main.c - ST7789 display → Camera viewer: shows thermal view