Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

How to Use Adafruit PCF8523 RTC: Examples, Pinouts, and Specs

Image of Adafruit PCF8523 RTCDesign with Adafruit PCF8523 RTC in Cirkit Designer

Introduction

The Adafruit PCF8523 RTC is a Real Time Clock (RTC) module that offers precise timekeeping capabilities. It is designed to maintain accurate time with the help of a built-in crystal oscillator and can continue to keep time with a backup battery even when the main power supply is disconnected. This component is ideal for a variety of applications, including data loggers, alarm systems, and other time-sensitive projects.

Common applications and use cases:

Explore Projects Built with Adafruit PCF8523 RTC

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of Dual RTC DS3231 Synchronization with Glyph C3 Microcontroller: A project utilizing Adafruit PCF8523 RTC in a practical application
Dual RTC DS3231 Synchronization with Glyph C3 Microcontroller

This circuit integrates two RTC DS3231 real-time clock modules with a Glyph C3 microcontroller. The RTC modules are connected to the microcontroller via I2C communication protocol, using the SCL and SDA lines for clock and data respectively. Both RTC modules and the microcontroller share a common power supply (3V3) and ground (GND), indicating that they operate at the same voltage level.

Open Project in Cirkit Designer
Image of Arduino UNO with DS1307 RTC Controlled LED Lighting System: A project utilizing Adafruit PCF8523 RTC in a practical application
Arduino UNO with DS1307 RTC Controlled LED Lighting System

This circuit features an Arduino UNO connected to a DS1307 Real Time Clock (RTC) module for timekeeping and a red LED with a series resistor for indication purposes. The Arduino communicates with the RTC via I2C (using A4 and A5 pins for SDA and SCL, respectively), and controls the LED connected to digital pin D8 through a 330-ohm resistor. The embedded code sets the RTC time, checks the current time, and turns the LED on or off based on the specified time condition (between 11:00 AM and 11:43 AM).

Open Project in Cirkit Designer
Image of Arduino UNO with RTC DS3231 Timekeeping: A project utilizing Adafruit PCF8523 RTC in a practical application
Arduino UNO with RTC DS3231 Timekeeping

This circuit connects an Arduino UNO microcontroller with a DS3231 Real Time Clock (RTC) module. The Arduino provides 5V power and ground to the RTC and communicates with it via the I2C protocol using the A4 (SDA) and A5 (SCL) pins. The embedded code on the Arduino is used to initialize the RTC, check for power loss, set the current time if needed, and periodically read and print the current time to the serial monitor.

Open Project in Cirkit Designer

Technical Specifications

Key Technical Details

Pin Configuration and Descriptions

Pin Number Name Description
1 VCC Power supply (1.8V to 5.5V)
2 GND Ground connection
3 SDA I2C Data Line
4 SCL I2C Clock Line
5 INT Interrupt output (active low)
6 CLKOUT Clock output for peripheral devices

Usage Instructions

How to Use the Component in a Circuit

  1. Power Connections: Connect the VCC pin to a 1.8V to 5.5V power supply and the GND pin to the ground.
  2. I2C Connections: Connect the SDA and SCL pins to the I2C data and clock lines, respectively.
  3. Backup Battery: Insert a CR1220 coin cell into the battery holder to enable timekeeping during power loss.
  4. Arduino Connection: For use with an Arduino UNO, connect SDA to A4, SCL to A5, VCC to 5V, and GND to ground.

Important Considerations and Best Practices

Example Code for Arduino UNO

#include <Wire.h>
#include "RTClib.h"

RTC_PCF8523 rtc;

void setup() {
  Wire.begin();
  Serial.begin(9600);

  // Check if the RTC is connected correctly
  if (!rtc.begin()) {
    Serial.println("Couldn't find RTC");
    while (1);
  }

  // Check if the RTC has lost power and if so, set the time
  if (!rtc.initialized() || rtc.lostPower()) {
    Serial.println("RTC is NOT initialized, let's set the time!");
    // This line sets the RTC to the date & time this sketch was compiled
    rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
  }
}

void loop() {
  DateTime now = rtc.now();

  // Print the current date and time
  Serial.print(now.year(), DEC);
  Serial.print('/');
  Serial.print(now.month(), DEC);
  Serial.print('/');
  Serial.print(now.day(), DEC);
  Serial.print(" ");
  Serial.print(now.hour(), DEC);
  Serial.print(':');
  Serial.print(now.minute(), DEC);
  Serial.print(':');
  Serial.print(now.second(), DEC);
  Serial.println();

  // Wait for a second
  delay(1000);
}

Troubleshooting and FAQs

Common Issues

Solutions and Tips for Troubleshooting

FAQs

Q: Can the PCF8523 RTC module be used with a 3.3V system? A: Yes, the module can operate from 1.8V to 5.5V, making it suitable for both 3.3V and 5V systems.

Q: How long will the backup battery last? A: The battery life depends on the quality of the battery and the environmental conditions but typically lasts for a few years.

Q: Is it necessary to use an external crystal with the PCF8523 RTC? A: No, the PCF8523 has an integrated crystal oscillator that provides accurate timekeeping.