Tested and works on esp8266/esp32
DS3231 is a low-cost, extremely accurate I2C real-time clock (RTC), with an integrated temperature-compensated crystal oscillator (TCXO) and crystal. The device incorporates a battery input, disconnect the main power supply and maintains accurate timekeeping. Integrated oscillator improve long-term accuracy of the device and reduces the number of components of the production line. RTC maintains seconds, minutes, hours, day, date, month, and year information. Less than 31 days of the month, the end date will be automatically adjusted, including corrections for leap year. The clock operates in either the 24 hours or band / AM / PM indication of the 12-hour format. Provides two configurable alarm clock and a calendar can be set to a square wave output. Address and data are transferred serially through an I2C bidirectional bus.See product page link for more information about the hardware.
mos.yml, add:
config_schema:
- ["i2c.enable", true]
libs:
- origin: https://github.com/mongoose-os-libs/arduino-ds3231
init.js, add:
load('api_ds3231.js');
#include "mgos_arduino_DS3231.h"