Part

IPS display, ST7789

An IPS color TFT, 240x240, 240x320 or 135x240. It shows a negative until the driver sends INVON.

See every part
  • 8 pins
  • 1 setting
  • In 1 project
  • In 1 lesson
Drawn live by the editor's own code, at the size you see it.
At a glance

The IPS display, ST7789 in brief

What it is, and every setting the properties panel gives it.

The ST7789 is the controller behind the small IPS color TFTs: the square 1.3 inch 240x240 board, the 2 inch 240x320 and the 1.14 inch 135x240 on the TTGO T-Display. Its pins say SCL and SDA but it is SPI, not I2C: SCL goes to the SPI clock, pin 13 on an Uno, and SDA to MOSI on 11, with RES, DC and an optional CS on any free pins and BLK for the backlight. The modules run at 3.3 volts. The chip always has 240x320 of memory, so the 240x240 glass is its top 240 rows and a flipped rotation has to start at row 80, while the 135x240 is a window from column 52 and row 40; a driver with the wrong offset draws where nobody can see. IPS glass shows the colors inverted until the driver sends INVON, so a hand-written init without it gives a photographic negative. With CS unwired, as on the 1.3 inch board, only the reset on RES lines the bits up. Gamma, scrolling and the waits after reset are not modeled.

Family
Displays
Pins
8
size
240x240 (or 240x320, 135x240)
240x240 (the default), 240x320 or 135x240. Match it to the numbers the sketch passes to init().
Pins

8 pins

Named as the editor names them, so a wire lands where you expect it.

Pin
Role
What it does
GND
Input or output
Ground.
VCC
Input or output
Supply, 3.3 V.
SCL
Input
The SPI clock. It is not I2C, whatever the name says.
SDA
Input
The SPI data in.
RES
Input
Reset, active low.
DC
Input
Low for a command, high for data.
CS
Input
Chip select, active low. The 1.3 inch board has none; leave it unwired.
BLK
Input or output
The backlight. Pull it low and the picture goes out.
How to use it

How to use an ST7789 IPS TFT with an Arduino

The 1.3 inch board has no CS pin, so it listens to every clock on its wires and needs pins of its own: here SDA on A0, SCL on A1, DC on 7 and RES on 6, with BLK and VCC on 5 V. The five-argument Adafruit_ST7789 constructor runs software SPI on any pins, with -1 for the missing chip select.

Call init() with the panel’s real size and SPI_MODE3, the mode the no-CS boards are usually driven in. Wire RES: with no chip select, the reset is what lines the bits up. Set the part’s size to the numbers init() is given, or the picture lands off the glass.

Part pin
Board pin
SDA
A0
SCL
A1
DC
Pin 7
RES
Pin 6
BLK
5 V
VCC
5 V
GND
GND
Arduino Uno: two color screenslive0.000 s 0.00x
Click to open it in the editor
This is the simulator itself, running here. Click anything to open it in the editor.
Text on a 240x240 ST7789 with no chip select
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_ST7789.h>
Adafruit_ST7789 square(-1, 7, A0, A1, 6);  // no CS; DC, SDA, SCL, RES
void setup() {
  square.init(240, 240, SPI_MODE3);
  square.setRotation(2);
  square.fillRect(0, 0, 240, 40, ST77XX_BLUE);
  square.setTextColor(ST77XX_WHITE);
  square.setCursor(8, 12);
  square.print("ST7789 IPS");
}
void loop() {}
How it is modeled

What is true about the IPS display, ST7789, here

In its help article’s own words: what the simulation gets right, and where it stops.

Modeled

The offsets. The chip always has 240x320 of memory. The 240x240 glass is the top 240 rows of it, so a rotation that counts rows from the bottom has to start at row 80, which is the 80 in every ST7789 library. The 135x240 glass is a window from column 52 and row 40. The part stores only the glass, so a driver with the wrong offset draws where nobody can see, as it does on the bench.

The inverted glass. IPS panels show the controller's colors inverted, and every ST7789 driver sends INVON (0x21) to put them right. Leave it out and the picture is a photographic negative: white is black. That is modeled.

No chip select. A CS left unwired is taken as tied to ground, the way the 1.3 inch board has it. With nothing to mark where a byte starts, the hardware reset on RES is what lines the bits up, so a driver without a reset pin has to be lucky here as on the bench. The chip samples on the rising clock in either SPI mode, so the mode 3 that the no-CS boards are usually driven in works, and so does mode 0.

MADCTL rotation, the window, 16-bit and 18-bit pixels, sleep and display on and off behave as on the ILI9341.

Not modeled

The color order bit, 12-bit color, register reads, timing (the waits after reset and sleep-out are not enforced), gamma, frame rate, partial mode and scrolling. The 170x320 and 240x280 panels are not in the size list.

From ST7789 IPS TFT, in full.

Projects

See the IPS display, ST7789 in a project

One built-in project uses it. It opens in the editor, already wired.

Lessons

Where it turns up in a lesson

One lesson places it in its own circuit.

Boards

The boards it is shown on

This board has a built-in project with the IPS display, ST7789 in it.

Libraries

Arduino libraries for the IPS display, ST7789

Built in, so the sketch compiles with nothing to install. Each page has the calls, the wiring and an example to run.

Wire up the IPS display, ST7789

Open the editor and push it into the breadboard. It is free, and it runs on your own machine.