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 applicat..
There is so many Real-Time Clock (RTC) Moduleavailable in the market likeDS1307&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 the PCF8563 Module. This module is also anI2C module.
ThePCF8563is aCMOS Real-Time Clock (RTC)andcalendaroptimized 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 is400 kbit/s.
The main performance index of PCF8563:
You can use the standby battery
This ultra-low power consumption: the typical value is 0.25uA
Wide voltage range of 1.0~5.5V.
It through the I2C bus serial input/output
This programmable clock output frequency: 32.768KHz
Clocks (RTC). This is the pure Python driver for the PCF8563 Real Time Clock. The original code is the DS1307 library from @XiErCh. The main changes involve removing the 12-hour mode, which didn’t work correctly in all cases and a different clock starting procedure. This library now only runs in 24-hour mode.
The PCF8563 library is on Click Here. The PCF8563is a 3.3V/5V device. You just connect it up to the Raspberry Pi I2C pins and you are ready to go. The board I used has a handy pass-thru of the I2C bus and some useful headers for INT, CLKOUT, etc. It does have 4.7K Pullups on the SCL / SDA pins.
To the right is a picture of the four RTC test jig.
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 the 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
Example Code for the PCF8563
There is a testSDL_PCF8563.py included with the library. Here is the bare code needed:
# Test SDL_PCF8563
# Main Program
print "Test SDL_PCF8563 Version 1.0 - SwitchDoc Labs"
print "Program Started at:"+ time.strftime("%Y-%m-%d %H:%M:%S")
filename = time.strftime("%Y-%m-%d%H:%M:%SRTCTest") + ".txt"
starttime = datetime.datetime.utcnow()
pcf8563 = SDL_PCF8563.SDL_PCF8563(1, 0x51)
# Main Loop - sleeps 10 minutes, then reads and prints values of all clocks
currenttime = datetime.datetime.utcnow()
deltatime = currenttime - starttime
print "Raspberry Pi=\t" + time.strftime("%Y-%m-%d %H:%M:%S")
print "PCF8563=\t\t%s" % pcf8563.read_datetime()
Your results should look like this.
Test SDL_PCF8563 Version 1.0 - SwitchDoc Labs
Program Started at:2014-08-07 16:15:41
Raspberry Pi= 2014-08-07 16:15:41
PCF8563= 2014-08-07 16:15:31
Initial Test Results for the PCF8563
the PCF8563 is running with an error < 5ppm (parts per million). 5ppm is about .45 seconds per day. The specification and app notes available for the PCF8563 are vague in terms of expected ppm, as it is dependent on the board design, temperature, crystal and capacitor choices, but I could tease out a number around 10ppm, so 5ppm isn’t unexpected as I am not varying temperature.
Arduino and the PCF8563
The following are the components required for this project. All the components can be easily purchased from Amazon. The components purchased link is given below:
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.
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
Interfacing PCF8563 Real Time Clock Module with Arduino
Here is a circuit for interfacing the PCF8563 Real Time Clock Module with Arduino UNO. I assembled the circuit on the breadboard.