Breakout Wiring & Test

There are two ways to wire up these displays - one is a more flexible method (you can use any pins on the Arduino) and the other is much faster (4-8x faster, but you are required to use the hardware SPI pins) We will begin by showing how to use the faster method, you can always change the pins later for flexible 'software SPI'

Wiring up the display in SPI mode is pretty easy as there's not that many pins! We'll be using hardware SPI, but you can also use software SPI (any pins) later. Start by connecting the power pins

  • 3-5V Vin connects to the Arduino 5V pin - red wires
  • GND connects to Arduino ground - black wires
  • CLK connects to SPI clock. On Arduino Uno/Duemilanove/328-based, thats Digital 13. On Mega's, its Digital 52 and on Leonardo/Due its ICSP-3 (See SPI Connections for more details) - this is the orange wire
  • MOSI connects to SPI MOSI. On Arduino Uno/Duemilanove/328-based, thats Digital 11. On Mega's, its Digital 51 and on Leonardo/Due its ICSP-4 (See SPI Connections for more details) - this is the white wire
  • CS connects to our SPI Chip Select pin. We'll be using Digital 10 but you can later change this to any pin - this is the yellow wire
  • RST connects to our TFT reset pin. We'll be using Digital 9 but you can later change this pin too - this is the blue wire
  • D/C connects to our SPI data/command select pin. We'll be using Digital 8 but you can later change this pin too - this is the green wire

Install Adafruit ST7735 TFT Library

We have example code ready to go for use with these TFTs. It's written for Arduino, which should be portable to any microcontroller by adapting the C++ source.

Three libraries need to be installed using the Arduino Library Manager…this is the preferred and modern way. From the Arduino “Sketch” menu, select “Include Library” then “Manage Libraries…”

Search for and install the Adafruit GFX library:

And the Adafruit ST7735 library:

Repeat the search and install steps one more time, looking for Adafruit_ZeroDMA. That’s the third and final library.

If this is all unfamiliar, we have a tutorial introducing Arduino library concepts and installation.

Restart the IDE!

After restarting the Arduino software, you should see a new example folder called Adafruit_ST7735 and inside, an example called graphicstest.

Now upload the sketch to your Arduino. You may need to press the Reset button to reset the arduino and TFT. You should see a collection of graphical tests draw out on the TFT.

Once uploaded, the Arduino should perform all the test display procedures! If you're not seeing anything - first check if you have the backlight on, if the backlight is not lit something is wrong with the power/backlight wiring. If the backlight is lit but you see nothing on the display make sure you're using our suggested wiring.

Changing Pins

Now that you have it working, there's a few things you can do to change around the pins.

If you're using Hardware SPI, the CLOCK and MOSI pins are 'fixed' and cant be changed. But you can change to software SPI, which is a bit slower, and that lets you pick any pins you like. Find these lines:

Download: file
// Option 1 (recommended): must use the hardware SPI pins
// (for UNO thats sclk = 13 and sid = 11) and pin 10 must be
// an output. This is much faster - also required if you want
// to use the microSD card (see the image drawing example)
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS,  TFT_DC, TFT_RST);

// Option 2: use any pins but a little slower!
#define TFT_SCLK 13   // set these to be whatever pins you like!
#define TFT_MOSI 11   // set these to be whatever pins you like!
//Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST);

Comment out option 1, and uncomment option 2. Then you can change the TFT_ pins to whatever pins you'd like!

You can also save a pin by setting

#define TFT_RST    9

to

#define TFT_RST   -1

and connecting the RST line to the Arduino Reset pin. That way the Arduino will auto-reset the TFT as well.

This guide was first published on Aug 29, 2012. It was last updated on Aug 29, 2012. This page (Breakout Wiring & Test) was last updated on Oct 13, 2019.