Network Time Protocol On The ESP32

Network Time Protocol (NTP) is one of the best ways to keep networked computers synchronized to the same time. It’s simple, lightweight, and not only allows computers to maintain a time standard together, but it also allows some computer manufacturers to save some money on hardware costs. The Raspberry Pi is perhaps the most well-known example of a low-cost computer without the extra expense of a real-time clock (RTC). While the Pi sets up NTP essentially automatically, other microcontrollers like the ESP32 don’t, but it is possible to configure them to use this time standard with some work.

For this project the MicroPython implementation for the ESP32 is required. MicroPython is a way of running Python code on microcontrollers or other embedded systems without all of the overhead that Python would normally require. Luckily enough, the NTP libraries are built right in so once MicroPython is running on the ESP32 it’s nearly as easy as calling the library. Of course you will have to make sure there is an internet connection, and then grab the time, sync it to the machine, and then set the timezone.

For a bonus exercise, the project’s creator [Bhavesh] suggests attempting to configure Daylight Savings Time, although this can be a surprisingly difficult problem to solve. In the meantime, there are a few other ways of installing a clock on a microcontroller like this one. An RTC module is an obvious choice, but you can also get incredibly accurate time by using a GPS module as well.

Network Time Clock For A Home Media Center

[Derek] wanted a clock for his media center. A simple wish, but he had a few requirements: he didn’t need an alarm, wanted it to automatically set its time after a power outage, needed a big display, and also wanted it to look good. After shopping around [Derek] couldn’t find a clock that would fit his requirements so he decided to build one.

[Derek]’s project is called the SNTP clock. As you might expect, it gets its name from the protocol used to automatically synchronize the clock in your computer with other network time servers. The clock itself is built around an ATMega168 gathering time data from the Internet with the help of a Lantronics XPort. One inch seven segment LEDs serve as the display for the clock, and everything, from the time offset from UTC, the brightness of the display, and whether the clock displays 12 or 24-hour time is controlled by an infrared Apple remote.

A bare PCB or bundle of wires would look out of place in [Derek]’s media shelf, so he used a metal picture frame and smoked acrylic to dress up his clock. Now he’s got a beautiful and elegant clock that fits right in to his media servers and receiver.