====== LamaPLC: ST7789 driver / TFT-LCD screen ====== {{ :display:st7789_1.png?140|ST7789 driver / TFT-LCD screen}} The ST7789 is a popular single-chip controller/driver used for graphic-type TFT-LCD screens, typically featuring vibrant IPS (In-Plane Switching) technology. It is widely used in DIY electronics for its high resolution and fast communication speeds. **Key Technical Specs** * **Resolution:** Commonly 240 x 240 or 240 x 320 pixels. * **Interface:** Uses 4-wire SPI (Serial Peripheral Interface) for high-speed data transfer. * **Color Support:** 262K colors (18-bit) or 65K colors (16-bit). * **Voltage:** Typically operates at 3.3V; using 5V on data pins without a level shifter can damage it. * **View Angle:** IPS versions offer "full viewing angles," meaning colors don't wash out when viewed from the side. * **On-Chip Memory:** Features an integrated display data RAM (DDRAM) of 240 x 320 x 18 bits. This allows the chip to refresh the display independently of the host microcontroller, saving power. * **Colour Depth Options:** Supports various colour formats, including 12-bit, 16-bit (65K colours), and 18-bit (262K colours). * **Logic Voltage:** 1.65V to 3.3V. Signal levels must match this range; using 5V logic (like an Arduino Uno) requires level shifters. * **Temperature Range:** Typically rated for -30 °C to +85 °C, making it suitable for outdoor or industrial use. * **Tearing Effect (TE) Signal:** Provides a synchronization signal to the host MCU to prevent "tearing" artifacts during fast animations by syncing writes with the display's vertical blanking period. * **Hardware Scrolling:** Supports vertical scrolling directly in the hardware, which is much faster and smoother than redrawing the screen via software. ==== Software Libraries ==== * **ESP32:** The ''TFT_eSPI'' library usually delivers the fastest performance. * **Arduino:** Use the ''Adafruit_ST7789'' or ''Arduino_ST7789_Fast'' for basic projects. * **Python/MicroPython:** The ''st7789-mpy'' or ''st7789.py'' library is excellent for rapid prototyping. **Pro Tip:** If your screen shows "inverted" colors (e.g., black is white), look for an invertDisplay() command in your library setup. ==== ST7789 driver Pinout ==== The pinout for the ST7789 depends on whether you have a 7-pin or 8-pin breakout board. Most common DIY modules use a 7-pin layout, but many professional breakouts include a ''CS (Chip Select)'' pin. * **GND:** Ground (0V). * **VCC:** Power (Typically 3.3V; some modules support 5V). * **SCL:** Serial Clock (SPI Clock / SCK). * **SDA:** Serial Data (SPI MOSI). * **RES (RST):** Reset pin (Active low). * **DC (D/C):** Data/Command selection. * **LK (BL):** Backlight control. Some modules add an eighth pin to allow multiple devices on the same SPI bus. * **CS (Chip Select):** Enables or disables the display on the SPI bus. ==== Visual designer for ST7789 ==== To create graphics for an ST7789 display, you can either use professional GUI editors for complex interfaces or simple image converters for static images. If you want to drag-and-drop buttons, sliders, and charts, use these tools that export code directly: * **SquareLine Studio:** The official visual editor for LVGL. It is the most professional option for creating modern, high-end interfaces. You can design the UI and export the C++ code for your RP2040. * **LVGL UI Editor:** An XML-based development environment that provides real-time previews and code generation specifically for embedded UIs. * **EEZ Studio:** An open-source visual tool for designing dashboards and complex user interfaces that can run on small TFT screens **Image & Asset Converters** If you have a picture (JPG/PNG) and just want to display it on the screen: * **LVGL Image Converter:** An online tool that turns images into C arrays that the ST7789 can read. * **LCD Image Converter:** A flexible desktop program for converting bitmaps and custom fonts into various code formats (C array, Binary, etc.). * **image2cpp:** A quick web tool often used with the Adafruit GFX library to turn small icons into code snippets. ===== SPI topics on lamaPLC ===== {{topic>spi}} \\ \\ {{tag>communication SPI ST7789 TFT LCD Screen IPS }} \\ This page has been accessed for: Today: {{counter|today}}, Until now: {{counter|total}}