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.
| ESP8266 | ST7735 1.44” | Function |
|---|---|---|
| GND | GND | Ground |
| Vin (5V DC) | VCC | Power 5V |
| D5 | SCL | SPI Clock |
| D7 | SDA | SPI Data |
| D8 | CS | Chip Select |
| D1 | DC | Data/Command |
| D2 | RES | Reset |
Installing Ucglib Library
- Download Ucglib.rar from the provided link
- Extract the file using WinRAR or WinZip installed on your computer
- Copy the extracted folder into the Arduino IDE libraries folder
Libraries folder location:
This PC > Documents > Arduino > libraries
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
- Open Arduino IDE and paste the code above
- Go to Tools > Board > NodeMCU 1.0 (ESP-12E Module)
- Go to Tools > Port and select the COM port where the board is connected
- Click the Upload button (right arrow icon) in the top menu bar
- Wait until Done uploading appears
- The TFT display will show “ESP8266 + ST7735”, “TFT 1.44 inch”, and “Hello!” on screen
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
จ้างทำโปรเจคเลย