TFT / Color
Interfacing ST7789 1.3" TFT TFT / Color with STM32 Blue Pill
What is the ST7789 1.3" TFT?
ST7789 1.3" TFT practical reference
The ST7789 1.3‑inch IPS TFT display is a compact, high‑density colour screen that delivers vibrant visuals with 240×240 resolution and 65K colours. The IPS (In‑Plane Switching) panel technology provides excellent colour reproduction and viewing angles of up to 80° in all directions, making it ideal for wearable devices, handheld gadgets, dashboards, and compact GUIs.
The display is built around the ST7789 driver chip, which includes a built‑in frame buffer and supports 4‑wire SPI communication. Many modules include a microSD card slot for loading full‑colour bitmaps from FAT16/FAT32 formatted cards.
The module operates at 3.3V logic levels. Some variants (like Adafruit's breakout) include an onboard 3.3V regulator and 3/5V level shifter, making them compatible with both 3.3V and 5V microcontrollers. Always check your specific module's voltage tolerance before connecting.
Note: This entry covers the standard SPI version of the display, which is the most widely available. It also includes optional touch support if your module includes a resistive touch controller (often XPT2046).
Key specifications
- Resolution: 240 × 240 pixels
- Color depth: 65K colours (RGB 16‑bit 565)
- Display technology: IPS (In‑Plane Switching)
- Viewing angle: ~80° all directions
- Interface: 4‑wire SPI
- Operating voltage: 3.3V (some boards accept 5V with level shifter)
- Logic voltage: 3.3V
- Backlight: 3 white LEDs, controlled via PWM
- Active area: 23.4 × 23.4 mm
- Module dimensions: ~32 × 28 mm
- Extra features: microSD card slot (optional)
- Operating temperature: -20°C to 60°C
Pinout and connection notes
Critical usage notes:
- SPI speed: The ST7789 supports SPI clock rates up to 80 MHz, but many microcontrollers top out at 40 MHz. Start with a lower speed (e.g., 10 MHz) if you encounter glitches.
- Backlight: The LED pin can be connected to 3.3V for always‑on, or to a PWM pin for brightness control. Some modules have a dedicated backlight enable pin.
- Voltage: Unless your board has a level shifter, do not apply 5V to logic pins — it will damage the display. The 3.3V supply must be stable; a 100 µF capacitor near the module is recommended.
- SPI MISO: Some modules omit the MISO pin; if your library tries to read from the display, you may need to set
-1as the MISO pin in the constructor or use a software SPI fallback. - IPS advantages: The IPS panel gives consistent colours even when viewed at extreme angles, perfect for wearable screens where the device may be tilted.
- SD card: If your module has an SD slot, it typically uses a separate CS pin (often Pin 4 on Arduino) and shares the same SPI lines.
- VCC: Power — 3.3V (or 5V if board has level shifter)
- GND: Ground
- CS: SPI chip select (active low)
- RESET: Hardware reset, active low
- DC: Data/Command select — high for data, low for command
- SDI (MOSI): SPI data in (Master Out Slave In)
- SCK: SPI clock
- LED: Backlight control — PWM for brightness, or tie high
- SDO (MISO): SPI data out (optional, for reading)
- T_CS: Touch chip select (if touch present, XPT2046)
- T_IRQ: Touch interrupt (optional)
Integration checklist
- Confirm the exact part number and breakout-board revision.
- Verify supply voltage, current demand, logic levels, and signal direction against the datasheet.
- Check controller pin assignments and bus address or interface mode against the example code.
- Power up with external loads disconnected, then test signals before full integration.
- If readings or communication fail, check power and ground first, then pin mapping, interface settings, and library initialization.
Troubleshooting and reproducibility
Record the board used, wiring, library/version, supply arrangement, and measured behavior. Use the selected board-specific wiring example as the source of truth. Never assume visually similar modules share identical voltage tolerance or pin order.
Setting Up ST7789 1.3" TFT with STM32 Blue Pill
Library
Adafruit_ST7789 by Adafruit
STM32duino: Boards Manager → add STM32duino URL → install "STM32 MCU based boards" → Library Manager → search "Adafruit ST7789" → Install (plus Adafruit GFX and BusIO)
Wiring
| Component pin | STM32 Blue Pill pin | Note |
|---|---|---|
| VCC | 3.3V | |
| GND | GND | |
| CS | PA4 | |
| RESET | PA3 | |
| DC | PA2 | |
| SDI (MOSI) | PA7 | |
| SCK | PA5 | |
| LED | 3.3V | Or PWM |
| SDO (MISO) | PA6 | Optional |
Swipe sideways to see every column →
- The Blue Pill runs at 3.3V, perfectly matching the display’s logic level.
- Use the hardware SPI on PA5 (SCK), PA7 (MOSI). PA6 (MISO) is optional.
- For reliable programming, use an ST‑Link programmer with SWD.
Related Components
Related Guides & Projects
STM32 Low-Power Modes: Sleep, Stop, and Standby Explained (With Working Code)
A practical guide to STM32's three-tier low-power system — Sleep, Stop, and Standby — with working STM32duino code, measured current draw on a Blue Pill, and a battery-powered project example.
STM32 Blue Pill Pinout: Every GPIO, ADC, and Alternate Function Explained
A complete STM32F103C8T6 Blue Pill pinout reference: every GPIO port, ADC channel, timer, and communication bus mapped, plus the 5V-tolerance and clone-board considerations that affect wiring decisions.
STM32 Black Pill Pinout: Every GPIO, ADC, and Peripheral Explained
Complete STM32 Black Pill (STM32F411CEU6) pinout reference: GPIO ports, 12-bit ADC, timers/PWM, USART, SPI, I2C, and the 3.3V-only pins to watch out for.
STM32 Nucleo Pinout: Arduino Headers, Morpho Connectors, and GPIO Explained
Complete STM32 Nucleo pinout reference: Arduino-compatible headers vs ST Morpho connectors, the built-in ST-LINK debugger, ADC voltage limits, and every peripheral pin mapped.