This firmware reads an MLX90640 thermal camera over I2C, renders a false-color thermal image into a 320×240 RGB565 framebuffer, encodes it as JPEG, and streams it to a host as a USB UVC camera.
- Sensor: MLX90640 full-frame read (two subpages) using the Melexis reference library (
main/third_party/mlx90640_ref) - Render: false-color colormap with optional fast integer upscaling (32×24 → 320×240)
- Stream: JPEG over USB Video Class (UVC) (shows up as a webcam on the host)
- On-video overlays (drawn by
ThermalRenderer):- FPS (top-right)
- min/max temperature (bottom)
- center temperature (center)
- BOOT button (GPIO0): cycles through colormaps (Gray → Iron → Jet → Rainbow)
- Debug LED (GPIO21): toggles once per main loop iteration
- ESP32-S3 board (USB device capable)
- MLX90640 module (3V3)
Pins are configured via menuconfig:
| Signal | Config |
|---|---|
| SDA | I2C_MASTER_SDA |
| SCL | I2C_MASTER_SCL |
Many MLX90640 breakouts already include pull-ups. If yours does not, external pull-ups (e.g. 4.7k to 3V3) are recommended for reliable reads.
idf.py -p PORT flash monitorTo exit monitor: Ctrl-]
- Sensor refresh rate: set in
main/main.cppviacfg.refresh_rate(e.g.Hz4,Hz8,Hz16) - I2C speed:
CONFIG_I2C_MASTER_FREQUENCY(menuconfig) - Colormap / range:
CONFIG_MLX90640_COLORMAP(0=Gray, 1=Iron, 2=Jet, 3=Rainbow),CONFIG_MLX90640_AUTO_RANGE,CONFIG_MLX90640_RANGE_MIN_C,CONFIG_MLX90640_RANGE_MAX_C - Render speed:
ThermalRenderer::Config::fast_integer_scale(fast path when output is an integer multiple of 32×24)
- Text rendering is always transparent (alpha-blended over the framebuffer). If you want a solid background behind text, draw a filled rectangle first.
