1. Introduction
This manual provides comprehensive instructions for setting up and programming the AITEWIN ROBOT ESP32 LCD TFT Module. The module integrates an ESP32 WiFi and Bluetooth chip, featuring a dual-core 32-bit MCU with WiFi HT40 and Bluetooth/BLE 4.2 technology. It is equipped with a high-performance dual-core Tensilica LX6 MCU, operating at 240 MHz with a computing power of 600 DMIPS. This guide will walk you through the necessary steps to get your module running using the Arduino IDE.
2. Setup and Installation
2.1. Installing Arduino IDE
To begin, you need to install the Arduino IDE. It is recommended to use version 1.8.19 or greater. You can download the installer from the official Arduino website:
- Download link: https://downloads.arduino.cc/arduino-1.8.19-windows.exe
Follow the on-screen instructions to complete the installation.
2.2. Installing ESP32 Boards in Arduino IDE
To program the ESP32 module, you need to add the ESP32 board definitions to your Arduino IDE:
- Open the Arduino IDE.
- Go to File > Preferences. This will open the Preferences dialog box.
- In the Preferences dialog, locate the "Additional Boards Manager URLs" textbox.
- If there is existing text, add a comma at the end. Then, paste the following stable release link into the textbox:
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
For development releases, use:https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_dev_index.json - Click OK to save the settings.
- Go to Tools > Board > Boards Manager...
- In the Boards Manager, search for "esp32".
- Locate "esp32 by Espressif Systems" and click the Install button. This will install the necessary ESP32 board definitions.
Once the installation is complete, select the correct board option. Go to Tools > Board > ESP32 Arduino and choose "ESP32 Dev Module".
2.3. Installing TFT_eSPI Library
The example programs for this module are based on the TFT_eSPI library, which supports various commonly used driver chips (e.g., ST7735, ST7789, ILI9341) and offers good compatibility.
- Open the Arduino IDE.
- Go to Sketch > Include Library > Manage Libraries...
- In the Library Manager, search for "TFT_eSPI".
- Locate "TFT_eSPI by Bodmer" and click Install.
2.4. Configuring TFT_eSPI Library
After installing, the TFT_eSPI library requires specific configuration for your screen type and driver chip. This involves modifying the User_Setup.h file.
- Navigate to your Arduino library installation directory. This is typically located at
C:\Users\<username>\Documents\Arduino\libraries\TFT_eSPI. - Locate the
User_Setup.hfile within theTFT_eSPIdirectory. - Step 1: Modify the custom driver file.
Open
User_Setup.h. Among the many driver files listed, choose the one that matches your screen (e.g., ILI9341 for 2.8-inch) and comment out all other unused drivers. For example, uncomment#define ILI9341_DRIVERand ensure others like#define ST7789_DRIVERare commented out.Set the width and height for your specific display. For an ILI9341 display, you might set:
#define TFT_WIDTH 240 #define TFT_HEIGHT 320
- Step 2: Pin Definition.
Define your specific pins and comment out other definitions. This is crucial for the module to communicate correctly with the display. Example pin definitions might include:
#define TFT_MISO 12 #define TFT_MOSI 13 #define TFT_SCLK 14 #define TFT_CS 15 #define TFT_DC 2 #define TFT_RST -1 #define TFT_BL 21 #define TFT_BACKLIGHT_ON HIGH #define TOUCH_CS 33
- Step 3: Turn on the Backlight Pins.
Ensure the backlight pin is correctly defined and set to HIGH for the backlight to turn on.
#define TFT_BL 21 #define TFT_BACKLIGHT_ON HIGH
- Copy
lv_conf.h:If using LVGL, copy the
lv_conf.hfile from the data center (e.g., from the2.8-LVGL_Arduinoexample folder) to the root directory of your Arduino library, specifically where the TFT_eSPI library is located (C:\Users\<username>\Documents\Arduino\libraries\TFT_eSPI).
After these configurations, you can compile and upload the Arduino function to light up the screen.
3. Operating Instructions
This section outlines the basic API functions for controlling the display using the TFT_eSPI library.
3.1. Basic Display Settings
- Initialization:
tft.init();- Initializes the screen. For ST7735, a parameter can be passed. - Fill Screen:
tft.fillScreen(TFT_BLACK);- Fills the entire screen with a specified color. Example:tft.fillScreen(uint32_t color); - Screen Rotation:
void setRotation(uint8_t r);- Sets the screen display rotation angle (0, 90, 180, 270 degrees, represented by 0, 1, 2, 3). - Screen Inversion:
tft.invertDisplay(bool i);- Inverts display colors (i=1for invert,i=0for normal).
3.2. Text Related API
- Set Cursor:
void setCursor(int16_t x, int16_t y);orvoid setCursor(int16_t x, int16_t y, uint8_t font);- Sets the text display coordinates and font. - Set Text Color:
void setTextColor(uint16_t color);orvoid setTextColor(uint16_t fgcolor, uint16_t bgcolor);- Sets foreground and optional background text color. - Set Text Size:
void setTextSize(uint8_t size);- Enlarges font display (size 1 to 7). - Print Text:
tft.print("Hello World!");,tft.printf(...),tft.println(...)- Displays text. Font 7 is a 7-segment digital screen imitation. - Draw String (Left/Center/Right): Functions like
drawString(...),drawCentreString(...),drawRightString(...)for aligned text. - Draw Character:
drawChar(...)- Draws individual characters. - Plot Floating Point Numbers:
drawFloat(...)- Displays floating point numbers.
3.3. Drawing Geometric Figures
- Draw Dots:
void drawPixel(int32_t x, int32_t y, uint32_t color); - Draw Lines:
void drawLine(...),void drawFastHLine(...),void drawFastVLine(...). - Draw Circles:
tft.drawCircle(...)(hollow),void fillCircle(...)(filled). - Draw Ellipses:
tft.drawEllipse(...)(hollow),void fillEllipse(...)(filled). - Draw Rectangles:
void drawRect(...)(hollow),void fillRect(...)(filled). - Draw Rounded Rectangles:
void drawRoundRect(...)(hollow),void fillRoundRect(...)(filled). - Draw Triangles:
void drawTriangle(...)(hollow),void fillTriangle(...)(filled).
3.4. Image Display Related
- Display BMP Picture:
void drawBitmap(...). - XBM (X BitMap) Format: A simple two-color image bitmap format. TFT_eSPI recommends an online XBM production tool (e.g., https://www.online-utility.org/image/convert/to/XBM).
- Display XBM:
void drawXBitmap(...). - Display Pictures:
void pushImage(...)- Various overloads for displaying images with or without transparency.
4. Maintenance
The ESP32 LCD TFT Module is designed for durability. To ensure its longevity and optimal performance:
- Keep the module clean and free from dust and moisture.
- Avoid exposing the module to extreme temperatures or direct sunlight.
- Handle the module with care to prevent physical damage to the screen or PCB.
- When disconnecting or connecting wires, ensure the module is powered off to prevent short circuits.
5. Troubleshooting
- Nothing is displayed on the screen after uploading code:
- Ensure all wiring connections are secure and correct according to the pin definitions in
User_Setup.h. - Verify that the correct board ("ESP32 Dev Module") is selected in the Arduino IDE under Tools > Board.
- After uploading new code, it is important to reset the power of the device to ensure it enters flashing mode again and runs the new program.
- Double-check your
User_Setup.hconfiguration for the correct display driver and pin assignments.
- Ensure all wiring connections are secure and correct according to the pin definitions in
- LDR (Light Dependent Resistor) or other sensors not working:
- Confirm the specific pinout for your module version. Some pins might differ from standard configurations (e.g., IO4 instead of IO22 for an LED).
- Consult the community forums or the provided PDF manual for detailed pinout diagrams specific to your module variant.
- Difficulty finding drivers or specific information:
- Refer to Section 2.3 and 2.4 for detailed instructions on installing and configuring the TFT_eSPI library.
- The provided PDF manual (User manual (PDF)) may contain additional diagrams or specific instructions.
- Poor image quality or color fidelity:
- Some displays may exhibit angle-dependent color fidelity. This is a characteristic of certain display technologies.
- Ensure your code is correctly setting the display resolution and color depth.
6. Specifications
| Feature | Detail |
|---|---|
| Brand Name | AITEWIN ROBOT |
| Model Number | ESP32 LCD TFT Module (2.4/2.8/3.5 inch variants) |
| Display Mode | 320*240 (common resolution, specific to module size) |
| Resolution | 320*240 (common resolution, specific to module size) |
| Origin | Mainland China |
| Package Length | 16 cm |
| Package Width | 14 cm |
| Package Height | 3 cm |
| Package Weight | 0.088 kg |
7. User Tips
- Pinout Research: Be prepared to research the specific pinout for your module version online, as detailed documentation might be scarce. Community forums can be a valuable resource.
- Driver Identification: If encountering display issues, try to identify the exact LCD driver chip used on your module to ensure correct configuration in
User_Setup.h. - Reset After Upload: Always reset the module after uploading new code to ensure the new program starts correctly.
- Protective Case: Consider using a protective case for the module to prevent accidental damage, especially to the exposed PCB components.
- Check for Updates: Keep your Arduino IDE and libraries updated to the latest stable versions for bug fixes and improved compatibility.
8. Warranty and Support
For detailed warranty information and technical support, please refer to the official product page or contact the seller directly. Additional technical documentation and user guides may be available in PDF format:
This PDF may contain specific wiring diagrams, detailed specifications, and advanced programming examples not covered in this general manual.