Skip to content
Get started

DS3231 Real-Time Clock

The ds3231 component provides support for the Maxim/Analog Devices DS3231 real-time clock (RTC). The DS3231 is a temperature-compensated RTC accurate to a few parts per million, and is found on inexpensive breakout boards such as the ZS-042.

DS3231 RTC breakout board

This component is an I²C hub. It talks to the chip, and the on-die temperature is read with the sensor platform. It does not yet provide a time platform, alarms or the square-wave and 32 kHz outputs.

The I²C bus must be set up first.

# Example configuration entry
ds3231:
id: ds3231_hub
  • id (Optional, ID): The ID to use for referencing this hub from the sensor platform and actions.
  • address (Optional, int): The I²C address of the chip. Defaults to 0x68.
  • i2c_id (Optional, ID): The ID of the I²C bus when using multiple buses.

The chip has a fixed address, so more than one DS3231 needs separate I²C buses (or separate channels of an I²C multiplexer); give each chip its own entry with a distinct id and i2c_id.

ds3231.force_temperature_conversion Action

Section titled “ds3231.force_temperature_conversion Action”

Trigger an immediate temperature conversion instead of waiting for the chip’s automatic 64-second cycle. The result is also used to re-tune the oscillator.

on_...:
- ds3231.force_temperature_conversion: ds3231_hub

Configuration variables:

  • id (Required, ID): The ID of the ds3231 hub.
  • On common breakout boards (ZS-042 and similar) a separate AT24C32 EEPROM is fitted at address 0x57. It is not used by this component but will show up in an I²C scan.