Is there any limit as to how often I can set time on a DS3231

Thread Starter

djsfantasi

Joined Apr 11, 2010
9,186
Question: I am creating an Arduino with an I2C LCD display to run a clock at a variable ratio. That is, if I want the clock to run faster at a 12:1 ratio, I can. As well as an 18:1 ratio, 24:1 ratio, etc…

I have the display, so writing a sketch is the obvious way to go.

But… I also have an I2C real-time clock based on the DS3231. Is it feasible to update it every scaled fifteen minutes? My current plan is to update it every 15 seconds…

Note: I may not do it this way. Just curious as to if it could be done.

Background: “Fast Clocks” are used by serious model railroaders. Since the track and engines are scaled down but scaling distances and time doesn’t happen. In a popular model railroading scale, one mile is 60 feet. Obviously one doesn’t have 600’ to model two stations that are 10 miles apart.

I don’t use it for that reason. My model automates the building/billboards/train signal lighting with an Arduino. I’ve created a schedule of which and what lights turn on when for a scaled 24 hour period. Currently, lights change every 15 seconds (real time).

It’d be nice to have a clock on my control panel, showing the scale time.
 

bidrohini

Joined Jul 29, 2022
190
Itis feasible to update the time on the DS3231 RTC (Real-Time Clock) at a variable rate. And I never heard of any limit as to how often we can do that.
 

Jon Chandler

Joined Jun 12, 2008
1,095
It seems like reseting a RTC chip every 15 seconds to display speeded-up time is a really hard way to do it. Reseting the RTC so you can read out the time you just set???

Maybe overstock a DS1309 with a higher frequency crystal?
 

Papabravo

Joined Feb 24, 2006
21,304
Wouldn't it be easier to adjust the input to a standard clock so that instead of counting actual seconds it counts "scaled seconds". You might not even want to display seconds, just minutes and hours. The Arduino itself should be able to manage that without the need for an auxiliary chip.
 

Thread Starter

djsfantasi

Joined Apr 11, 2010
9,186
Wouldn't it be easier to adjust the input to a standard clock so that instead of counting actual seconds it counts "scaled seconds". You might not even want to display seconds, just minutes and hours. The Arduino itself should be able to manage that without the need for an auxiliary chip.
YES! That’s the preferred solution. I have to find an inexpensive clock module to which I can add an external clock, perhaps the Arduino. I’m trying to find out if there’s a chip that’s commonly used in cheep digital clocks, with an external clock input pin.

In fact, my searches for that component kept returning the DS3231. Since I have a DS3231 based RTC, I came up with this scheme as an alternate. The only real advantage is that it gives me the conversion from integers to characters to display on the LCD. And that could be done in code.

And yes, I only plan on showing hours and minutes.
 

Papabravo

Joined Feb 24, 2006
21,304
YES! That’s the preferred solution. I have to find an inexpensive clock module to which I can add an external clock, perhaps the Arduino. I’m trying to find out if there’s a chip that’s commonly used in cheep digital clocks, with an external clock input pin.

In fact, my searches for that component kept returning the DS3231. Since I have a DS3231 based RTC, I came up with this scheme as an alternate. The only real advantage is that it gives me the conversion from integers to characters to display on the LCD. And that could be done in code.

And yes, I only plan on showing hours and minutes.
Why do you need to do any conversion? You should do your counting on the character string used for the display. The code for doing that is very nearly trivial and you only need to execute it once per "scaled minute".
 

Thread Starter

djsfantasi

Joined Apr 11, 2010
9,186
Why do you need to do any conversion? You should do your counting on the character string used for the display. The code for doing that is very nearly trivial and you only need to execute it once per "scaled minute".
Rightio! Easy peasy. I really didn’t consider the programming since I was focused on using the RTC since I had no other use for it at this time. But this appears to be the most efficient approach.

The Arduino sketch that will drive the clock already uses time-slice cooperative multitasking so adding fast clock time maintenance won’t be difficult. The sketch already multitasks five other tasks.

I tend to get stuck on an approach when there’s a better alternative available. I’ll have to work on taking a more global approach to my problem solving!

Thanks for your ideas.
 

Papabravo

Joined Feb 24, 2006
21,304
Rightio! Easy peasy. I really didn’t consider the programming since I was focused on using the RTC since I had no other use for it at this time. But this appears to be the most efficient approach.

The Arduino sketch that will drive the clock already uses time-slice cooperative multitasking so adding fast clock time maintenance won’t be difficult. The sketch already multitasks five other tasks.

I tend to get stuck on an approach when there’s a better alternative available. I’ll have to work on taking a more global approach to my problem solving!

Thanks for your ideas.
Glad to be of assistance.

In my career that lasted over a half a century ALL of my successes were the result of cooperative collaboration. In this way we avoided what we called the trap of "slow stupid failure". This is the ability to realize that the path you are on has impediments, what those impediments are, and what can be done to correct them. Even when I was the only person doing software development, I relied on the production technicians, and the accountants, who were also audiophiles, to tell me when the operations made sense or did not make sense for the audio products that I was working on.

I used to charge for my good advice, but today it is there for the asking.
 

Ya’akov

Joined Jan 27, 2019
9,264
You provoke the idea of a series of specialist time servers that keep scaled UTC time so all scale railroads can run according to a standard clock…
 
Top