DS3231 Real Time Clock~
This feature is not included in precompiled binaries
To use it you must compile your build. Add the following to
#ifndef USE_DS3231 #define USE_DS3231 // DS3231 external RTC (+1k2 code) // #define USE_RTC_ADDR 0x68 // Default I2C address 0x68 #endif
#define USE_RTC_ADDR 0x68
Tasmota requires that its time be set in order to use timers. Usually, when the device boots, it gets the time and date from an an NTP (Network Time Protocol) server located somewhere on the Internet. When there is no Internet connection, Tasmota is not able to request the current date and time. The DS3231 is an external Real Time Clock (RTC) component used for keeping the time and date set in the device when it cannot establish an Internet connection.
Time command is available to manually set date and time for the real time clock. The DS3231 will evaluate this time and sync to it if date is later than Jan 1, 2016. Note that the
Time command will disable NTP sync, and the real time clock will drift based on the accuracy of the DS3231 module.
The DS3231 driver includes a simple NTP server based on the code used for the GPS driver. It will respond to NTP requests on the standard port 123 as a stratum 1 server. This is useful as a backup time source for network devices if internet access is unavailable. NTP server can be activated with the command
Sensor33 1 and deactivated with
In the Configuration -> Configure Module page assign:
- GPIOx to
I2C SDA (6)
- GPIOy to
I2C SCL (5)
Wiring on Wemos D1 mini
Any time your device has an NTP connection, the DS3231 internal clock will be set automatically. The first time RTC is used, you must have an Internet connection. From that point forward, the time is stored in the RTC and the device time will be restored from the RTC when there is no Internet connection.
(You can use your mobile phone hotspot for your device in a location where it can't get a Wi-Fi connection
Check that the time is set correctly by inspecting the log in the Console. You should see messages that Tasmota read or wrote the time from and to the DS3231. Make sure that the time is set correctly even when you do not have Internet connection.