Simple Application Framework for the Lilygo T-Embed ESP32S3
T-Embed
See product here : https://www.lilygo.cc/products/t-embed
License
Portions of this code are from the Espressif ESP32 IDF (SDK) which is licensed under Apache 2.0
Portions of this code are from the T-Embed examples at https://github.com/Xinyuan-LilyGO/T-Embed
The rest of the code is licensed under Apache 2.0
Features
This is an example Application Framework for the T-Embed. It is intended to showcase
the capabilities of the product and provide a "toolkit" of parts to be repurposed
into your own application. It is not a production ready application! Parts of this
codebase are derived from the ESP32 IDF, LVGL and Lilygo examples.
Main Screen
WiFi AP selection and password entry showing Return character.
Rotate dial to select characters or Backspace or Enter
- Build with ESP-IDF V5 for ESP32S3
- Init CPU
- Init LCD
- Init LED strip
- Init SDCard
- Enable WiFi
- Support WiFi AP scan and (limited) password entry
- Support WiFi SMART configuration (use smartphone to configure WiFi)
- SNTP to get time
- Enable BLE and scan for Bluetooth devices. Note: Classic is NOT supported
- Idle timeout for deep sleep, knob button for wakeup
- Application Shell and UI
- LVGL for widgets
- Support Knob and button for navigation
- Landscape UI shell with
- Status icons [ Wifi, Battery (WIP), BT, SDCard ]
- Title bar
- Area for screen specific data
- Included Screens
- Main menu - Icons, IP Address, Time and Date
- WiFi menu - Scan or SMART config
- WiFi scan - Scan for AP, select AP, Enter password (limited)
- ASCII upper/lower case only - No unicode
- Space NOT included (Needs a font with an appropriate glyph)
- Some special characters
- Backspace only, no cursor
- Enter password
- WIFI SMART - Placeholder to display whilst WiFi is configuring
- SDCard - Browse files on SDCard
- Color test - Displays RGB on LCD
- Support ESP serial Console for debug and screenshot
Out of Scope
The following feature are out of scope for this project
- Extensive Unicode support. LVGL supports Unicode, but the effort to
handle it is beyond this project
- Translations. There is no translation framework used in this project,
although the set of strings is probably small enough that would be feasible
- Timezone and Daylight handling is not supported (yet). Hardcoded only timezone.
- Audio (I2S) IO
- Bluetooth Classic. The ESP32-S3 used in the T-Embed does not support this mode, only BLE
Building and Installing
Prerequisites
- A T-Embed (preferably working)
- An installation of the ESP-IDF V5.0 including ESP32S3 target
- This repository
- A working USB data and power cable
Getting Started
- Plug in your T-Embed. Make sure it is recognized by the OS (I recommend linux)
- Clone the ESP-IDF repository V5.0 branch
git clone --depth=1 --recursive -b v5.0 https://github.com/espressif/esp-idf.git
- Run the
install.sh
in the ESP-IDF repo root install.sh all
- Export the ESP-IDF config into the shell
. ./export.sh
- Check the IDF version
idf.py --version
(should be v5.0)
- Clone this repo and change to where you have cloned it (I use
~/workspace/esp32/tembed
)
idf.py set-target esp32s3
idf.py menuconfig
and set any options you need.
The application comes with sensible default options set for the T-Embed and this application shell
idf.py flash && idf.py monitor
Snapshots
Using the Console, you can take a snapshot of the screen and then generate a PNG from it.
- Connect using
idf.py monitor | tee snap.log
- Navigate to the screen you want to capture
- Type
snap<ENTER>
in the window with idf.py monitor
- Watch a wall of data appear after a short delay
- Use CTRL-] to exit monitor
- Trim the file to just the one line containing the snapshot data (lots of 0000 digits)
- Use
xxd
to convert the hex to bytes: xxd -r -ps <snap.log >snap.raw
- the result should be 108800 bytes long exactly
- Use the python script to convert the raw data to a png (requires python3 pillow library)
python3 rgb565_to_png.py
- Display the PNG with your favorite viewer or web browser