This template provides a starting point for creating a GUI application on the ESP32-S3 microcontroller using the LittlevGL (LVGL) graphics library and the ESP-IDF framework. The template includes configuration for a 1.9" ST7789 LCD Screen and demonstrates the basics of using LVGL with ESP32 as well as connecting Keyboard and Mouse using USB HDI.
- Install ESP-IDF
- Install VSCode
- Install ESP-IDF Extension for VSCode
- Install SquareLine-Studio
- ESP32-S3 with 1.9" ST7789 LCD Screen (Example pre-built version: LILYGO T-Display-S3)
- Hardware Simulator: Wokwi Project Simulator
This template was created using the following steps:
- Setup IDF command line
- This is only tested and working on Apple Silicon macOS using
.zshshell.# Edit your shell profile nano ~/.zshrc # Add the following lines alias get_idf='. $HOME/esp/esp-idf/export.sh' export IDF_PATH="$HOME/esp/esp-idf:$PATH" export PATH="$HOME/esp/esp-idf/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin:$PATH" export PATH="$HOME/esp/esp-idf/tools:$PATH"
- Create a New Project from Template:
- Read the following link.
- Use a shell to
cdto the folder were you want to create your project folder.# Get the idf-tools get_idf # Create the project using the template idf.py create-project-from-example "espressif/esp_lvgl_port^1.4.0:touchscreen" idf.py add-dependency "espressif/usb_host_hid^1.0.2"
- Setup VSCode Configuration:
- Create the file
c_cpp_properties.jsonin .vscode folder and add necessary configurations.
- Version Control:
- Create a new repository on GitHub for your project.
- Initialize git in your project folder:
git init git add . git commit -m "Inital commit and build"
- Create a development branch [Recommended]
git checkout -b dev
- Once you are ready for next build you make a Pull Request from dev branch on Github and merge it into the main branch.
- Add Board
- Compress the
__ui_project_name__folder inside theguifolder in the project directory.- On macOS you can just: right click -> Compress Folder
- Rename the folder to
t_display_s3.zip
- Locate the
guifolder in this repo and copy thet_display_s3folder inside theboardsfolder. - In your applications folder (if using macOS), find your SquareLine Studio installation, right click
Show Package Contentsthen find theboardsfolder and create a new folder calledLilyGo. - Paste the folder from your clipboard into this folder as well as the .zip folder you created.
- Create GUI
- When you open SquarLine Studio you should now se a tab called LilyGO under Create.
- Once the project is opened, click on Export -> Create Template Project and first create a folder called
squarelinein the project folder (included in .gitignore), and when prompted for Export To choose thegui/__ui_project_name__/main/uifolder in the project folder.
- Export GUI
- Export the
.uifiles by clicking Export -> Export UI Files. - Save
- TODO: Replace this with .devcontainer and GitHub Actions for auto-build!
- Move into the UI folder, build & flash using the idf.py tool.
cd gui/__ui_project_name__ # Move to GUI folder get_idf # Get ESP-IDF tools idf.py build # Build to project with GUI idf.py -p /dev/cu.usbmodem1101 flash # Flash and monitor (replace with your USB-port)
- Press
CMD + Shift + Pand typeESP-IDF: Build your Project - [Optional] to clean build folder press
CMD + Shift + Pand typeESP-IDF: Full Clean Project - [Optional] setup a .devcontainer and use GitHub actions to build automatically when merging to main branch.
After building the project, flash it to your ESP32-S3 and monitor the output:
-
Press
CMD + Shift + Pand typeESP-IDF: Flash (UART) your Project -
[alternatively] flash it from the command line using idf.py
idf.py -p (YOUR_PORT) flash monitorContributions are welcome! If you have improvements or bug fixes, feel free to fork the repository and submit a pull request.
This project is built using esp_lvgl_port which is licensed under the Apache 2.0 License. See Apache License Version 2.0 for the original license of the template.
The modifications and new code in this project are licensed under MIT License. See LICENSE.md for more details.