HowTo: ESPEasy - Set time synchronization with the DS3231 / DS3232 RTC

Thanks to NTP server ESPEasy is able to retrieve the time via WiFi connection. This possibility is very easy to set up and is described here, for example: ESPEasy - Enable NTP time retrieval from the Internet

But what if no NTP server is available for time retrieval?

In this case, you can use an RTC (=Real Time Clock). This is an IC that "keeps" the set time with a battery backup. The time is therefore stored once in this IC and, thanks to the backup battery, continues to be counted even after a power failure (or switching on and off).

After restarting the actual controller (in this case the ESP32 or ESP8266), it can retrieve the time from the RTC IC and thus knows the current time again.

A "famous" IC that offers this functionality is the DS3231 respectively DS3232. Thanks to the plugin described below, its functionality can be integrated into ESPEasy relatively easily. Everything you need to know is described in the following article.


Safety instructions

I know the following notes are always kind of annoying and seem unnecessary. Unfortunately, many people who knew "better" have lost eyes, fingers or other things due to carelessness or injured themselves. Data loss is almost negligible in comparison, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Because even the coolest project is not worth injury or other trouble.
https://www.nerdiy.de/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 make a purchase via this link, Nerdiy.de will receive a commission from the relevant online shop or provider. The price does not change for you. If you make your purchases via these links, you support Nerdiy.de in being able to offer other useful projects in the future. 🙂 


Requirements

Helpful articles:
Additional tips on ESPEasy can be found in the following articles.

Required tool:
- none

Required material:

In the following list you will find all the parts you need to implement this article.

NumberLink
1x Wemos D1 Mini  Buy at Amazon
1xDS3231 Real Time Clock  Buy at Amazon
1xUSB power supply 5V/3.4A  Buy at Amazon
1xManagement  Buy at Amazon
1x Pegboard  Buy at Amazon

Connecting the DS3232 or DS3231 to the ESP8266

The DS3232 or DS3231 is connected to the ESP8266 or Wemos D1 Mini via the I2C bus.

If the I2C bus is configured by default, you can use the shown schematic as orientation.


Configuration of the DS3232 or DS3231 in ESPEasy

To configure the DS3232 or DS3231 in ESPEasy, the ESPEasy firmware should already be installed on the ESP8266 or ESP32 and accessible. Information about this can be found in the article ESPEasy - Compile firmware, flash and configure WLAN access data.

First open the configuration website of your ESP8266 programmed with ESPEasy by entering its IP address into your web browser. Information on how to find out the IP address can also be found in the article Display/find out the IP address of the devices in the network summarized.

As soon as you have opened the configuration website, you must switch to the "Devices" tab. To do this, click on the "Devices" button.

In the "Devices" tab, click on the "Add" button in one of the empty rows.

You will then be automatically redirected to the featured view and...

...can select here which device you want to create.

Selects here the entry

  • TIME-DS323X

off.

If the entry you are looking for is not visible, the plugin is not included in your ESPEasy installation. A precompiled binary which also contains this plugin can be found at the following link.

This will redirect you back to an overview page.

Here you can set all settings regarding the DS3231 or DS3232.

If you have used the circuit diagram shown above, you can use the settings shown.

Depending on the configuration, you may need to check the "Force Slow I2C Speed" box. Normally, however, this is not necessary.

You can activate automatic synchronization with an NTP server by ticking "Enable NTP sync at startup". This means that the RTC is automatically set to the current time, provided that access to the NTP server is configured correctly.

With the Data-Acquisition Interval you can set in which time interval the time in the RTC is read out and synchronized with the system time of the ESP32 or ESP8266.

Once you have configured everything correctly, click on "Submit" to accept the settings.

As an alternative to setting the time via the configured NTP server, you can also use the following commands to adjust the set time.

  • nrdy_rtc_incrhr - Increases the hour value of the stored time by one.
  • nrdy_rtc_decrhr- Decreases the hour value of the stored time by one.
  • nrdy_rtc_incrmnt - Increases the minute value of the stored time by one.
  • nrdy_rtc_decrmnt - Decreases the minute value of the stored time by one.


Other sensors and actuators for connection to the ESP8266 / ESP32

An overview of other articles for connecting sensors and actuators to ESPEasy can be found in the following category.


Have fun with the project

I hope everything worked as described for you. If not or you have questions or suggestions please let me know in the comments. I will then add this to the article if necessary.
Ideas for new projects are always welcome. 🙂

PS 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 think it's cool that I share the information with you, I would be happy about a small donation to the coffee fund. 🙂

Buy Me a Coffee at ko-fi.com       

Kommentar hinterlassen

Your email address will not be published. Erforderliche Felder sind mit * markiert

This site uses Akismet to reduce spam. Learn how your comment data is processed.