Pages: 1 [2]   Go Down
Author Topic: RTC modules - who's is "best"?  (Read 5301 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Sr. Member
****
Karma: 1
Posts: 322
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I only bother to adjust once per day at midnight. Drift is approx 7.5 seconds per day so at midnight I read the time, add 8 seconds, wait 0.5 seconds and then write the time back.
I was looking at adjusting as soon as it was off by a second.  So in your case I would add a second every 3 hours and 12 minutes.  I was also looking at having the clock track it's own error.  If I need to subtract a second after a couple days I might change the interval to 3 hour 12 minute 16 seconds.
It reminds me of the old grandfather clock.  Reset the time and then turn the screw under the pendulum.
Logged

Norfolk UK
Offline Offline
Faraday Member
**
Karma: 70
Posts: 2569
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I was also looking at having the clock track it's own error
How was you going to do this?

I could adjust the time hourly by reading time, waiting 312ms and writing time but will probably replace the DS1307 with one of my DS3231 chips as drift amount also varies with temperature. The 7.5 seconds was determined during winter/spring but with summer here it's drifting nearer 7.8 seconds per day.
Logged


Offline Offline
Sr. Member
****
Karma: 1
Posts: 322
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

How was you going to do this?
I was thinking, though I haven't done so, of starting off assuming zero drift and having with zero adjustment.  The clock would note the time it started.  At some later point I would check the time and adjust it up or down.  The clock would then take the adjustment amount and the amount of time that had elapsed and calculate a drift value.  It would then apply that drift amount.  At some point later if I needed to adjust the clock again the clock would use the addition adjustment to recalculate the fine tune the drift value.

I guess if I wanted to try and compensate for temperature I would need to add a DS1820 and track that as well but I think I will hold off on that.

It would be interesting to have a contest to see how accurate a clock you could make for under $5.

If power were not an issue, you could make a small oven for the clock or crystal and hold it at 40 degrees C or something.  That way you would not see a drift due to temperature changes.
Logged

Oz
Offline Offline
God Member
*****
Karma: 5
Posts: 804
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

macegr,

I am slightly leaning your way to get one of yours.

Try and support people who develop the Arduino.

Looking at it, all looks good, but how do you set the "adderss" of it on the I2C bus?

That isn't mentioned.

I am still having trouble getting my head around that part - see my other post/s on the subject.

Still can't work out how to get the 23017 MCP working.
Logged

SF Bay Area
Offline Offline
Edison Member
*
Karma: 11
Posts: 1244
Arduino Ninja
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The address is hardcoded...actually, most of the I2C RTCs use the same address. That's why code designed for the DS1307 will work for the DS323x.

There is a library that makes using RTC modules and doing various timekeeping functions pretty easy. Here's an example I made a while back: http://www.macetech.com/blog/node/115

While I appreciate the sentiment, don't feel too obligated until you check out the relative shipping fees..USPS is killing me here.
Logged

Unique RGB LED Modules and Arduino shields: http://www.macetech.com/store

Oz
Offline Offline
God Member
*****
Karma: 5
Posts: 804
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yeah, thanks,

I posted a bit more in the other thread.

So, the 1307 is "hard coded" - as I just learned.

That is one of two  chips.

How do I get to know the EEPROM's address?

Again, I've looked though the code, but can't resolve where/how it is set/read/defined.

Be it hard coded, or what ever:  Somewhere in the code it should indicate what address it (the program/sketch) expectst the EEPROM to be at.

So then I would put the MCP at the next available address.

Logged

Norfolk UK
Offline Offline
Faraday Member
**
Karma: 70
Posts: 2569
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

To read/write to the DS1307 chip you use the Wire library see http://arduino.cc/en/Reference/Wire The DS1307 memory is not mapped to the MCU memory space so you cannot just read a MCU memory location to get a value from the DS1307. Using the Wire library you tell the DS1307 what memory location you want to read/write on that device (not MCU memory) and how many bytes to read/write and then read/write them.
A poor analogy would be a office filing cabinet. Your sitting at home and and want to access some file from the cabinet in the office at work. You cannot directly access the cabinet but you can phone someone at the office and tell them what file you want to alter and then they read the file to you or you dictate the changes to them.
Logged


Oz
Offline Offline
God Member
*****
Karma: 5
Posts: 804
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Riva.

I have the "Cenetipede" library.
(Argh!  I don't mind this autospelling, but when the brain can't get the spelling right, or it is a .....  anyway.)

So I have been told the pins nearly "directly translate" depending on the address pins on the MCP.

Logged

Norfolk UK
Offline Offline
Faraday Member
**
Karma: 70
Posts: 2569
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have the "Cenetipede" library.
(Argh!  I don't mind this autospelling, but when the brain can't get the spelling right, or it is a .....  anyway.)

So I have been told the pins nearly "directly translate" depending on the address pins on the MCP.
This sounds like an question for macegr as to whether other devices can co-exist using the I2C interface on the Centipede shield.
Logged


SF Bay Area
Offline Offline
Edison Member
*
Karma: 11
Posts: 1244
Arduino Ninja
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The MCP23017 doesn't collide with the DSxxxx RTC modules no matter what the address pins are, they only control the last three bits of the address.

If the MCP23017 address pins are 000, then the Centipede library assigns pins 0 through 15 to that chip (using the library's own <object>.digitalWrite() function).

The documentation page shows everything, there are no hidden tricks to get it to work smiley http://docs.macetech.com/doku.php/centipede_shield
Logged

Unique RGB LED Modules and Arduino shields: http://www.macetech.com/store

Oz
Offline Offline
God Member
*****
Karma: 5
Posts: 804
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Macegr,

Thanks.  I have the docs but shall have to read them again.
Just now I am working on my next sketch or potted plant watering system.

So the RTC's fixed address is outside the scope of the MCP's scope of addresses.

Good.

But then I wonder what happened when I had the library active and ran the example script and I got alternating black/white lines on the LCD.

Logged

Oz
Offline Offline
God Member
*****
Karma: 5
Posts: 804
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I want to stop looking soon, but just found this one too:

Our PCF8583 Real-Time Clock Mini Board is the ideal solution to add a real-time clock or counter to your project. The board comes complete with the PCF8583 Real-Time Clock IC from Philips Semiconductor, which can also be used as a counter.

But don't know how good the chip is.

It is I2C bus connected.

Logged

Peoples Republic of Cantabrigia
Offline Offline
God Member
*****
Karma: 6
Posts: 722
Arduino happiness
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Just a clock but I have been super happy with it - the Chronodot from Macetech. It uses the I2C bus and the DS3231. Highly recommended.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 43
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I use the Chronodot from MaceTech too.

couldn't be easier.    couldn't be better.

Thanks Macegr for your efforts.

Where can I get a nice discount on a bulk order - 250 units.
Logged

Pages: 1 [2]   Go Up
Jump to: