Getting Time From NTP Server Made Easy


ashwiniEvery once in a while, you’ll come across an idea where saving time is a primary concern. For example, consider a relay that needs to be activated at a certain time, or a data logger that needs to store values ​​at precise intervals.

The first thing that comes to mind is the use of a real-time clock (RTC) chip. But since these chips are not accurate, we have to keep making manual adjustments to keep them in sync.

The solution here is to use the network time protocol (NTP). The ESP8266 NodeMCU has internet access, so you can get the day of the week and accurate time within a few milliseconds of Coordinated Universal Time (UTC) for free! And you don’t need any additional hardware circuitry.

fig.  1: NTP communication format structure
fig 1 NTP communication format structure

Download the source code

This project will be published in a few weeks. If you want to access it now, check out Electronics For You’s December 2022 Issue–print or ezine edition.


Source link


Leave a Comment

Your email address will not be published.