DS3231 External RTC - seurat-atreides/Sonoff-Tasmota GitHub Wiki

DS3231 - External RTC (I2C)

The DS3231 is external RTC that use for keeping the time and date set in the Wemos when we have no internet connection. Usually, when the Wemos reboot, its get the time and date from NTP (Network Time Protocol) server that locate somewhere in the internet, but when we want to use the Tasmota when we not have internet connection, this stopping us from using timers. In this case connect DS3231 to your device.

How to use:

At the first time after reboot, you must to have internet connection (use your mobile phone or try in other location). Once you have ntp connection , the DS3231 internal clock will be updated automatically. you can now power off the device, from now and on the time is stored in the module and will be restored when there is no connection to NTP.

Note: before the DS3231 can be used with Tasmota, make sure it's enabled. To enable it, remove the forward slashes before this line before you compile and upload tasmota to your Wemos device.

#define USE_DS3231                          // Enable use DS3231 external RTC , usefall when you don't have avaliable WIFI. see docs in the source file (+1k2 code)

if you use DS3231 with other address:


//  #define USE_RTC_ADDR  0x68                  //you can change the addrsss to the DS3231 RTC address, default is 0x68, not mandatory field

Connecting the DS3231 to a Wemos Mini D1

Wemos DS3231
GND GND
3.3V VCC
D2 (gpio04) SDA
D1 (gpio05) SCL

Tasmota Configuration

In the Configuration -> Configure Module page, select the following:

  1. Module Type : 18 Generic
  2. D2 GPIO04 : 06 I2C SDA
  3. D1 GPIO05 : 05 I2C SCL

Testing

Make sure that the time is correct even when you not have internet connection. You also can see in the LOG that we read or write the time from and to the DS3231