[ad_1]
Welcome to our DIY project guide for creating an accurate time display using ESP32 RTC. In this tutorial, we will show you how to build your own millisecond clock that guarantees precise timekeeping. By utilizing the ESP32 RTC (Real-Time Clock) module, you’ll be able to achieve millisecond precision, ensuring that your clock displays the most accurate time possible.
Whether you have a specific need for precise timekeeping or simply enjoy tinkering with electronics, this project is perfect for anyone interested in creating their own time display system. Join us as we take you through a step-by-step guide, providing all the information you need to bring this DIY millisecond clock to life using the versatile ESP32 RTC.
Get ready to embark on a rewarding journey of timekeeping accuracy!
We are fascinated by clocks and have made clocks of several types, but never with a millisecond display due to the huge processing power required for it. We were delighted when we could successfully run the 8.9cm (3.5-inch) ILI9488 TFT display in 8-bit mode with an ESP32 microcontroller. In 8-bit mode, it needs 12 GPIO pins for the display and it is very fast, and there lies the success of this millisecond display clock.
The 8.9cm TFT LCD touchscreen display shield for Arduino Uno is available in the market. Although the TFT display fits very easily on Arduino Uno, a millisecond display is not feasible on Arduino Uno as it lacks computing power. So, the ESP32 and DS RTC modules are used to help the device in calculating down to milliseconds and display it in real-time.
So, unlike other smart clocks, you may have in your home, this clock will help you get an accurate time up to milliseconds. You can use it as a stopwatch as well.
The prototype is shown in Fig. 1, while Fig. 2 shows the TFT display used in the project.
Components Required to Build Millisecond Clock
The components required to build it are mentioned in the Bill of Material table below.
Table 1: Bill of Material | |
Components | Quantity |
ILI9488 TFT display (MOD3) | 1 |
ESP32S (MOD1) | 1 |
RTC DS3231 module (MOD2) | 1 |
Micro USB cable | 1 |
Coin cell | 1 |
DIY Millisecond Clock – Code
First, the code is made to communicate with the RTC DS3231 module and fetch the time from it. After that communication is established with the LCD display. The loop makes the clock function, and it displays the time accurately to a millisecond.
After preparing the source code, upload it to ESP32 by selecting the ESP32S board and ESP port number in Arduino IDE. Fig. 3 shows a snippet of the source code.
After uploading the source code, connect the RTC DS3231 module to the I2C pins of the ESP32 board. Also, connect the TFT LCD display with the ESP32 board. The pinouts of the TFT and ESP32 board are shown in Table 2.
Table 2: Pin Connections of ESP32 and ILI9488 TFT Display | |
ILI9488 TFT Display Pin | ESP32S Pin |
3.3V | 3.3V |
Gnd | Gnd |
D0 | 7 |
D1 | 8 |
D2 | 1 |
D3 | 2 |
D4 | 3 |
D5 | 4 |
D6 | 5 |
D7 | 6 |
CS | 15 |
DC | 0 (keep empty) |
RST | 14 |
WR | 17 |
RD | 18 |
DIY Millisecond Clock Circuit Diagram
Fig. 4 shows the circuit diagram of the project, which is built around ESP32S (MOD1), ILI9488 TFT display (MOD3), and RTC DS3231 module (MOD2).
The clock can be powered with a 5V battery or a USB. After powering up, the time is calculated by RTC DS3231. This RTC has the capability of measuring temperature as well, which is also displayed on the TFT.
The time duration between consecutive seconds is divided by 1,000 to calculate the time in milliseconds and displayed on the TFT. The simple line drawing is tricked to create a thick line, which is put into a variable function. Fig. 5 shows the final TFT clock made by the author.
Download Source Code
You can also check other Interesting DIY Smartwatch Projects we build previously:
The author Somnath Bera is an electronics and IoT enthusiast working as General Manager at NTPC
[ad_2]