Skip to Content

Flip Clock with LILYGO T-Display S3 Long

Flip Clock with LILYGO T-Display S3 Long

In this tutorial we are going to build an electronic flip clock using the LILYGO T-Display S3 Long.

The T-Display S3 Long is a compact development board based on the ESP32-S3 microcontroller. It features a wide, elongated color screen. With Wi-Fi and Bluetooth support, it provides a great platform for display oriented applications.

Flip Clock on T-Display S3 Long
Flip Clock on T-Display S3 Long

The T-Display S3 Long comes with code for a great looking flip clock (see above) but it is not easy to get this code working – it took me 2 days. In the following sections, I will show how to simplify it and make it work with the Arduino IDE and the current ESP32 core 3.3.x.

Required Parts

You will need a T-Display S3 Long by LILYGO and a USB-C cable to program the board and to try out the code examples.

LILYGO T-Display S3 Long

USB C Cable

Makerguides is a participant in affiliate advertising programs designed to provide a means for sites to earn advertising fees by linking to Amazon, AliExpress, Elecrow, and other sites. As an Affiliate we may earn from qualifying purchases.

The T-Display S3 Long

The T-Display S3 Long is built around the ESP32-S3R8 microcontroller, which is a dual-core LX7 processor offering both WiFi (802.11) and Bluetooth Low Energy (BLE 5), plus support for Bluetooth Mesh. The board includes 16 MB flash memory for program storage and 8 MB PSRAM for additional RAM usage. It has battery voltage detection on GPIO02, allowing monitoring of an attached battery.

The display is a 3.4-inch capacitive touch TFT LCD, supporting color depths in both 16-bit (RGB565) and 18-bit (RGB666) modes. Its resolution is 180 (horizontal, RGB) × 640 (vertical) pixels. The screen is interfaced via QSPI, enabling relatively fast data transfers suitable for graphical and touch applications.

Onboard controls of T-Display S3 Long
Onboard controls of T-Display S3 Long

Onboard controls include a boot button and a reset button, as well as a hardware switch for the battery (see above). Power and programming are handled via USB-C. The board also includes features to support battery-powered use. Power consumption is around 140mA with the display active and around 50mA with the display off.

The following table summarizes the technical specification:

ParameterValue
MicrocontrollerESP32-S3R8 (dual-core LX7)
Wireless ConnectivityWiFi 802.11, Bluetooth Low Energy 5, Bluetooth Mesh
Flash Memory16 MB
PSRAM8 MB
Display Size & Type3.4-inch capacitive touch TFT LCD
Display Color DepthsRGB565 (16-bit), RGB666 (18-bit)
Display Resolution180 (H, RGB) × 640 (V) pixels
Display InterfaceQSPI
Battery Voltage DetectionGPIO02
Onboard ControlsBoot button, Reset button, Battery switch
Programming / Power InterfaceUSB-C

Components of the T-Display S3 Long

The following picture shows the components T-Display S3 Long. You can see the front and back of the display module. On the back you find all the connectors, the Wi-Fi Antenna and the ESP32 chip:

Pinout of the T-Display S3 Long
Components of the T-Display S3 Long (source)

There are a USB-C connector, Qwiic connecter, a connector for a LiPo battery and a GPIO connector. More about the available GPIO pins in the next section.

Pinout of the T-Display S3 Long

There is a small (1.27mm pitch) connector with 30 pins at the back of the module. It exposes 16 GPIO pins as indicated on the back label:

Pinout of the T-Display S3 Long
Pinout of the T-Display S3 Long

Code for Flip Clock on T-Display S3 Long

In this section we will install the libraries, download the code and upload the code for the flip clock to the T-Display S3 Long.

Install libraries

First go to the Lilygo github repo for the display at T-Display-S3-Long. Click on the green “<> Code” button and then “Download ZIP” to download the repo as a ZIP file:

Next unpack the ZIP file to extract it contents. You should see the following files in the unpacked folder:

We need to copy the contents of the “lib” folder into the “libraries” folder for the Arduino IDE. Under Windows the “libraries” folder is typically located under:

C:\Users\<username>\OneDrive\Documents\Arduino\libraries

Since this folder already contains installed libraries I recommend you temporarily rename it, e.g. to “_libraries” and create a new folder named “libraries”. This way you avoid conflicts with your already installed libraries and you don’t loose them either. The picture below shows how your “Arduino” folder should look like:

Next we copy the files in the “lib” folder (from the Lilygo github repo) into the new “libraries” folder.

And that completes the installation of the required libraries (lvgl, XPowersLib).

Download flip clock code

You can find the original code for the flip clock in Lilygo github repo under T-Display-S3-Long/examples/factory but as of Sep 2025 it doesn’t compile. It is also overly complex. So, I fixed the errors, simplified it and created a new version that you can download here: flip-clock.zip.

Unzip it and you should have a folder named “flip_clock” with the following content:

Double click on “flip_clock.ino” to open the project in your Arduino IDE.

Upload Code to T-Display S3 Long

Before uploading the code for the flip clock code to the T-Display S3 Long, you should set some constants in the code. Open the pins_config.h file and there you can set your WI-FI SSID and PASSWORD, the BL_BRIGHTNESS of the display and the TIMEZONE:

The TIMEZONE shown above is for Berlin in Germany. For other time zone definitions have a look at the Posix Timezones Database. Just copy and paste the string you find there and change the TIMEZONE constant accordingly. The flip clock code pulls the current time from an internet time server and is therefore always accurate but it needs Wi-Fi access.

Next, select the “ESP32S3 Dev Module” as board and under the “Tools” menu set the following parameters:

Tools Settings in Arduino IDE
Tools Settings in Arduino IDE

Most important are Flash Size, Partition Scheme and PSRAM. The other parameters should be the default settings but you better check. The settings above worked for me. Note that the board uses USB as the JTAG upload port. When printing serial port information the USB_CDC_ON_BOOT configuration needs to be turned on.

Now you can upload the code to your T-Display S3 Long and hopefully enjoy a great looking flip clock! If not, read the following section.

Can’t upload to T-Display S3 Long

If something is wrong with the code or libraries the T-Display S3 Long often enters a crash loop and it will be difficult to upload new code. There are many suggestions on the internet on how to get around this but none of them worked reliably for me. What worked is the following sequence:

  • Unplug the USB cable from your computer
  • Press and hold the “Reset” button of the T-Display S3 Long
  • Plug-in the USB cable
  • Release the “Reset” button

Note that the “Reset” button is the button on the right (from the back of the board):

Other suggests such as “Press Boot” or “Press Boot, hold, press Reset, release Reset, release Boot” did not work for me.

Flip Clock code Modifications

The original demo code for T-Display S3 Long works for some examples but as of Sep 2025 not for the flip clock, which is the one everyone wants ; )

Furthermore, the original flip clock code is rather complex and creates four pages (clock, Lilygo logo, device info, QR codes). I reduced this to two pages showing the clock and the device info, only:

As in the original code, you can flip between the pages by vertically sliding your finger across the touch screen.

I also simplified the original code quite a bit but there is more work left to make it really clean code. However, the new version should be simple enough to change it or to add your own functionality.

Conclusion

In this tutorial you learned how to run a flip clock on the LILYGO T-Display S3 Long module.

With the simplified flip clock code you should have a good starting point to add your own functionality, e.g. a calendar display on a second page, automatically adjusting the brightness of display according to ambient light measured by an LDR, a PIR sensor to activate display only when motion is detected, and deep-sleep mode to preserve battery power.

Note that the T-Display S3 Long uses the AXS15231B display driver, which currently is not supported by the TFT_eSPI library. You will have to use the LVGL library, which is more powerful but also more complex. However, it allows you to design really good looking User Interfaces using SquareLine Studio.

Should you be interested in ESP32 based clocks in general, have a look at the following tutorials:

If you have any questions feel free to leave them in the comment section.

Happy tinkering 😉