กลับหน้าหลัก
views
Wiring ESP8266 with ST7735 1.44" TFT LCD Display and Sample Code
Last updated on

Wiring ESP8266 with ST7735 1.44" TFT LCD Display and Sample Code


Wiring ESP8266 with ST7735 1.44” TFT LCD Display and Sample Code

The 1.44-inch ST7735 TFT LCD display is a popular full-color screen for ESP8266 projects. It’s affordable, easy to wire using SPI interface, and works well with Arduino IDE. This guide covers required components, pin mapping, library installation, and a working code example.

Required Components

  • NodeMCU ESP8266 V2 (CP2102)
  • Micro USB Type B to USB 2.0 Type A cable
  • Power Adapter Micro USB 5V 2A
  • Breadboard MB-102 (830 Point)
  • Male-to-Male jumper wires 20cm (40 pcs)
  • Male-to-Female jumper wires 20cm (40 pcs)
  • Female-to-Female jumper wires 20cm (40 pcs)
  • TFT Display IPS 1.44 inch 7P SPI Full Color LCD Module (ST7735)

Pin Connection Table: ESP8266 to ST7735

Check the 7 pins on the ST7735 display before wiring. Connect each pin to the corresponding ESP8266 GPIO pin as shown below.

ESP8266ST7735 1.44”Function
GNDGNDGround
Vin (5V DC)VCCPower 5V
D5SCLSPI Clock
D7SDASPI Data
D8CSChip Select
D1DCData/Command
D2RESReset
Circuit diagram showing complete wiring between NodeMCU ESP8266 V2 and ST7735 1.44" TFT display on a breadboard with color-coded wires labeled for each pin connection

Installing Ucglib Library

  1. Download Ucglib.rar from the provided link
  2. Extract the file using WinRAR or WinZip installed on your computer
  3. Copy the extracted folder into the Arduino IDE libraries folder

Libraries folder location: This PC > Documents > Arduino > libraries

File Explorer window showing the path to Arduino IDE libraries folder with the Ucglib folder already placed inside

Sample Arduino Code for ST7735

After wiring and installing the library, open Arduino IDE, select NodeMCU 1.0 (ESP-12E Module) as the board, choose the correct Port, and paste the code below.

#include <Ucglib.h>

// Define pins connected to ST7735
#define SCLK_PIN  14   // D5 -> SCL
#define MOSI_PIN  13   // D7 -> SDA
#define CS_PIN    15   // D8 -> CS
#define DC_PIN    5    // D1 -> DC
#define RES_PIN   4    // D2 -> RES

// Create ST7735 display object
Ucglib_ST7735_18x128x160_HWSPI ucg(CS_PIN, DC_PIN, RES_PIN);

void setup(void) {
  // Initialize display
  ucg.begin(UCG_FONT_MODE_TRANSPARENT);
  ucg.clearScreen();

  // Set color and font
  ucg.setFont(ucg_font_ncenR14r);
  ucg.setColor(255, 255, 0);   // Yellow text
  ucg.setColor(0, 0, 0);        // Black background

  // Display centered text
  ucg.clearScreen();
  ucg.setPrintPos(10, 40);
  ucg.print("ESP8266 + ST7735");
  ucg.setPrintPos(15, 65);
  ucg.print("TFT 1.44 inch");
  ucg.setPrintPos(35, 90);
  ucg.print("Hello!");
}

void loop(void) {
  // Nothing needed in loop for static display
}

Points to Adjust for Your Display

ST7735 displays come in different variants with screen sizes of 128x160 or 128x128 pixels. If the output is misaligned or cropped, try changing the constructor in the code:

// For 128x128 pixel variants, try:
// Ucglib_ST7735_18x128x128_HWSPI ucg(CS_PIN, DC_PIN, RES_PIN);

// If display shows nothing, verify SCLK is on D5 (GPIO14)
// and MOSI is on D7 (GPIO13)

How to Upload Code to the Board

  1. Open Arduino IDE and paste the code above
  2. Go to Tools > Board > NodeMCU 1.0 (ESP-12E Module)
  3. Go to Tools > Port and select the COM port where the board is connected
  4. Click the Upload button (right arrow icon) in the top menu bar
  5. Wait until Done uploading appears
  6. The TFT display will show “ESP8266 + ST7735”, “TFT 1.44 inch”, and “Hello!” on screen
ST7735 display showing sample text ESP8266 + ST7735, TFT 1.44 inch in yellow on black background, with NodeMCU ESP8266 board and connected wires beside it

Summary

Wiring ESP8266 with the ST7735 1.44” TFT display over SPI is straightforward: connect the pins correctly, install the Ucglib library in the Arduino IDE libraries folder, and upload the code. The key thing to watch out for is that different ST7735 variants may require different constructors in the code. If the screen displays nothing or looks distorted, try changing the constructor to match your specific display model.

อยากทำโปรเจคแบบนี้?

รับทำโปรเจค Arduino / IoT จบงานไว ส่งงานครบ พร้อมสอน

If you need Arduino project service or urgent IoT development, see full service details on the services page

จ้างทำโปรเจคเลย

Project estimate

Want something like this? Open the estimate page.

The long form is now on a separate estimate page, so this article stays clean.

ความคิดเห็น

รีวิวจากคนใช้งานจริง

รีวิวจากลูกค้าและคนที่เคยใช้งาน

ถ้าเคยสั่งงาน เคยอ่านหน้านี้แล้วได้ประโยชน์ หรือมีข้อเสนอแนะ ฝากรีวิวไว้ได้เลย

กำลังโหลดรีวิว...