ESP32-S3 SPI Resistive Touch 2.4” LVGL
by Lan_Makerfabs in Circuits > Arduino
79 Views, 0 Favorites, 0 Comments
ESP32-S3 SPI Resistive Touch 2.4” LVGL
The 2.4-inch MaTouch display has just been released. It presents high-resolution and clear display effects with great visual performance. Furthermore, this screen has excellent compatibility with Squareline Studio and LVGL, and operates smoothly.
So we made this project. The article describes the usage of Squareline to design and program an interface through Arduino; the visual interface facilitates development and automatically exports the UI code. It then goes through Arduino for secondary development. The following sections describe how to use and design them.
Supplies
- MaTouch Lite ESP32-S3 SPI Resistive Touch 2.4" ST7789*1pcs
- Mabee_TVOC and eCO2 SGP30 & Temperature and Humidity SHT31*1pcs(special design to reduce the heat affects with air, more details can be learnt in Blog)
- USB cable*1pcs
LVGL Design With Squareline Studio
- Before you use it, you need to add the relevant simplified packages in Squareline Studio according to this wiki.
- Click on "Create-->Arduino", select the “Arduino with TFT_eSPI”.
- Add the image we need, click “ADD FILE INTO ASSETS,” and select the image you downloaded.
- Set the background you like.
- Add a Panel 1 and set its size and position. Set the background image to be semi-transparent so that the data can be clearly seen while blending in with the background of the screen, resulting in a more aesthetically pleasing display.
- Add text and images to Panel 1 to enhance the display of the interface and make it more diverse.
- Continue to add Panel 2, Panel 3, and Panel 4 in the same way, and add the corresponding text and images.
- Add the corresponding images and text at the appropriate position on Screen 1.
- Export the project and select the address where you want to save it.
Code Design With Arduino IDE
- Click on the code project document that you just exported.
- Copy “lv_conf.h” into the “src” folder in the lvgl in libraries.
- Modify the configuration in User_Setup.h
- Copy these files into the Arduino library.
- Download the corresponding library for NS2009 from GitHub and add it to the folder containing ui.ino.
- Connect the Mabee module correctly to the ESP32-S3 module.
- Open ui.ino.
- Download the required libraries for the program from the Arduino IDE.
- Add the Wi-Fi library and set you ssid and password to get network time. Add Wifi initialization and display time function.
- After connecting to Wi-Fi, the device synchronizes Beijing Time via the Alibaba Cloud NTP network time server, then parses and formats the time before displaying it on the screen. Note: Users in different regions can set the parameters "ntpServer" and "gmtOffset_sec" to obtain the local time.
- Add the NS2009 library and add the touch-to-wake function.
- The equipment first collects temperature and humidity data using SHT31. Then, the absolute humidity is calculated through the getAbsoluteHumidity function and passed to SGP30 for environmental compensation. Finally, the eCO₂and TVOC detection values are output by SGP30.
- Select and set the parameters in the Tools menu.
- Verify it and upload.
Result
Follow the steps above, and then you'll have a nice UI on your Matouch Lite 2.4". Try it yourself if you are interested.
Source code can be found on our GitHub page.
Video
We've also put together a fantastic video to show you the project in more detail, so be sure to check it out if you're interested!