Network Time Protocol (NTP) is just one of the greatest approaches to continue to keep networked personal computers synchronized to the identical time. It’s very simple, light-weight, and not only will allow pcs to retain a time regular jointly, but it also allows some laptop or computer companies to conserve some cash on components expenses. The Raspberry Pi is possibly the most very well-recognised case in point of a minimal-price personal computer devoid of the more price of a true-time clock (RTC). Even though the Pi sets up NTP in essence instantly, other microcontrollers like the ESP32 do not, but it is doable to configure them to use this time conventional with some get the job done.
For this job the MicroPython implementation for the ESP32 is demanded. MicroPython is a way of jogging Python code on microcontrollers or other embedded methods without all of the overhead that Python would usually involve. Thankfully sufficient, the NTP libraries are constructed proper in so the moment MicroPython is managing on the ESP32 it is practically as quick as calling the library. Of course you will have to make guaranteed there is an web relationship, and then get the time, sync it to the equipment, and then set the timezone.
For a bonus physical exercise, the project’s creator [Bhavesh] implies making an attempt to configure Daylight Personal savings Time, while this can be a remarkably difficult difficulty to address. In the meantime, there are a couple other strategies of setting up a clock on a microcontroller like this 1. An RTC module is an apparent preference, but you can also get very correct time by applying a GPS module as very well.