
In order to access the current time we will use the Arduino time library which will help us convert the epoch time to the current time in hour, minute and seconds. The Epoch time or the UNIX time is the number of seconds that have passed since the Unix epoch which is 00:00:00 UTC on 1 January 1970, minus leap seconds. When the NTP receives the request, it will transmit the time stamp containing the information regarding the time which will be the epoch time. After the connection is made, the ESP board will send a request to the server. The server () will be able to connect with the client. Our ESP development board will be the client and will connect to a time server using the NTPClient library. We will use the NTP server: which is easily accessible for everyone worldwide. To get the current time with ESP32 or ESP8266 through the NTP server, the server will operate in the client-server model. With a precision of approximately 50ms over the wide-area network (WAN) and less than 5ms over the local area network (LAN), it synchronizes epoch/current time of all networked devices to the UTC. NTP is a standard internet protocol that is widely used to synchronize computer clocks to a reference network.
#PROTEUS X2 HOW TO#
Now let us see how to obtain the current time from the NTP server. You will however require a steady internet connection for this project. In both of the sketches, you can use either ESP32 or ESP8266 development board to build the clock. One for the Analog clock and the other for the Digital clock. We will program our ESP boards using the Arduino IDE and acquire the current time from the NTP server. Our aim is to build two types of OLED based clocks: Analog and Digital using ESP32 and ESP8266 boards.



This user guide is divided into the following sections: You may want to have a look at it as well. In a previous article, we built an Internet Based Digital Clock using ESP32 and MAX7219 Dot Matrix Display. This user guide is applicable for both ESP32 and ESP8266 development boards. You can further enhance this project to display the date with the clock as well. For the Analog clock, we will first build the clock face, hour, minute, and second hands and accordingly acquire the time from the NTP server to display the Analog clock appropriately. We will use the NTP server to acquire the current time and display it on the OLED for the digital clock in a 24-hour format consisting of HH:MM: SS. In this tutorial, we will create two types of IoT based clocks such as Analog and Digital using OLED display and ESP32 and ESP8266 NodeMCU development boards.
