Circuit Documentation
Summary
This circuit integrates a 1.3 inch TFT Module with an ST7789 controller, a GY-MCU90640 thermal camera module, and a XIAO ESP32C3 microcontroller. The purpose of the circuit is to capture thermal images using the GY-MCU90640 module and display them on the TFT screen, with the XIAO ESP32C3 microcontroller managing the data flow and display logic.
Component List
1.3 inch TFT Module 240×240 ST7789
- Description: A small TFT display with a resolution of 240x240 pixels, controlled by an ST7789 driver.
- Pins: GND, VCC, SCK, SDA, RES, DC, BLK
GY-MCU90640
- Description: A thermal camera module capable of capturing temperature distributions over an area.
- Pins: Pin 1 to Pin 8
XIAO ESP32C3
- Description: A compact and powerful microcontroller based on the ESP32-C3 chip, featuring Wi-Fi and Bluetooth capabilities.
- Pins: GPIO2/A0/D0, GPIO3/A1/D1, GPIO4/A2/D2, GPIO5/A3/D3, GPIO6/SDA/D4, GPIO7/SCL/D5, GPIO21/Tx/D6, 5V, GND, 3V3, GPIO10/MOSI/D10, GPIO9/MISO/D9, GPIO8/SCK/D8, GPIO20/Rx/D7
Wiring Details
1.3 inch TFT Module 240×240 ST7789
- GND connected to GY-MCU90640 Pin 2, Pin 5, and XIAO ESP32C3 GND
- VCC connected to GY-MCU90640 Pin 1 and XIAO ESP32C3 3V3
- SCK connected to XIAO ESP32C3 GPIO8/SCK/D8
- SDA connected to XIAO ESP32C3 GPIO10/MOSI/D10
- RES connected to XIAO ESP32C3 GPIO3/A1/D1
- DC connected to XIAO ESP32C3 GPIO2/A0/D0
GY-MCU90640
- Pin 7 (SDA) connected to XIAO ESP32C3 GPIO6/SDA/D4
- Pin 8 (SCL) connected to XIAO ESP32C3 GPIO7/SCL/D5
XIAO ESP32C3
- GND connected to 1.3 inch TFT Module GND and GY-MCU90640 Pin 2, Pin 5
- 3V3 connected to 1.3 inch TFT Module VCC and GY-MCU90640 Pin 1
- GPIO8/SCK/D8 connected to 1.3 inch TFT Module SCK
- GPIO10/MOSI/D10 connected to 1.3 inch TFT Module SDA
- GPIO3/A1/D1 connected to 1.3 inch TFT Module RES
- GPIO2/A0/D0 connected to 1.3 inch TFT Module DC
- GPIO6/SDA/D4 connected to GY-MCU90640 Pin 7
- GPIO7/SCL/D5 connected to GY-MCU90640 Pin 8
Documented Code
The code provided is intended for the XIAO ESP32C3 microcontroller and is written in Arduino C/C++. It includes libraries for the Adafruit MLX90640 thermal camera and the Adafruit ST7789 TFT display, as well as the SPI library for communication.
#include <Adafruit_MLX90640.h>
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7789.h> // Hardware-specific library for ST7789
#include <SPI.h>
// ... (Code omitted for brevity)
void setup() {
// Initialization code for the MLX90640 thermal camera and ST7789 TFT display
// ... (Code omitted for brevity)
}
void loop() {
// Main loop code to capture thermal images and display them on the TFT screen
// ... (Code omitted for brevity)
}
The code initializes the TFT display and the thermal camera, then enters a loop where it captures thermal images and displays them on the screen. It includes functions for printing formatted text on the TFT display and mapping the temperature readings to a color scale for visualization.
Please note that the full code is not displayed here due to length constraints. The provided snippet gives an overview of the included libraries and the structure of the setup and loop functions.
