TFT display, 1.8 inch ST7735
A 1.8 inch color TFT, 128x160, on the ILI9341 command set. Pick the tab color your library was told.
- 8 pins
- 1 setting
- In 2 projects
- In 1 lesson
The TFT display, 1.8 inch ST7735 in brief
What it is, and every setting the properties panel gives it.
The ST7735 drives the 1.8 inch 128x160 color TFT on the red board with an SD slot. Its eight pins carry Sitronix’s names: VCC, GND, CS, RESET, A0, SDA, SCK and LED, where A0 is DC and SDA is SPI data in, not I2C. On an Uno, SDA goes to MOSI on 11 and SCK to 13, with CS, A0 and RESET on any pins; on an ESP32 DevKit, SDA to 23 and SCK to 18. The board has a regulator, so VCC takes 5 V. It speaks the ILI9341’s command set, and what differs is the glass: the chip has 132x162 of memory for 128x160 of glass. Mokxi’s tab property is the colored tab on the film. Black, the default, uses all of the memory; green starts the glass at column 2 and row 1, so a sketch whose initR() names the wrong tab draws two columns and a row where nobody can see them and leaves a black stripe along two edges. MADCTL rotation, inversion, sleep and the LED backlight pin behave as on the ILI9341. The red and blue swap between the tabs is not modeled, nor the SD card, reads or gamma.
- Family
- Displays
- Pins
- 8
- tab
- black (or green)
black(the default) orgreen, the color of the tab on the panel's protective film. It is how the makers mark where the 128x160 of glass sits in the chip's 132x162 of memory. A black tab uses all of it; a green tab's glass starts at column 2 and row 1. Set it to match the module you are copying, and set the sketch'sinitRto match it.
8 pins
Named as the editor names them, so a wire lands where you expect it.
DC: low for a command, high for data.How to use the ST7735 1.8 inch TFT with an Arduino
The silk screen uses the chip maker’s names, and both mislead: SDA is SPI data, so it goes to MOSI on pin 11, not to an I2C pin, and A0 is the DC line, here on pin 9. SCK goes to 13, CS to 10 and RESET to 8, with VCC and LED on 5 V. The board has a regulator, so 5 V on VCC is fine.
Construct Adafruit_ST7735 with CS, A0 and RESET, then call initR() with the tab your module has: INITR_BLACKTAB for the black tab on the film, INITR_GREENTAB for green. The two put the 128x160 glass at different places in the chip’s 132x162 memory. In the two color screens project, set the ST7735’s tab property to green without changing the sketch and look at the edges: a stripe is missing along two of them.
Adafruit_ST7735 compiles on every board here but the ATtiny85; on an ESP32 DevKit the SPI pins are GPIO 23 for SDA and 18 for SCK.
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_ST7735.h>
Adafruit_ST7735 small(10, 9, 8); // CS, A0, RESET
void setup() {
small.initR(INITR_BLACKTAB);
small.fillScreen(ST77XX_BLACK);
small.setTextColor(ST77XX_GREEN);
small.setCursor(4, 4);
small.print("ST7735 128X160");
}
void loop() {}What is true about the TFT display, 1.8 inch ST7735, here
In its help article’s own words: what the simulation gets right, and where it stops.
Modeled
The offset. The chip's memory is bigger than a green tab's glass, and the part stores
only the glass, so a sketch initialized for the wrong tab draws two columns and a row
where nobody can see them and leaves a stripe of black along two edges, which is the
picture that sends everyone looking for the other initR. MADCTL rotation, the
window, 16-bit and 18-bit pixels, sleep, display on and off, inversion and the
backlight pin all behave as they do on the ILI9341.
Not modeled
The color order. The tabs also differ in whether the glass is RGB or BGR, and a library set for the wrong one swaps red and blue on the bench. Here a pixel is always the color that was written. 12-bit color is taken as 16-bit. Nothing is read back. There is no timing: the 120 ms the datasheet asks for after leaving sleep is not enforced. Gamma and frame rate change nothing.
From ST7735 1.8 inch TFT, in full.
See the TFT display, 1.8 inch ST7735 in a project
2 built-in projects use it. Each opens in the editor, already wired.
Where it turns up in a lesson
One lesson places it in its own circuit.
The boards it is shown on
This board has a built-in project with the TFT display, 1.8 inch ST7735 in it.
Arduino libraries for the TFT display, 1.8 inch ST7735
Built in, so the sketch compiles with nothing to install. Each page has the calls, the wiring and an example to run.
The rest of the bench
Every one of these is drawn and simulated the same way.
Wire up the TFT display, 1.8 inch ST7735
Open the editor and push it into the breadboard. It is free, and it runs on your own machine.