Skip to content

uPesy now ships to the entire European Union

Livraison à partir de seulement 2.50€ !

Contents Menu Expand Light mode Dark mode Auto light/dark mode

Connaître l’heure exacte depuis ESP32 avec Internet en MicroPython

(Updated at 01/23/2023)

And yes, the ESP32 can retrieve the exact time and date with just an Internet connection. As soon as the ESP32 is completely turned off, it loses track of time. It is like an oven or microwave clock that displays 00:00 when there was a power failure. The most classical way is then to use an external RTC with a battery permanently connected


This is typically what he had in the old computer towers to maintain the BIOS clock with a CMOS battery.

But this requires additional equipment, more space and costs more.

Synchronizing the clock is very useful when the ESP32 wakes up from time to time to communicate with WEB services, and wants to date its packets with the right date. It can also be useful to have an alarm clock that executes a task at a specific time.


An external RTC clock may be useful if the ESP32 does not have an Internet connection. It is possible to use an NTP server to adjust the RTC clock and synchronize it with the real time 😉.

NTP server: What is it for?

Time synchronization between computers

NTP (Network Time Protocol) servers are designed to synchronize the clocks of computers on a computer network. Their purpose is to ensure that all computers on the network share the same time, which is important for various applications, such as file management or computer security. It is also to avoid errors due to a lack of synchronization of clocks.

This article is available to premium members only. You still have 73% to discover.

Subscribe for only 5$/month

Already subscribed? Sign in