---
title: DS3231 Real Time Clock I2C Demo
description: "[![29127 DS3231 AT24C32 Real Time Clock Module](/qbi/DS3231 Real Time Clock I2C Demo - Parallax_files/29127b-300x300.jpg)](/qbi/DS3231 Real Time Clock I2C Demo - Parallax_files/29127b.jpg)[![](/qbi/DS3231 Real Time Clock I2C Demo - Parallax_files/DS3231-PST.png)](/qbi/DS3231 Real Time Clock I2C Demo - Parallax_files/DS3231-PST.png) ##### Description The DS3231 is…"
url: "https://obex.parallax.com/docs/quick-bytes/propeller-2/ds3231-real-time-clock-i2c-demo/"
updated: "2026-09-27"
category: Propeller 2
---

# DS3231 Real Time Clock I2C Demo

[![29127 DS3231 AT24C32 Real Time Clock Module](/qbi/DS3231 Real Time Clock I2C Demo - Parallax_files/29127b-300x300.jpg)](/qbi/DS3231 Real Time Clock I2C Demo - Parallax_files/29127b.jpg)[![](/qbi/DS3231 Real Time Clock I2C Demo - Parallax_files/DS3231-PST.png)](/qbi/DS3231 Real Time Clock I2C Demo - Parallax_files/DS3231-PST.png)

##### Description

The DS3231 is a low-cost, precision I2C real-time clock (RTC) with an integrated temperature-compensated crystal oscillator (TCXO) and crystal. The Parallax DS3231 AT24C32 Real Time Clock Module includes a battery backup, and maintains accurate timekeeping when power to the module is interrupted. 

This device was demonstrated extensively in the JonnyMac Beginner Series for Spin2 and the video is linked under additional resources.

To set the time and date, change the highlighted lines of code in jm_ds3231_demo.spin2 and load to Flash. 

```spin2
pub initialize_rtc()

'' Manually set RTC registers to current time and date

  rtc.set_time($30, $04, $15)                     ' 3:04:30 pm

  rtc.set_calendar($07, $23, $01, $21)            ' Saturday, 23 JAN 2021
```

##### Parts Used

- [P2 Edge Module](https://www.parallax.com/product/p2-edge-module/)
- [P2 Edge Breadboard](https://www.parallax.com/product/p2-edge-module-breadboard/)
- [DS3231 AT24C32 Real Time Clock Module (29127)](https://www.parallax.com/product/ds3231-at24c32-real-time-clock-module/)

##### Source Code

- [jm_ds3231_demo-Archive](/qbi/downloads/jm_ds3231_demo-Archive-Date-2022.05.22-Time-13.25.zip)

##### Programming Language

- [Spin 2 and in-line PASM](https://www.parallax.com/propeller-2/get-started/spin2/)

##### Tools and Operating System

- [Propeller Tool for Windows](https://www.parallax.com/propeller-2/programming-tools/)

##### Additional Resources

- [Propeller 2 Spin Documentation](https://docs.google.com/document/d/16qVkmA6Co5fUNKJHF6pBfGfDupuRwDtf-wyieh_fbqw/edit)
- [DS3231 Datasheet](https://www.parallax.com/package/ds3231-datasheet/)
- [Propeller 2 Live Forum: JonnyMac Beginner Series Part 3 (I2C and the DS3231 RTC)](https://youtu.be/fxNiDrmbx-s?t=6494)

##### Document Author

- Ken Gracey

##### Source Code Author

- Jon McPhalen
