June 13, 2024


Epicurean computer & technology

Network Time Protocol On The ESP32

2 min read


Community Time Protocol (NTP) is just one of the greatest techniques to keep networked pcs synchronized to the similar time. It is easy, lightweight, and not only makes it possible for computers to retain a time normal jointly, but it also lets some computer manufacturers to preserve some dollars on components expenses. The Raspberry Pi is most likely the most effectively-recognised illustration of a small-charge pc devoid of the further cost of a real-time clock (RTC). Whilst the Pi sets up NTP essentially immediately, other microcontrollers like the ESP32 never, but it is attainable to configure them to use this time common with some function.

For this job the MicroPython implementation for the ESP32 is expected. MicroPython is a way of jogging Python code on microcontrollers or other embedded programs devoid of all of the overhead that Python would ordinarily demand. The good thing is plenty of, the NTP libraries are constructed appropriate in so when MicroPython is operating on the ESP32 it’s just about as effortless as calling the library. Of study course you will have to make certain there is an world wide web connection, and then grab the time, sync it to the device, and then set the timezone.

For a bonus training, the project’s creator [Bhavesh] suggests trying to configure Daylight Cost savings Time, although this can be a astonishingly tricky problem to solve. In the meantime, there are a couple of other methods of setting up a clock on a microcontroller like this one. An RTC module is an evident choice, but you can also get exceptionally precise time by working with a GPS module as well.


Supply connection