DS3231 adjustment

I am working on a project for a chiming clock to be installed in a small tower to be constructed in my garden. The chimes and hour strike are tubular bells struck with solenoid operated hammers. The arduino operates these via Darlington transistors. I have used the RTClib and successfully programmed the six note chimes and hour strikes with muting from 10.30pm until 7.30am. There is also a manual mute that overrides the automatic mute. As this will be installed where it will be impractical to connect it to a computer to update the time I want to incorporate push buttons to advance or retard the time. I was thinking of one button to press and hold for maybe a second to advance by one minute and another to retard by a minute. That way I could easily maintain accuracy to within thirty seconds. Has anyone out there done anything similar or could you offer me some guidance on how to do this? I am a relative novice to the world of arduino and can’t fathom out what I need to do so would be grateful for any help.

Which Arduino board are you using ?

Using a suitable board you could could consider remote controlling the clock

I am using a uno at the moment. Could change it though if I had to .

You could interface the Uno with a Bluetooth adapter and control the clock using your mobile 'phone

Personally I would use an ESP32 for the project which gives multiple remote control options depending on the range required

Thank you for the suggestion but my mobile phone is an antiquated Nokia that has served me well for the last twenty years and still does all I require with a fortnightly charge. All I want to do is have two push buttons so I can advance or retard the time by a minute. I was hoping to keep things as simple as possible.

It is good to keep things simple but important to know what is possible. How far from your PC will the clock be ?

They already told you: they want to use buttons to control the clock. What do you have against buttons?

Why else would they call themselves "muggles"? :thinking: :grin:

I have nothing against buttons but they do not have to be on the clock itself. In addition there may also be better ways to adjust the time or to ensure that the clock keeps accurate time

So, presumably, you have managed to successfully set the correct time on your clock. What does your code look like now?

And what do you intend to do for Daylight Saving Time changes?

I myself have made several Arduino-based chiming clocks. I have not used any RTC library in any of my clocks, but I believe I can still offer some advice.

First of all: you need to know how to set the RTC to a date and time of your choice. Do you know how to do this?

Second: you need to know how to read and respond to buttons. You probably want to know about something called "debouncing". Do you know how to read buttons?

What does your code look like now? It would help if we knew what sort of starting point we are working from.

How does your clock display the time? How will you verify that the time has been set correctly?

Here is one clock I made, which uses buttons to set the time. The time setting interface is diffferent from what you describe, but you still might be able to learn something useful from it.

I have something like this on one demo clock. There is a button for hours, 10 minutes and one minute. Pressing the hours cycles through hours, pressing the 10 minutes changes the 10's digit of the minutes, and changing the minutes sets the minutes (at the same time resetting the seconds to zero).

But it is a lousy way to set time because it is not calendar aware, needed for daylight time changes. You could set the calendar once using the computer and just change the minutes, though.

As far as "how to do it" you just have to break the task into simple sub tasks as mentioned above. There isn't any mystery or magic about it. You just have to read the buttons and apply the updates. I think that would involve reading the current time, adjusting it, and writing it back. All using RTC library functions.

Where can anyone still use a 20 year old nokia ?

@anon87735479 - "easiest" solution, a pushbutton (one) where you're out there, you click it and the clock is set to a pre-determined time (8 AM, 10PM, Noon).

You could add a GPS module to automatically obtain the time.

@odometer won't be happy with that advice :grinning:

About 400m

Two push buttons at the base of the tower was all I was planning on doing. Adjusting the minutes to get +/- 30 seconds accuracy is adequate for my requirements. Still better than the garden sundial which I can gauge to about 1 minute using the equation of time. The bells are at the top of the tower and operated by solenoids. There is a power cable and a cat 5 cable to supply the bases of transistors on the seven solenoids with a common ground wire.

I was under the impression that the DS3231 automatically adjusted for GMT/BST but obviously I will find out if that is true! An occasional nudge up or down by a minute is, I agree, in many ways not the most elegant way to adjusting the time but the best I have at the moment is removing the circuit board and connecting it to a computer. As I have previously said, I am not looking for the ultimate in accuracy so my proposed adjustment method is adequate for me.

I am in the UK and the old Nokia makes and receives calls and does text messaging too. That is all I need from a phone and while it keeps working I will keep using it. I don’t believe in replacing things that are functional just because they are old. With an 1890 sewing machine and 1950 lawnmower the phone is a youngster!

The single push button to reset to noon or whenever is ok but I must be there at the predetermined time to do the reset which reduces its practicality. Otherwise a good idea thank you.

I think perhaps the gps module is going to be a good way to go. I will investigate this. Thank you for the suggestion.

Me neither.
But we didn't get a choice.