PCF8563 RTC Board
| ||
Overview
The PCF8563 RTC Board is CMOS real-time clock/calendar optimized for low power consumption. Programmable clock outputs interrupt outputs, and voltage low detectors are also provided.
All addresses and data are transferred serially via a two-line bi-directional I2C bus. The maximum bus speed is 400 kbit/s. The built-in word
address register is automatically incremented after each data byte is written or read.
Specifications
- Chip: PCF8563
- Working voltage: 3.3V/5V
- Max clock frequency: 400KHz
- Interface: I2C
Pinouts
PIN | Description |
VCC | 3.3V/5V |
GND | Ground |
SDA | I2C Data input |
SCL | I2C Clock pin |
Raspberry Pi
Enable I2C Interface
Open a terminal and run the following commands:
sudo raspi-config Choose Interfacing Options -> I2C -> Yes.
Reboot Raspberry Pi:
sudo reboot
Install Library
If you use bookworm system, only the lgpio library is available, bcm2835 and wiringPi libarary cannot be installed or used. Please note that the python library does not need to install, you can directly run the demo.
BCM2835
#Open the Raspberry Pi terminal and run the following command wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.71.tar.gz tar zxvf bcm2835-1.71.tar.gz cd bcm2835-1.71/ sudo ./configure && sudo make && sudo make check && sudo make install # For more, you can refer to the official website at: http://www.airspayce.com/mikem/bcm2835/
WiringPi
#Open the Raspberry Pi terminal and run the following command cd sudo apt-get install wiringpi #For Raspberry Pi systems after May 2019 (earlier than that can be executed without), an upgrade may be required: wget https://project-downloads.drogon.net/wiringpi-latest.deb sudo dpkg -i wiringpi-latest.deb gpio -v # Run gpio -v and version 2.52 will appear, if it doesn't it means there was an installation error # Bullseye branch system using the following command: git clone https://github.com/WiringPi/WiringPi cd WiringPi . /build gpio -v # Run gpio -v and version 2.70 will appear, if it doesn't it means there was an installation error
lgpio
#Open the Raspberry Pi terminal and run the following command wget https://github.com/joan2937/lg/archive/master.zip unzip master.zip cd lg-master sudo make install #Raspberry Pi 5 sudo apt install python3-rpi-lgpio #For more details, you can refer to https://github.com/gpiozero/lg
Python
#python3 sudo apt-get update sudo apt-get install python3-pip sudo apt-get install python3-pil sudo apt-get install python3-numpy sudo apt-get install python3-smbus sudo pip3 install RPi.GPIO
Download examples
Open a terminal of the Raspberry Pi
sudo apt-get install p7zip-full -y sudo wget https://files.waveshare.com/upload/a/a8/PCF8563-Code.7z 7z x PCF8563-Code.7z -O./PCF8563-Code cd PCF8563-Code/RaspberryPi/
Hardware connection
PCF8563 | Raspberry Pi | Description |
Board order | ||
VCC | 5V | Power input |
GND | GND | Power ground |
SDA | 3 | I2C data input |
SCL | 5 | I2C clock pin |
Run examples
The following commands should be executed under RaspberryPi, otherwise, they are not in the index directory.
C examples
- Recompile and it may take a few seconds:
cd c sudo make clean sudo make sudo ./main
Python example
cd python/examples sudo python main.py
Expected result
The time of RTC is printed.
The STM32 examples are based on the STM32F103RBT6 and the STM32H743. The connection provided below is based on the STM32F103RB. If you need to use other STM32 boards, you may need to change the hardware connection and port the code yourself.
STM32
We provide the demo based on STM32F103RBT6, the connection provided is the corresponding STM32F103RBT6 pins for example, if there is a need to use other STM32, please connect according to the actual pins.
Hardware connection
PCF8563 | STM32 | Description |
---|---|---|
VCC | 3.3V | Power input |
GMD | GND | Power ground |
SDA | PB9 | I2C data input |
SCL | PB8 | I2C clock pin |
Examples
The examples are developed based on the HAL libraries. Download the Demo codes archive to your PC. Unzip and find the STM32 project from PCF8563-Code\STM32\STM32F103RB\MDK-ARM.
- Open the PCF8563 RTC Board.uvprojx file by Keil.
- Build and the project.
- Program the project to your STM32 board.
- Connect the UART1 of your STM32 board to the PC and check the serial data with SSCOM software.
The Arduino example is written for the Arduino UNO. If you want to connect it to other Arduino boards, you may need to change the connection.
Arduino
Hardware connection
PCF8563 | Arduino | Description |
---|---|---|
VCC | 5V | Power input |
GMD | GND | Power ground |
SDA | SDA | I2C data input |
SCL | SCL | SCL clock pin |
Examples
- Download the demo codes to your PC and unzip them.
- Install the Arduino IDE on your PC.
- Go into PCF8563-Code/Arduino/PCF8563.
- Run the PCF8563.ino file.
- Select the correct Board and the Port.
- Create a project and upload it to the board.
- Open the serial monitor of the Arduino IDE or the SSCOM software and check the serial data.
Effect
Open the serial debugging software and output the year, month, day, hour, minute, and second on the serial port.
Resources
FAQ
{{{5}}}
{{{5}}}
{{{5}}}
Support
Technical Support
If you need technical support or have any feedback/review, please click the Submit Now button to submit a ticket, Our support team will check and reply to you within 1 to 2 working days. Please be patient as we make every effort to help you to resolve the issue.
Working Time: 9 AM - 6 PM GMT+8 (Monday to Friday)