Ticker

6/recent/ticker-posts

Header Ads Widget

NTP Client simulation using ESP32

Hello Guys, In this blog, I will guide you with the simulation of ESP32 to synchronize Date and Time with NTP (Network Time Protocol). For this, I am going to use ESp32 and LCD (16x2) based on I2C.


Circuit Connection:

To add components you can use + button . The green play button can be used to run the simulation.


Source Code :

This code is an example of how to use the WiFi, TimeLib, Wire, and LiquidCrystal_I2C libraries to connect to a WiFi network, synchronize the time with an NTP server, and display the time on an LCD screen. The code sets up a connection to a WiFi network with the specified SSID and password. The code also sets the NTP server, and the UTC offset and daylight saving offset. In the setup function, the code initializes the LCD screen and backlight, and sets the cursor position. The code also prints the IP address of the ESP32 microcontroller after it connects to the WiFi. In the loop function, the code calls the printLocalTime() function which retrieves the current time from the NTP server, formats it, and prints it to the LCD screen. The code also calls a spinner function which displays a rotating glyph on the LCD screen while waiting for the WiFi connection to be established.

Video Tutorial:


Post a Comment

1 Comments

  1. Hi Satyam, nice code you got here and I got it to work in actual hardware using ESP32 and LCD1602-i2C. Thanks for the code. I was just wondering, the line

    WiFi.begin("ssid", "password", 6);

    What is the significance of the number 6?

    ReplyDelete