ST7735 at a glance
Item | ST7735 (V2.1) | ST7735R (V0.2) | ST7735S (V1.1) |
|---|---|---|---|
Frame memory | 132 × RGB × 162 | 132 × RGB × 162 | 132 × RGB × 162 |
Panel resolutions (GM pins) | 132×162, 128×160 | 132×162, 128×160 | 132×162, 132×132, 128×160 |
Colour depth | 12, 16 or 18 bits per pixel | 12, 16 or 18 bits per pixel | 12, 16 or 18 bits per pixel |
Serial interface | 3-wire and 4-wire | 3-wire and 4-wire | 3-wire and 4-wire |
Parallel interface | 8080, 8/9/16/18-bit | 8080 and 6800, 8/9/16/18-bit | 8080 and 6800, 8/9/16/18-bit |
I/O supply (VDDI) | 1.65 V to VDD | 1.65–3.7 V | 1.65–3.7 V |
Analog supply (VDD) | 2.6–3.3 V | 2.3–4.8 V | 2.5–4.8 V |
Serial clock cycle, write / read | ≥ 66 ns / ≥ 150 ns | ≥ 66 ns / ≥ 150 ns | ≥ 66 ns / ≥ 150 ns |
All values are from the Sitronix datasheets listed under Sources. For your module, the supply range on the module specification takes priority, because the module may add its own regulator or backlight circuit.
Unlike the ILI9225, the ST7735 uses the same MIPI-style commands as the ST7789V and ILI9341: 0x2A and 0x2B set the column and row window, 0x2C writes pixels, 0x36 (MADCTL) sets orientation and colour order, and 0x3A (COLMOD) 0x05 selects 16-bit colour. 0x04 (RDDID) reads the display ID.
Why ST7735 modules need an offset
The chip has memory for 132 × 162 pixels, but most modules show 128 × 160, 128 × 128 or 160 × 80. The ST7735S datasheet describes three panel resolutions, selected by the GM pins on the glass: 132×162 (all source and gate outputs), 132×132, and 128×160 (outputs S7–S390 and G2–G161). Which part of the memory is visible therefore depends on how the panel was built.
If the library's window does not match the visible area, one or two columns or rows are never written and show random pixels, or the image is shifted. Libraries fix this with a column and row offset, usually chosen through a "tab" option:
Library option | Panel | Column / row offset (rotation 0) | Colour order | Source |
|---|---|---|---|---|
Adafruit | 128 × 160 | 2 / 1 | BGR | Adafruit_ST7735 |
Adafruit | 128 × 160 | 0 / 0 | RGB | Adafruit_ST7735 |
Adafruit | 128 × 128 | 2 / 3 (row 1 in rotations 2 and 3) | BGR | Adafruit_ST7735 |
Adafruit | 160 × 80 | 24 / 0 | RGB | Adafruit_ST7735 |
Adafruit | 160 × 80 | 26 / 1, inversion commands swapped | BGR | Adafruit_ST7735 |
TFT_eSPI | 128 × 160 | 0 / 0 | — | TFT_eSPI |
TFT_eSPI | 128 × 160 | 2 / 1 | — | TFT_eSPI |
TFT_eSPI | 128 × 128 | 2 / 3 | — | TFT_eSPI |
TFT_eSPI | 128 × 128 | 0 / 32 | — | TFT_eSPI |
TFT_eSPI | 160 × 80 | 26 / 1 | BGR, inverted | TFT_eSPI |
TFT_eSPI | 160 × 80 | 24 / 0 | — | TFT_eSPI |
Linux | 128 × 128 | 2 / 3 | RGB | Linux |
Linux | 128 × 160 | 0 / 0 | BGR | Linux |
Offsets change with rotation: when the display is turned 90°, the column and row offsets swap. For example TFT_eSPI uses 1 / 26 instead of 26 / 1 for GREENTAB160x80 in rotations 1 and 3. Use the library's rotation function rather than adding the offset yourself in only one orientation.
Troubleshooting order
- Stray pixels along one or two edges, or the image shifted by a few pixels: wrong offset. Change the tab option, or set the column/row offset directly.
- Red and blue swapped: wrong colour order. Bit 3 of MADCTL (
0x08) selects BGR. In Adafruit's libraryBLACKTABandMINI160x80use RGB and the other tabs BGR; in TFT_eSPI setTFT_RGB_ORDER. - Negative image (white looks black): the panel needs the opposite inversion command.
0x20is INVOFF and0x21is INVON. Adafruit'sMINI160x80_PLUGINoption swaps the two for that reason. - Mirrored or upside-down image: MADCTL bits MY (
0x80), MX (0x40) and MV (0x20) set the direction. The Linux driver uses MX|MY for 0°, MX|MV for 90°, none for 180° and MY|MV for 270°. - Noise, lines or a white screen that changes with wiring: lower the SPI clock. The datasheet minimum write cycle is 66 ns (about 15 MHz). The TFT_eSPI setup file warns that more than 27 MHz may not work.
- No reply when reading the ID: some modules do not connect the read path. The Linux driver marks the Adafruit 1.8″ panel as write-only because it cannot be read over SPI.
Initialization
Adafruit's initR sequence (described in the library as common to all ST7735R displays) and the Linux st7735r driver use the same values:
- Software reset
0x01, wait 150 ms; sleep out0x11, wait up to 500 ms. - Frame rate
0xB1,0xB2=0x01 0x2C 0x2D;0xB3= the same three bytes twice. - Inversion control
0xB4=0x07. - Power control
0xC0=0xA2 0x02 0x84,0xC1=0xC5,0xC2=0x0A 0x00,0xC3=0x8A 0x2A,0xC4=0x8A 0xEE; VCOM0xC5=0x0E. - Colour mode
0x3A=0x05(16-bit), then gamma0xE0/0xE1(16 bytes each), normal display on0x13and display on0x29.
Adafruit also keeps a separate initB sequence for the older ST7735B. Power, VCOM and gamma values depend on the glass, so if your module came with init code, use it.
How fast can it redraw?
A full 128 × 160 frame in RGB565 is 40,960 bytes. The times below are bits ÷ clock, with no command overhead:
SPI clock | Full frame |
|---|---|
15 MHz (66 ns datasheet write cycle) | 22 ms |
27 MHz (TFT_eSPI warning limit) | 12 ms |
Driver support
- Arduino: Adafruit ST7735 and ST7789 Library (
Adafruit_ST7735,initRwith a tab option, orinitB). - TFT_eSPI:
ST7735_DRIVERwith one tab option in the setup file. - Linux: the
st7735rDRM driver (drivers/gpu/drm/sitronix), with the two panel types above.
1.77″ and 1.8″ 128×160: check the controller
Not every 128×160 module uses an ST7735. Our 1.77″ 128×160 module PJ177Z12 lists an ILI9163V controller, an MCU (8080) interface and a 20-pin FPC, with a 28.03 × 35.04 mm active area. TFT_eSPI treats the ILI9163 as a separate driver (ILI9163_DRIVER), so pick the driver that matches the module specification rather than the panel size.
Related pages
For the 240×320 controller that often replaces it, see ST7789V, and to tell controllers apart on an unknown module, see ILI9341 vs ST7789. For SPI wiring and bus speed, see our SPI display page.
ST7735 init code
// colstart/rowstart: the offset for your module, e.g. 2/1 (Adafruit GREENTAB)
// or 26/1 (TFT_eSPI GREENTAB160x80). 0/0 for REDTAB and BLACKTAB.
void setWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1) {
x0 += colstart; x1 += colstart;
y0 += rowstart; y1 += rowstart;
cmd(0x2A); data16(x0); data16(x1); // CASET
cmd(0x2B); data16(y0); data16(y1); // RASET
cmd(0x2C); // RAMWR, then RGB565 pixels (COLMOD 0x05)
}ST7735 troubleshooting & FAQ
Which tab setting should I use for my ST7735 display?
Try them in turn. TFT_eSPI notes that the tab names came from the colour of the tab on the screen protector film, but that this is not always right. Start with the resolution: GREENTAB, GREENTAB2, REDTAB or BLACKTAB for 128×160, GREENTAB3 or GREENTAB128 for 128×128, and GREENTAB160x80 or REDTAB160x80 for 160×80. Pick the one with no stray pixels at the edges and the correct colours.
Why does my ST7735 show a line of random pixels at the edge?
The controller has 132×162 pixels of memory, more than a 128×160 or 128×128 panel shows. If the library writes to the wrong part of that memory, one or two columns or rows are never cleared and show random data. Choose the tab or offset that matches your module, for example 2/1 (Adafruit GREENTAB) or 2/3 (Adafruit 1.44″ GREENTAB).
Are ST7735R and ST7735S different chips?
They are versions of the same Sitronix controller with the same 132×162 memory, command set and serial timing. The datasheets differ in details: the ST7735S adds a 132×132 resolution option on its GM pins and lists VDD 2.5–4.8 V, the ST7735R lists 2.3–4.8 V.
What SPI clock can an ST7735 use?
The datasheets give a minimum serial clock cycle of 66 ns for writes, about 15 MHz, and 150 ns for reads. In practice many libraries run faster; the TFT_eSPI setup file warns that more than 27 MHz may not work and causes spurious pixels and lines. If the image is noisy, lower the clock first.
Sources
- Sitronix ST7735 datasheet V2.1 (2010-02-01)
- Sitronix ST7735R datasheet V0.2 (2009-08-05), hosted by Adafruit
- Sitronix ST7735S datasheet V1.1 (2011-11), hosted by Crystalfontz
- Adafruit ST7735 and ST7789 Library, Adafruit_ST7735.cpp/.h @ 5400a05
- TFT_eSPI ST7735_Rotation.h @ f96c422
- TFT_eSPI User_Setup.h @ d506a3c (tab options, SPI clock note)
- Linux drivers/gpu/drm/sitronix/st7735r.c @ 5164f7e