Sundak Homepage

Go to content

Main menu:

Connecting a ST7735 TFT display to a ESP8266


- A 1.44" color TFT with a ST7735 controller with a resolution of 128x128 pixels. I ordered it on Ebay for about 3 Euro.


This module uses 3.3V on all connections. Since the ESP8266 delivers 3.3V on its GPIO ports, it is ideal for connecting it to the microcontroller. If you want to use the module with an Arduino, you must use a level shifter module to convert 5V to 3.3V for the GPIO ports.

- An ESP12E Devkit from for about 9 Euro. It uses the ESP8266 Chip and a CH340 Controller to make a serial connection to the PC via USB. You can download the windows driver for the CH340 on


Getting Started

I wanted to use the Arduino IDE, since I am more familiar with it than the Nodemcu Development Environment. To use the Arduino IDE with the ESP8266, you have to download some code from Github: These guys have done an incredible job for supporting the ESP8266 in the Arduino IDE. You can find detailed instructions on how to install the core libraries on Github.

In the Arduino IDE you now have to choose the correct board type in the Tools menu. In my case it looks like this:

Next, I had to choose a library for the TFT controller ST7735 that also supports the ESP8266. I decided to use the library from Adafruit. At the time of writing, altough you can install the library from the IDE, the version available there (1.0.1) does not compile on the ESP8266. To continue, close the Arduino IDE. Then go to Github, click on Download ZIP and extract the contents of the ZIP file to a folder called Adafruit-ST7735-Library in the libraries folder of your Arduino IDE installation. In my case this is My Documents\Arduiono\libraries\Adafruit-ST7735-Library. This folder now looks like this:

Make sure you did not create another subfolder within this folder! At the time of writing, the available version on Github was version 1.0.4.

Connecting the TFT to the ESP8266

The following connections were made:

To use the Adafruit ST7735 library, you must know how the pins on the ESP8266 Devkit relate to pin numbers used in the library. The library uses GPIO pin numbers, which I have included in the table above. On this page  you can see a nice drawing of how the pins are referenced as GPIOs.

Creating the first sketch

Start the Arduino IDE. Click on File -> Examples -> Adafruit ST7735 Library -> graphicstest. The sketch will be opened in the IDE. We now have to adjust the pins like this:

#define TFT_CS 16
#define TFT_RST 4 // you can also connect this to the Arduino reset
// in which case, set this #define pin to 0!
#define TFT_DC 5

Here you can see another oddity. The pins are named differently in the sketch than on the TFT module and the Devkit: TFT_CS = CS (D0, GPIO16), TFT_RST = Reset (D2, GPIO 4), TFT_DC = A0 (D1, GPIO5). All these different namings and numberings can drive you crazy. :-)

Now comment the line

  //tft.initR(INITR_BLACKTAB); // initialize a ST7735S chip, black tab

and add the line 

  tft.initB(); //initialize a ST7735B chip

You can now compile and upload the sketch to the Devkit (Click on the Button with an arrow in the IDE). After a short while the display should show some text and graphics. At least on my module not all tests are running without error, but at least it shows, that the TFT is working and if the people at Adafruit keep working on the code, these errors may soon disappear. You may have more luck with ordering the products directly from Adafruit.


Now that I knew that the TFT was working, I found another nice example to try. It is a clock which syncronizes time from NTP servers in the internet. With only a few modifications to the code I was able to run it on my display. Great job done by 0xPIT. Thank you.

Back to content | Back to main menu