The easiest way to use the DS3231M RTC Breakout Board is with our open source Arduino library. It is available for download onGithub.

PS: The library also supports the DS1307 chip. The DS1307 chip has the same functionality for setting and getting time as the DS3231M, but it does not have hardware alarms or alarm interrupt capability. Instead it has a small SRAM memory. The library fully supports both chips.

Connection

Four connections are required:

  • VCC
  • GND
  • SDA
  • SCL

The other three connections are optional:

  • 32kHz

Used for the 32kHz oscillator output of the real time clock. There is a pull-up resistor on the board for this function, so to use it simply connect a wire.

It is enabled in the Arduino library by calling Osc32kHzEnable(true).

  • INT/SQW (marked as INT on the board)

This connection has a dual function: It can either be configured as a 1Hz square wave output, or as an interrupt (that goes low when one of the set alarms go off).

A pull-up resistor is included, so this pin can be used by simply connecting a wire.

To Use the SQW function, call SQWEnable(true) to turn the output on.

PS: There is also a function SQWSetFreq in the library. Calling this function has no effect when using the DS3231M chip. (it can be used for DS3231 chips, that are available in a bigger SOIC-16 package).

  • RST

This is a reset pin for the clock. Normally, this can be left unused, but it is possible to attach a push button to allow you to reset the RTC chip.

Basic usage