Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

RTC for PIC's

Status
Not open for further replies.

gregmcc

Member
I'm busy building a electronic lock system on a 16F628 and would like the pic to log the date/time of when the lock is opened. Is the pic accurate enough to keep track of its own date/time through software or should I use a RTC to do this - I've been reading up on the DS1302/7 and it looks like it will also do the trick.

How accurate are these RTC's though - after a few months will the time be way off?

Update: did some more searching on the accuracy :)
https://www.electro-tech-online.com...in-ds1302-based-clock.23358/?highlight=ds1302

What will something like a tv/microwave use as mine seems to stay accurate for months on end?
 
Last edited:
The spec sheets for them should tell you the drift over a time period. Getting an accurate RTL is easy, look at all the cheap watches out there that have no problems for years...Sweet the UPS truck! Gotta go.
 
You can either use the rtc on the pic or a DS1307.
The initial timekeeping accuracy depends on the spec of the 32768Khz crystal that you select.
Look for one with the best PPM (Parts Per Million) accuracy. (lower is better)
The advantage of using the DS1307 is that you can have a separate battery-backed clock and also it has 56 bytes of battery backed ram for storing data - perhaps for saving some timestamps?
 
Here is an interesting approach to assuring correctness:

**broken link removed**

Its available at Digi-Key (Part #:561-1005-ND) for $30 USD. It connects via a simple serial interface.

You could use it to periodically sync up the 1302/7 time if you were so inclined.
 
pwssr said:
Here is an interesting approach to assuring correctness:
Its available at Digi-Key (Part #:561-1005-ND) for $30 USD. It connects via a simple serial interface.
.
I don't think that is an option for the OP's location as there does not appear to be any long wave time transmitters covering that country.
 
I've sampled and played with a few of these RTC chips from DS.

They even make ones that have an integrated crystal which makes things really simple; you can get away with only four connections, Vdd, Vss, SDA, and SCL, although you probably would want to hook up a button cell so that it doesnt forget the time. Some of the DS13XX chips also have a built in trickle charger so that your battery should never go dead.
 
gregmcc said:
What will something like a tv/microwave use as mine seems to stay accurate for months on end?

Most microwaves use the mains frequency as a reference, in countries with a good mains supply (like the UK) it gives excellent long term accuracy - basically you never need to alter the clock, except for summertime changes!.
 
Thanks for the feeback - looks like the DS is the way to go. Time to pay a visit to my local electronics shop :)
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top