Electronics

Real Time Clock RTC Module PCF8563T

AED 12.60

1

Description

The PCF8563 is a CMOS Real-Time Clock (RTC) and calendar optimized for low power consumption. It features a programmable clock output, an interrupt output, and a voltage-low detector. This RTC communicates via a two-line bidirectional I²C bus with a maximum speed of 400 kbit/s. The PCF8563 is powered by a CR1220 coin battery (not included) and provides accurate timekeeping with a 32.768 kHz quartz crystal.

 

Features

  • Low Power Consumption: Optimized for minimal power use, suitable for battery-operated devices.
  • Accurate Timekeeping: Provides year, month, day, weekday, hours, minutes, and seconds.
  • I²C Communication: Uses a two-line bidirectional I²C bus for data transfer, with a maximum speed of 400 kbit/s.
  • Programmable Outputs: Includes a programmable clock output and interrupt output.
  • Voltage-Low Detector: Monitors voltage levels to ensure reliable operation.
  • Compact Design: Integrated oscillator capacitor and internal Power-On Reset (POR).

 

Specifications

  • Battery Model: CR1220 3V (Not Included)
  • Clock Operating Voltage: 1.0 V to 5.5 V at room temperature
  • Backup Current: Typical 0.25 µA at VDD = 3.0 V and Tamb = 25°C
  • I²C Bus Interface: 400 kHz two-wire interface (at VDD = 1.8 V to 5.5 V)
  • Programmable Clock Output: 32.768 kHz, 1.024 kHz, 32 Hz, and 1 Hz
  • Alarm and Timer Functions: Built-in for versatile applications
  • Internal Power-On Reset (POR)
  • I²C Bus Slave Address: Read A3h and write A2h
  • Interrupt Pin: Open-drain

 

 Resources:

Datasheet.

 

Arduino Code for PCF8563 RTC module (No Need For Library):

#include "Wire.h"

#define PCF8563address 0x51

byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;
String days[] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };

byte bcdToDec(byte value)
{
return ((value / 16) * 10 + value % 16);
}

byte decToBcd(byte value){
return (value / 10 * 16 + value % 10);
}

void setPCF8563()
// this sets the time and date to the PCF8563
{
Wire.beginTransmission(PCF8563address);
Wire.write(0x02);
Wire.write(decToBcd(second)); 
Wire.write(decToBcd(minute));
Wire.write(decToBcd(hour)); 
Wire.write(decToBcd(dayOfMonth));
Wire.write(decToBcd(dayOfWeek)); 
Wire.write(decToBcd(month));
Wire.write(decToBcd(year));
Wire.endTransmission();
}

void readPCF8563()
// this gets the time and date from the PCF8563
{
Wire.beginTransmission(PCF8563address);
Wire.write(0x02);
Wire.endTransmission();
Wire.requestFrom(PCF8563address, 7);
second = bcdToDec(Wire.read() & B01111111); // remove VL error bit
minute = bcdToDec(Wire.read() & B01111111); // remove unwanted bits from MSB
hour = bcdToDec(Wire.read() & B00111111); 
dayOfMonth = bcdToDec(Wire.read() & B00111111);
dayOfWeek = bcdToDec(Wire.read() & B00000111); 
month = bcdToDec(Wire.read() & B00011111); // remove century bit, 1999 is over
year = bcdToDec(Wire.read());
}

void setup()
{
Wire.begin();
Serial.begin(9600);
// change the following to set your initial time
second = 0;
minute = 28;
hour = 9;
dayOfWeek = 2;
dayOfMonth = 13;
month = 8;
year = 13;
// comment out the next line and upload again to set and keep the time from resetting every reset
setPCF8563();
}

void loop()
{
readPCF8563();
Serial.print(days[dayOfWeek]); 
Serial.print(" "); 
Serial.print(dayOfMonth, DEC);
Serial.print("/");
Serial.print(month, DEC);
Serial.print("/20");
Serial.print(year, DEC);
Serial.print(" - ");
Serial.print(hour, DEC);
Serial.print(":");
if (minute < 10)
{
Serial.print("0");
}
Serial.print(minute, DEC);
Serial.print(":"); 
if (second < 10)
{
Serial.print("0");

Serial.println(second, DEC); 
delay(1000);
}

Package Includes

  • 1 x PCF8563 CMOS Real-Time Clock (RTC) module (CR1220 coin battery not included)