This lesson uses: Arduino UNO R3 board, TinkerBlock TK89 1.8'' TFT module, TK97 Logic Level Converter, jumper wires (or breadboard). Learn to drive the TFT with Arduino_GFX library; outcome: screen first shows "Hello!", then cycles "TFT Screen" and full-screen red, green, blue.
1. Install the library
Before writing code, install the Arduino_GFX library:
- Arduino IDE: Tools → Manage Libraries...
- Search: Arduino_GFX
- Find Arduino_GFX Library (moononournation), click Install
2. Wiring
The TK89 is a 3.3 V display, and the Arduino UNO R3 drives its pins to 5 V, so the two are joined through a TK97 Logic Level Converter. The TK89 plugs into the TK97's socket, GND on GND, and takes its 3.3 V from the TK97. The Uno wires to the TK97's header:
- 5V → TK97 5V
- GND → TK97 GND
- D10 → H1 (CS)
- D11 → H2 (MOSI)
- D13 → H3 (SCL, the SPI clock)
- D9 → H4 (DC)
- D8 → H5 (RST)
- D7 → H6 (BL, the backlight: the sketch sets it HIGH)
Nothing goes to the Uno's 3.3V pin, and nothing from the Uno goes straight to the TK89.

3. New sketch
- Arduino IDE: File → New (or Ctrl/Cmd + N) to create a blank sketch
- Confirm board and port are selected (same as Lesson 01)
- Type the code below into the default
setup()andloop()yourself
4. Program structure
Same as last lesson: two fixed blocks setup() and loop().
setup(): Switch the backlight on (D7 HIGH), init the display; runs once.loop(): Keep repeating “show text/graphics → wait → update → repeat”.
You’ll see "Hello!" first, then the screen will cycle red, green, blue—that’s how the small display is used.
5. Code to write
Type the code below at the top of the file and in setup() and loop() (do not copy-paste; typing it yourself helps you remember):
// 1.8" TFT (ST7735): SPI with CS/DC/RST, text and solid colors
//
// The TK89 is 3.3 V only, so an Uno drives it through a TK97 logic
// level converter, with the TK89 plugged into the TK97's socket:
// Uno 5V -> TK97 5V, GND -> GND,
// D10 -> H1 (CS), D11 -> H2 (MOSI), D13 -> H3 (SCL),
// D9 -> H4 (DC), D8 -> H5 (RST), D7 -> H6 (BL).
#include <Arduino_GFX_Library.h>
#define TFT_CS 10
#define TFT_DC 9
#define TFT_RST 8
#define TFT_BL 7 // the backlight stays off until BL is HIGH
Arduino_DataBus *bus = new Arduino_HWSPI(TFT_DC, TFT_CS);
// ST7735 1.8" 128x160 (adjust offset if image is shifted)
Arduino_GFX *gfx = new Arduino_ST7735(
bus, TFT_RST, 0 /* rotation */, false /* IPS */,
128 /* width */, 160 /* height */,
0 /* col offset 1 */, 0 /* row offset 1 */,
0 /* col offset 2 */, 0 /* row offset 2 */,
false /* BGR */);
void setup() {
pinMode(TFT_BL, OUTPUT);
digitalWrite(TFT_BL, HIGH);
gfx->begin();
gfx->fillScreen(RGB565_BLACK);
gfx->setTextColor(RGB565_WHITE);
gfx->setTextSize(2);
gfx->setCursor(10, 10);
gfx->println("Hello!"); // Show once on power-up
}
void loop() {
gfx->fillScreen(RGB565_BLACK);
gfx->setCursor(10, 10);
gfx->println("TFT Screen");
delay(1000);
gfx->fillScreen(RGB565_RED); // Red 1 s
delay(1000);
gfx->fillScreen(RGB565_GREEN); // Green 1 s
delay(1000);
gfx->fillScreen(RGB565_BLUE); // Blue 1 s
delay(1000);
}Program notes
Overall idea: TK89 uses ST7735; it talks to Arduino over SPI (CS, DC, RST, MOSI, SCK). The library’s Arduino_ST7735 handles resolution and offset; after gfx->begin() you use fillScreen for color and setCursor/println for text. This lesson shows "Hello!" in setup and in loop cycles "TFT Screen" with red/green/blue full screen.
| Code | In this lesson |
|---|---|
#include <Arduino_GFX_Library.h> | Include Arduino_GFX library |
new Arduino_HWSPI(TFT_DC, TFT_CS) | Hardware SPI bus (DC, CS; Uno default SCK/MOSI) |
new Arduino_ST7735(...) | ST7735 object; args include 128×160 and offsets (adjust if image is shifted) |
gfx->begin() | Init display and communication |
gfx->fillScreen(RGB565_xxx) | Fill screen (e.g. RED/GREEN/BLUE/BLACK) |
gfx->setCursor(x,y) / println(...) | Set text position and print string |
6. Hands-on
- After entering the code, click Verify (✓) to compile
- Click Upload (→) to upload to the board
- Watch TK89: text first, then red, green, blue in turn, repeat
- Try yourself: change text, color, position
Expected result: As in the figure.
Proceed to Lesson 25.
Edit this page — content/guides/tinkerblock-workshop/24-1-8-inch-tft-display.mdx
Questions about this product
See what other owners have asked, and read their solutions.
This page covers several products. Choose yours to see the right discussions.
Discuss this article
Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.