Overview

The PCF8563 is a low-power CMOS real-time clock (RTC) and calendar IC manufactured by NXP Semiconductors. Paired with a 32.768 kHz32.768\text{ kHz} quartz tuning-fork crystal and a 3V coin cell backup battery (CR1220 / CR2032), it maintains timekeeping even when main system power is completely disconnected.

Operating down to 1.0V1.0\text{V} DC with a backup supply current of just 0.25 μA0.25\ \mu\text{A}, the PCF8563 provides full BCD-formatted time registers (seconds, minutes, hours, date, day-of-week, month, century, and year) over an I2CI^2C interface (0x51). It features a programmable countdown timer, alarm interrupt output (INT), and a programmable square-wave clock output (CLKOUT).

Quick reference

Operating voltage (VDD)1.8 V to 5.5 V DC (1.0 V to 5.5 V timekeeping backup)
InterfaceI2CI^2C Fast-Mode (up to 400 kHz)
Fixed I2CI^2C address0x51
Crystal frequency32.768 kHz32.768\text{ kHz} (CL=12.5 pFC_L = 12.5\text{ pF})
Backup power draw0.25 μA0.25\ \mu\text{A} typical at VDD=3.0VVDD = 3.0\text{V}
Timekeeping fieldsSeconds, Minutes, Hours, Days, Weekdays, Months, Century, Years
Clock Output (CLKOUT)Programmable 32.768 kHz,1.024 kHz,32 Hz32.768\text{ kHz}, 1.024\text{ kHz}, 32\text{ Hz}, or 1 Hz1\text{ Hz} output
Interrupt Output (INT)Active-Low open-drain output (Alarm trigger / Countdown timer)

Pinout (8-Pin SOIC & Module Header)

text
             ┌───┴───┐
         OSCI ─┤ 1   8├─ VDD
        OSCO ─┤ 2    7├─ CLKOUT
         INT ─┤ 3    6├─ SCL
         VSS ─┤ 4    5├─ SDA
             └───────┘
PinNameTypeDescription
1OSCIAnalog Input32.768 kHz32.768\text{ kHz} crystal oscillator input
2OSCOAnalog Output32.768 kHz32.768\text{ kHz} crystal oscillator output
3INTDigital OutputActive-Low open-drain interrupt output pin
4VSSPowerGround reference (0 V)
5SDADigital Input / OutputI2CI^2C Serial Data
6SCLDigital InputI2CI^2C Serial Clock
7CLKOUTDigital OutputSquare-wave clock output pin (Open-drain)
8VDDPowerSupply power input (+1.8 V to +5.5 V DC)

Specifications

ParameterSymbolMinTypMaxUnitConditions
Supply Voltage (Operating)VDDV_{DD}1.83.35.5VI2CI^2C bus operation
Timekeeping VoltageVclockV_{clock}1.05.5VCrystal oscillator running
Backup CurrentIDD_bkpI_{DD\_bkp}0.250.8µAVDD=3.0V,I2CV_{DD} = 3.0\text{V}, I^2C inactive
Low Voltage Detect LimitVLOWV_{LOW}1.01.3VIntegrity flag set if VDD<VLOWV_{DD} < V_{LOW}
I2CI^2C Bus FrequencyfSCLf_{SCL}0400kHzFast-mode

I2CI^2C Register Map & BCD Format

Time registers are stored in Binary-Coded Decimal (BCD):

AddressRegister NameBit RangeFormat / Range
0x02VL_SecondsBit 6–000–59 BCD (Bit 7 = VL Voltage Low integrity flag)
0x03MinutesBit 6–000–59 BCD
0x04HoursBit 5–000–23 BCD
0x05DaysBit 5–001–31 BCD
0x06WeekdaysBit 2–00–6 (Sunday = 0)
0x07Century_MonthsBit 4–001–12 BCD (Bit 7 = Century Bit)
0x08YearsBit 7–000–99 BCD

DecToBcd(val)=(val104)(val%10)\text{DecToBcd}(val) = \left( \frac{val}{10} \ll 4 \right) | (val \% 10)

BcdToDec(val)=((val4)×10)+(val&0x0F)\text{BcdToDec}(val) = \left( (val \gg 4) \times 10 \right) + (val \& 0x0F)

Wiring

PCF8563 Module PinArduino / MCUESP32Notes
VCC5V / 3.3V3.3VPower rail
GNDGNDGNDSystem ground
SCLA5GPIO 22I2CI^2C Clock
SDAA4GPIO 21I2CI^2C Data

Example (Arduino RTClib / PCF8563 Library)

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

RTC_PCF8563 rtc;

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

  if (!rtc.begin()) {
    Serial.println("Couldn't find PCF8563 RTC!");
    while (1);
  }

  if (rtc.lostPower()) {
    Serial.println("PCF8563 lost power, setting time to compile time!");
    rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
  }
}

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

  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();

  delay(1000);
}

Common mistakes

  • Ignoring the VL (Voltage Low) flag: Bit 7 of the seconds register (0x02) is the VL flag. If the backup battery voltage drops below 1.0V1.0\text{V}, VL sets to 1, indicating that internal time data is corrupted and must be re-synchronized via NTP/GPS.
  • Forgetting pull-up resistors on INT / CLKOUT: INT and CLKOUT are open-drain outputs and require external 10 kΩ10\text{ k}\Omega pull-up resistors to VDDV_{DD}.

Notes

  • PCF8563 vs DS1307 vs DS3231: PCF8563 operates down to 1.0V with 0.25 μA0.25\ \mu\text{A} backup current; DS1307 requires 4.5V main supply; DS3231 includes an internal TCXO crystal for ±2 ppm\pm 2\text{ ppm} temperature compensation.

Assets & downloads