HowTo: ESPEasy – Activate NTP time retrieval from the Internet

Thanks to WiFi and thus (often) an internet connection, an ESP8266 or ESP32 programmed with ESPEasy also has the option to retrieve the actual time.

In order for this to work, the retrieval of the time via an NTP server must first be activated in ESPEasy and a correct server configured.

What you have to do so that ESPEasy automatically obtains the current time from an NTP time server is described in the following article.


Safety instructions

I know the following hints are always a bit annoying and seem unnecessary. But unfortunately, many people who knew it "better" from carelessness lost their eyes, fingers or other things or hurt themselves. In comparison, a loss of data is almost not worth mentioning, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Even the coolest project is worth no injury or other annoyance. https://www.nerdiy.de/en/sicherheitshinweise/

Affiliate links / advertising links

The links to online shops listed here are so-called affiliate links. If you click on such an affiliate link and shop via this link, Nerdiy.de receives a commission from the online shop or provider concerned. The price doesn't change for you. If you do your purchases via these links, you will support Nerdiy.de in being able to offer further useful projects in the future. 🙂


Requirements

Helpful Articles:
You can find additional tips on ESPEasy in the following articles.

Required tools:
– none –

Required material:


Find a proper NTP-Server address

There are numerous time servers on the Internet through which you can obtain the time free of charge. You can find a quite extensive list, for example, at https://www.ntp-server.de/ntp-server-deutschland/

It is advisable to choose NTP servers that are not far away if possible. That’s why I would recommend choosing a time server from a German provider. (If you are living in germany of course) In the following you will find, for example, a list of the time servers offered by the PTB (Physikalisch-Technische Bundesanstalt).

Deutsche NTP Server der PTB (Physikalisch-technische Bundesanstalt)

PTB Zeitserver 1: ptbtime1.ptb.de
PTB Zeitserver 2: ptbtime2.ptb.de
PTB Zeitserver 3: ptbtime3.ptb.de

https://www.ntp-server.de/ntp-server-deutschland/

Another good source for international NTP-Server is available here: https://www.pool.ntp.org/zone

As an alternative, you can also use an even more “local” NTP server. For example, many home routers offer the same option. So instead of using an external time server, you simply use your router as a time server.

Tips on how to configure your FritzBox accordingly can also be found under the following link: https://avm.de/service/wissensdatenbank/dok/FRITZ-Box-7590/336_Zeitsynchronisation-NTP-fur-FRITZ-Box-und-Netzwerkgerate-einrichten/


Configure the time server in ESPEasy

As soon as you have found a time server that you want to use as a source for the time, you only have to enter it in your ESPEasy configuration.

To do this, switch to the web interface of your ESPEasy device. To do this, enter the IP address of the device in the address line of your browser.

How to find out the IP address of devices in your network is also described in the article Displaying / Finding out the IP address of the devices in the network.

Then switch to the “Tools” area

In the “Tools” area you now have to click on the “Advanced” button.

There you have the possibility to configure the NTP time server in the section “NTP Settings”.

To do this, tick the checkbox for “Use NTP” and enter the desired time server for “NTP host name”.

If you prefer to use your router or your FritzBox, as in this example, as a time server, you can now enter the address for your router or the FritzBox. In the case of the FritzBox this is

fritz.box

As soon as you have entered the settings you still have to save the settings.

Scroll to the bottom of the configuration page and confirm the settings by clicking on “Submit”.

If you now switch back to the “Main” page, you should see the current date and time displayed in the overview in the “Local Time” section.


Set time zone

After you have set the correct time server, you may have to configure the appropriate time zone. To do this, switch back to the same page on which you previously configured the NTP data. So Tools-> Advanced.

There you have the option of making the necessary settings in the “DST Settings” section. In addition to the exact dates when you want to switch from winter to summer time, you can also specify under “Timezone Offset (UTC +)” which time zone you are in.

Enter the deviation from your time zone (in minutes) and activate the checkbox in the “DST” section.

As soon as you have configured everything, you have to save the data again by clicking on the “Submit” button.


Why all this?

A typical application in which you are dependent on the correct time is if you have set up a pxlBlck, for example. This can (if you wish) also show the current time on its LED display. You can find information about this in the following articles.


I hope everything worked as described. If not or you have any other questions or suggestions, please let me know in the comments. Also, ideas for new projects are always welcome. 🙂

Fab

P.S. Many of these projects - especially the hardware projects - cost a lot of time and money. Of course I do this because I enjoy it, but if you appreciate it that I share these information with you, I would be happy about a small donation to the coffee box. 🙂

Buy Me a Coffee at ko-fi.com

Leave a Reply

Your email address will not be published. Required fields are marked *