In this project we will learn the Interfacing of PCF8563 Real Time Clock Module with Arduino. We will display the time and date value in 16×2 LCD Display.
Overview
There is so many Real Time Clock (RTC) Module available in the market like DS1307 & DS3231. But when it comes to power consumption, their power consumption is a little higher which can drain the battery quickly in case if we are going with battery-powered device applications. So a Real time clock module whose power consumption is extremely less is PCF8563 Module. This module is also an I2C module.
The PCF8563 is a CMOS Real-Time Clock (RTC) and calendar optimized for low power consumption. A programmable clock output, interrupt output, and a voltage-low detector is also provided. All addresses and data are transferred serially via a two-line bidirectional I²C-bus. The maximum bus speed is 400 kbit/s.
So now let’s learn the Interfacing of PCF8563 Real Time Clock Module with Arduino UNO and display the date and time value on 16×2 LCD Display.
You can also check some of the other RTC Module Projects here:
1. Arduino DS3231 Real Time Clock (RTC) with Temperature Monitor
2. Arduino DS3231 Real Time Clock with Alarm & Temperature
Bill of Materials
Following are the components required for this project. All the components can be easily purchased from Amazon. The components purchased link is given below:
S.N. | Components Name | Quantity | Purchase Links |
---|---|---|---|
1 | Arduino UNO Board | 1 | Amazon | AliExpress |
2 | 16x2 LCD Display | 1 | Amazon | AliExpress |
3 | RTC Module PCF8563 | 1 | Amazon | AliExpress |
4 | Potentiometer 10K | 1 | Amazon | AliExpress |
5 | Connecting Wires | 10 | Amazon | AliExpress |
6 | Breadboard | 1 | Amazon | AliExpress |
PCF8563 Real Time Clock Module
The real-time clock module is based on the NXP PCF8563T a programmable, I2C communicating up to 400KHz / 400Kb/S, high precision real-time clock chipset.
It offers multiple functions such as external programmable clock output, alarm, timer, and the best backup battery. It is more steady and precise than DS1302 or DS1307. The PCF8563 RTC Board provides the real-time clock/calendar function, which can be driven by a battery on board and works independently even when the microcontroller is turned off. It is a low-cost, extremely accurate I2C real-time clock (RTC) module.
Check the PCF8563 Datasheet for more details.
PCF8563 Features
1. Provides year, month, day, weekday, hours, minutes, and seconds based on a 32.768 kHz quartz crystal
2. Century flag
3. Clock operating voltage: 1.0 V to 5.5 V at room temperature
4. Low backup current; typical 0.25A at VDD = 3.0 V and Temp = 25C
5. 400 kHz two-wire I2C-bus interface (at VDD = 1.8 V to 5.5 V)
6. Programmable clock output for peripheral devices (32.768 kHz, 1.024 kHz, 32 Hz, and 1 Hz)
7. Alarm and timer functions
8. Integrated oscillator capacitor
9. Internal Power-On Reset (POR)
10. I2C-bus slave address: read A3h and write A2h
11. Open-drain interrupt pin
PCF8563 Pinout
PCF8563 Real Time Clock Module is an I2C module, i.e it works on 2 wire protocol. It has SDA & SCL Pins that can be easily interfaced with any microcontroller. It has read I2C address of A3h and write I2C Address as A2h.
It has 4 pins:
PIN 1. VCC — 1V to 5.5V
PIN 2. GND — GND
PIN 3. SDA — Serial Data
PIN 4. SCL — Serial Clock
Interfacing PCF8563 Real Time Clock Module with Arduino
Here is a circuit for interfacing PCF8563 Real Time Clock Module with Arduino UNO. I assembled the circuit on breadboard.
Connect the SDA & SCL pin of PCF8563 to Arduino A4 & A5 pins. Connect its VCC to 5V or 3.3V & GND to GND. Similarly connect the pin 1, 5, 16 of LCD to GND & 2, 15 to VCC. Connect 10K Potentiometer at pin 3 of LCD to adjust the contrast. The LCD pins 4, 6, 11, 12, 13, 14 should be connected to Arduino digital pins 12, 11, 5, 4, 3, 2.
Source Code/Program
Here is a source code for Interfacing PCF8563 Real Time Clock Module with Arduino and obtaining time and date. But before that you need to install a library for it. Download the library from the following link.
Now copy the code from below and upload it to the Arduino Board. Make sure to change the date and time in the code to match the current time/date.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
#include <Wire.h> #include <Rtc_Pcf8563.h> #include <LiquidCrystal.h> //init the real-time clock Rtc_Pcf8563 rtc; LiquidCrystal lcd(12 ,11 ,5 ,4 ,3 ,2); void setup() { // set up the LCD's number of rows and columns: lcd.begin(16, 2); lcd.setCursor(4, 0); lcd.print("PCF8563"); lcd.setCursor(0, 1); lcd.print("Real Time Clock"); delay(4000); lcd.clear(); //clear out all the registers rtc.initClock(); //set a time to start with. //day, weekday, month, century, year rtc.setDate(20, 3, 1, 20, 20); //hr, min, sec rtc.setTime(16, 38, 48); } void loop() { lcd.setCursor(0, 0); lcd.print("Time:"); lcd.setCursor(6, 0); //lcd.print(rtc.formatTime(RTCC_TIME_HM)); lcd.print(rtc.formatTime()); lcd.setCursor(0, 1); lcd.print("Date:"); lcd.setCursor(6, 1); //lcd.print(rtc.formatDate(RTCC_DATE_ASIA)); lcd.print(rtc.formatDate()); // delay(1000); } |
Results
Once the code is uploaded, the LCD will start displaying the current time and date with time elapse.
1 Comment
It’s always great to read such detailed blog posts like this! I like this article very much. If any of the engineering students are looking for arduino projects for engineering students