How to use evive’s Real-time Clock

About This Tutorial
This tutorial discusses what is a real-time clock, and how to use evive’s real-time clock to show time, date, and day with the help of an Arduino IDE sketch.
Tutorial Info

Components Required

Image Component Quantity Available in Kit
evive 1
USB A-B Cable 1

Introduction

A real-time clock (RTC) is a clock IC that keeps track of current time and date. It is used in making of computer clocks, digital clocks, attendance systems etc. 

evive has an inbuilt RTC IC, PCF8563. The IC gets power from the internal battery of evive, so it can continue to update time while the external source of power is off or unavailable. 

PCF8563

The PCF8563 is a CMOS logic based Real-Time Clock and Calendar optimized for low power consumption. For the RTC available on evive we can set the starting date and time on it. The RTC IC is communicates with evive on I2C protocol(Two Wire Communication) .

It consists of a 32.768 kHz quartz crystal  that provides year, month, day, weekday, hours, minutes, and seconds. It also has a century flag, alarm and timer functions, integrated oscillator capacitor, and internal Power-On Reset.

Read/Write operations on RTC with evive

evive communicates with RTC via IIC-bus. Below is a list of few read write functions used for RTC  present in evive.h library:

FunctionDescription
initclock()Clears all the RTC registers.
setDate(day,weekDay,month,century,year);Used to set date on RTC. Numeric entries corresponding to day, weekDay,month,century,year are to be given.
setTime(h,m,s)Set the current hour,minutes,seconds for setting start time of RTC.
formatDate(byte style)This function returns date in mm/dd/yyyy or dd-mm-yyyy or yyyy-mm-dd format depending upon hex value of style variable written in it.
formatTime(byte style)Gives time in HH:MM or HH:MM:SS format depending on hex value of style variable written in it.
getWeekDay()returns a number depending upon which day of the week it is. For example this function will return 6 for Saturday.

Example

Below is a sample Arduino IDE sketch demonstrating how to write and read time on RTC:

This helped
This didn't help
Share this Tutorial
Share on facebook
Facebook
Share on twitter
Twitter
Share on google
Google+
Share on pinterest
Pinterest
Share on reddit
Reddit
Share on print
Print
Featured Projects
Digital-Tachometer
DIY Digital Tachometer

This project will show you how to make a digital tachometer to measure the speed of a motor or any ...

All articles loaded
No more articles to load
Close Menu
×
×

Cart

STEMpedia Starter Kit is now available on Indiegogo!
STEMpedia Starter Package is now on Indiegogo!
Get 41% OFF with Super Early Bird discounts!
x