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

ImageComponentQuantityAvailable in Kit
evive1
USB A-B Cable1

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:

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
Related Projects & Tutorials
Getting Started with evive
Getting Started with evive
This tutorial explains us what is evive, how to install the battery in it, how to charge it and the various input-output modules available in it.
evive-Plug-and-Play-Part-1
evive – Plug and Play: Part 1
In this tutorial, we are going to give you a hands-on experience of evive’s plug and play interface through activities for controlling a DC motor, a servo motor, understanding the inbuilt touch sensors of evive.
All articles loaded
No more articles to load
Featured Projects
All articles loaded
No more articles to load

Leave a Reply

Close Menu
×

Cart