ST7789 Display
The S3 MINI PRO used in this course includes an onboard
0.85-inch 128 × 128 TFT display controlled by the
ST7789 display controller.
The display provides a visual output interface that can be used for:
1. Display Specifications
| Feature |
Description |
| Display Type |
TFT LCD |
| Controller |
ST7789 |
| Screen Size |
0.85 inch |
| Resolution |
128 × 128 pixels |
| Communication |
SPI |
| Board |
WEMOS S3 MINI PRO |
2. Display Connections
The display is already connected internally to the ESP32-S3, so no external wiring is required.
| Display Function |
GPIO |
| Backlight |
GPIO33 |
| Reset |
GPIO34 |
| Chip Select (CS) |
GPIO35 |
| Data / Command (DC) |
GPIO36 |
| MOSI |
GPIO38 |
| SCK / Clock |
GPIO40 |
ESP32-S3
|
|-- GPIO33 --> Backlight
|-- GPIO34 --> Reset
|-- GPIO35 --> Chip Select
|-- GPIO36 --> Data / Command
|-- GPIO38 --> MOSI
|-- GPIO40 --> Clock
|
v
ST7789 TFT Display
3. SPI Communication
SPI stands for
Serial Peripheral Interface.
| Signal |
Purpose |
| SCK |
Provides the communication clock |
| MOSI |
Sends display data from the ESP32-S3 |
| CS |
Selects the display |
| DC |
Indicates whether data is a command or display data |
| RST |
Resets the display |
| BL |
Controls the backlight |
4. Display Driver
The
MicroPython driver used during the course is:
st7789_mpy
The driver provides functions for:
-
- Filling the screen with colours
5. Basic Display Process
Import Modules
|
v
Configure SPI
|
v
Configure Display Pins
|
v
Create ST7789 Object
|
v
Initialize Display
|
v
Draw Text / Graphics / Images
6. Display Coordinate System
The screen resolution is:
128 × 128 pixels
Top-left normally starts at:
X = 0
Y = 0
(0,0) -----------------> X
|
|
|
v
Y
7. Colours
The display can show colours such as:
8. Displaying Text
A text operation normally requires:
9. Fonts
Fonts can be used for:
10. Graphics and Shapes
The display driver can draw:
11. JPG Images
Course example:
jpg_test.py
This demonstrates:
12. PNG Images
Examples:
png_test.py
png_slideshow.py
These introduce:
13. NASA Image Examples
NASA images were used to demonstrate:
-
- Combining images and text
-
- Visual quality of the display
14. Clock Example
The clock example combines:
Display
+
Background Image
+
Font
+
Real-Time Clock
+
Buttons
15. Examples Explored
| File |
Purpose |
hello_test.py |
Basic text/display test |
jpg_test.py |
JPG image rendering |
png_test.py |
PNG image rendering |
png_slideshow.py |
Displays multiple PNG images sequentially |
nasa_clock_test.py |
Displays a clock over a NASA background |
16. Modifying the Examples
Possible modifications include:
-
- Changing background images
-
- Combining text and images
Button Press
|
v
Program Detects Input
|
v
Change Display
Buttons can be used to:
-
- Increase or decrease values
18. Animation
Draw Object
|
v
Wait
|
v
Erase / Redraw
|
v
Change Position
|
v
Repeat
19. Pong / Ping-Pong Game
A simple Pong program could combine:
Display
+
Graphics
+
Buttons
+
Timing
+
Game Logic
The display could draw:
20. Avoiding Unnecessary Global Variables
def show_home_screen(tft):
# Draw the home screen
pass
This makes programs easier to:
21. What to Explore
Experiment with:
22. Key Lesson
MicroPython Program
|
v
ST7789 Driver
|
v
SPI Communication
|
v
ESP32-S3 GPIO
|
v
ST7789 Controller
|
v
TFT Display
|
v
Text / Graphics / Images
The objective is not simply to make something appear on the display, but to understand how the
MicroPython driver communicates with and controls the display hardware.