Introduction
LVGL (Light and Versatile Graphics Library) is an open-source embedded graphics library written in C. It provides everything needed to create modern UIs on microcontrollers and embedded processors with limited resources, targeting displays from simple monochrome to full HD.
What LVGL Does
- Renders rich UIs on resource-constrained devices with as little as 32KB RAM
- Provides 30+ built-in widgets including buttons, charts, lists, and keyboards
- Supports touch, mouse, keyboard, and encoder input devices
- Offers animations, anti-aliasing, opacity, and smooth scrolling effects
- Works with any display driver and runs on bare metal or with an RTOS
Architecture Overview
LVGL uses a retained-mode rendering architecture with a display buffer system. The library maintains an internal scene graph of objects and only redraws areas that have changed (partial rendering). It operates on a single-threaded tick-based loop, making it predictable for real-time systems. The hardware abstraction layer separates display and input drivers from core logic.
Self-Hosting & Configuration
- Include LVGL source files directly in your embedded project (no OS required)
- Configure via lv_conf.h to enable or disable features and set memory limits
- Provide a display flush callback and optional input read callback
- Supports FreeRTOS, Zephyr, RT-Thread, and bare-metal environments
- SquareLine Studio available as a visual UI design tool for LVGL
Key Features
- Extremely low memory footprint (64KB flash, 16KB RAM minimum)
- Hardware-accelerated rendering via GPU support (STM32 DMA2D, NXP PXP)
- Multi-language support with UTF-8, BiDi text, and Arabic shaping
- Built-in themes and style system for consistent look-and-feel
- MicroPython and JavaScript bindings available
Comparison with Similar Tools
- Qt for MCU — Commercial, higher memory requirements; LVGL is free and lighter
- TouchGFX — STM32-only; LVGL is vendor-agnostic and portable
- emWin — Segger proprietary; LVGL is MIT-licensed and community-driven
- u8g2 — Focused on monochrome displays; LVGL handles full-color UIs
- Dear ImGui — Immediate mode for desktop; LVGL is retained mode for embedded
FAQ
Q: What hardware does LVGL run on? A: Any MCU or MPU with at least 32KB RAM and a display. Popular targets include STM32, ESP32, NXP, and Raspberry Pi Pico.
Q: Does LVGL require an operating system? A: No. LVGL runs on bare metal with a simple periodic tick call. It also integrates with FreeRTOS, Zephyr, and other RTOSes.
Q: How do I design UIs visually? A: SquareLine Studio is a drag-and-drop editor that exports LVGL-compatible C code.
Q: Can LVGL handle touchscreens? A: Yes. It supports capacitive and resistive touch panels, plus gestures like swiping and long-press.