Skip to Content

Interface Arduino Uno with ST7735 TFT using Level Shifter

Interface Arduino Uno with ST7735 TFT using Level Shifter

In this tutorial you will learn how to interface a 1.8 inch 128×160 TFT display with a ST7735 driver with an Arduino Uno using a TXS0108E Logic Level Shifter.

The Arduino Uno and many other Arduino boards operate with 5V logic, while many TFT displays, sensors and other devices operate with 3.3V logic. Therefore you often cannot directly connect such devices to an Arduino but need to use a logic level shifter that converters between the 5V and 3.3V levels.

The instructions and code in this tutorial will work with some minor changes for other Arduinos and TFT’s as well. The only requirements are that you are having an Arduino with 5V logic, a TFT with 3.3V logic and that the display uses the ST7735 display driver.

Required Parts

For this tutorial I used an Arduino Uno, a TXS0108E Logic Level Shifter module and an 1.8 inch TFT display with a resolution of 128×160 pixels and an ST7735 display driver IC. Some cables and a breadboard might come in handy as well.

1.8″ ST7735 TFT Display

TXS0108E Logic Level Shifter

Arduino

Arduino Uno

USB Data Sync cable Arduino

USB Cable for Arduino UNO

Dupont wire set

Dupont Wire Set

Half_breadboard56a

Breadboard

Makerguides is a participant in affiliate advertising programs designed to provide a means for sites to earn advertising fees by linking to Amazon, AliExpress, Elecrow, and other sites. As an Affiliate we may earn from qualifying purchases.

1.8″ TFT ST7735 Display Module

The 1.8″ TFT Display Module we are going to use here has as a resolution of 128×160 pixels with 65K RGB colors. The picture below shows the front and back of the display module:

Front and Back of 1.8" TFT ST7735 Display Module
Front and Back of 1.8″ TFT ST7735 Display Module (source
)

The module uses the ST7735S driver chip and is controlled via a SPI-4wire interface. The operating voltage is 3.3V and the display draws around 30mA max.

Note that there are many different versions of this kind of TFT display. Some have an additional SD card or a touch display.

Some of them have a logic level converter built in that allows you to connect the display module to an Arduino that operates on 5V. This one here does not, which means we need to use a logic level converter otherwise you might damage the controller chip of the display.

There are similar displays that use the ST7789 driver IC instead of the ST7735S. The code in this tutorial is for displays with the ST7735S driver IC and will not work for others.

The TXS0108E Logic Level Shifter Module

The TXS0108E is an 8-channels, bi-directional logic level shifter. It converts between different voltage levels, typically 3.3V and 5V. The picture below shows a typical breakout board with the TXS0108E chip in the center.

Breakout board for TXS0108E Logic Level Shifter
Breakout board for TXS0108E Logic Level Shifter

You can see the 8 channels (A1A8, B1B8) labelled on the board. You connect a 5V logic signal to one of B channels and it gets converted to 3.3V logic levels on the corresponding A channel, e.g. A1 <-> B1.

The TXS0108E is bi-directional, which means A can be an input and B an output or the other way around. Furthermore it supports SCM, I²C and SPI communication, and we will need SPI to interface the Arduino with the TFT display.

For more detailed information have a look at the datasheet of the TXS0108E linked below:

How to wire the TXS0108E Logic Level Shifter

Connecting the TXS0108E is easy. You need to provide the higher 5V voltage to the VB pin pin the B channels side and the lower 3.3V to the VA pin on the A channels side. See the wiring diagram below:

Ground goes to GND and there is an OE pin for “Output Enable” that you need to connect to 3.3V to enable the channels.

As mentioned before all the 5V signals need to be connected to the B channels and all 3.3V signals need to be connected to the A channels. You don’t need to use all channels and in the next section we connect the TFT display to the Arduino using 6 channels.

Connecting 1.8″ TFT ST7735 Display with Level Shifter and Arduino Uno

Connecting the TFT Display to an Arduino Uno via the Logic Level Shifter requires quite a few wires and is easy to get wrong. So take your time and care to make the correct connections.

Also note the labelling of the pins on the TFT display is a bit confusing. It shows SDA and SCL pins but since the display has an SPI interface, these are not the SDA and SCL pins for I2C! Instead, SDA maps to MOSI and SCL to SCLK for SPI.

The following wiring diagram shows you how to connect the 1.8″ TFT ST7735 Display via the TXS0108E Logic Level Shifter to an Arduino Uno:

Connecting TFT ST7735 Display with TXS0108E and Arduino
Connecting TFT ST7735 Display with TXS0108E and Arduino

To make things simpler here a table with the connection you need to make:

Arduino UNOLevel Shifter BLevel Shifter ATFT Display
13 (SCLK)B1A1SCL
11 (MOSI)B2A2SDA
8 (RST)B3A3RES
9 (DC)B4A4DC
10 (CS)B5A5CS
7 (BLK)B6A6BL
5VVB
3.3VVAVCC
3.3VOE
GNDGNDGND

Code for TFT ST7735 Display with Adafruit_ST7735 Library

In this section we will use the Adafruit-ST7735 Library to write and draw onto the 1.8″ TFT ST7735 Display. To install it just open the Library Manager, search for “Adafruit-ST7735” and click on the green INSTALL button:

Adafruit-ST7735 in Library Manager
Adafruit-ST7735 in Library Manager

The installer will probably prompt you to install the dependencies as well. Click on INSTALL ALL:

Install the dependencies for Adafruit-ST7735 Library
Install Dependencies for Adafruit-ST7735 Library

With the library installed, we can now test the display. Just compile and upload the following code. It prints the text “Makerguides” with a yellow frame on the display:

#include <Adafruit_GFX.h>     
#include <Adafruit_ST7735.h>  

#define TFT_CS    10   
#define TFT_RST   8  
#define TFT_DC    9   
// #define TFT_MOSI  11  // SDA // HW MOSI
// #define TFT_SCLK  13  // SCL // HW SCLK
// #define TFT_MISO  12  // not used
#define TFT_BL    7   // LED back-light


Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);  // hardware SPI
//Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST);

void setup(void) {
  pinMode(TFT_BL, OUTPUT);
  digitalWrite(TFT_BL, HIGH); 

  //tft.initB();
  tft.initR(INITR_BLACKTAB); // Init ST7735S chip, black tab
  //tft.initR(INITR_GREENTAB); // Init ST7735S chip, green tab
  //tft.setSPISpeed(27000000);

  tft.setRotation(1);
  tft.fillScreen(ST77XX_BLACK);

  tft.setTextColor(ST77XX_WHITE);
  tft.setTextSize(2);
  tft.setCursor(15, 50);
  tft.println("Makerguides");
  tft.drawRect(10, 40, 145, 40, ST77XX_YELLOW);
}

void loop() { }

If you use hardware SPI you will not need the pin definitions for TFT_MOSI and TFT_SCLK. In case of the Arduino the pins for hardware SPI are

  • SCLK -> 13
  • MISO -> 12
  • MOSI -> 11
  • SS/CS -> 10

However, if you use software SPI you will need to define them and you will need to pass them to the other constructor for the tft object:

Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST);

If you compile and upload the code, you should see the following output on your display:

Output on TFT with Adafruit_ST7735 Library
Output on TFT with Adafruit_ST7735 Library

If you don’t see anything, or the colors are wrong, or the text shows artefacts try one of the other initializers for the TFT display in the code:

  //tft.initB();
  tft.initR(INITR_BLACKTAB); // Init ST7735S chip, black tab
  //tft.initR(INITR_GREENTAB); // Init ST7735S chip, green tab

The black tab and green tab refer to the colored tabs attached to the screen protection foil these displays usually comes with. For instance, the picture below shows a TFT display with a Green tab:

TFT Display with Green Tab (source)

The color of the tab is important because it often indicates the type of display controller used. The Green Tab is typically for newer or alternative controllers like ILI9341, ST7735, or other specific models. The Black Tab indicates an older or different controller, such as ST7735R or similar variants, which have slightly different specifications.

Conclusions

In this tutorial you learned how to interface a 1.8 inch 128×160 TFT display with a ST7735 driver with an Arduino Uno using a TXS0108E Logic Level Shifter.

If you have a microcontroller that operates with 3.3V logic you will not need the logic level shifter. Have a look at the Interface TFT ST7735 Display with ESP32 tutorial, where we connect the same TFT to an ESP32.

Should your display using the ST7789 driver instead of the ST7735, you can still use the Adafruit-ST7735 Library to control the display and only small changes to the code are needed.

If you have any comments, feel free to leave them in the comment section.

Happy Tinkering ; )