Triggering RTC by Signals

Hello there,

general Kenob... ok sry.

I want to trigger the rtc. Or the Internal Clock of the Arduino Uno.

After a HIGH or true the clock should count the seconds, minutes and hours till the clock gets a LOW. After the low the clock have to reset.
I found this arduino-projects/simple_clock.ino at master · onetransistor/arduino-projects · GitHub and i like it. How could i trigger the clock. Reset it to 00:00:00 and let ir count again at a HIGH.

Why the need to reset the RTC to 00:00:00 ?

Save the time when the start event occurs and again when the end event occurs. The difference between the two is what you want to know, so there is no need, nor would it be sensible, to reset the RTC

How accurate does the measurement of the period need to be and what is the longest period that you expect to occur ?

I don’t think the OP needs an RTC object.
A simple timer at whatever period he’s looking for, with the output formatted as HH:MM:SS would seem to be the target.

lastchancename:
I don’t think the OP needs an RTC object.
A simple timer at whatever period he’s looking for, with the output formatted as HH:MM:SS would seem to be the target.

That depends on the answers to my questions

UKHeliBob:
That depends on the answers to my questions

It should be possible to "walk by" and see how far the next result is. All "Results" for the day should be subtracted and shown on a 1602 Dipslay. Kind of:

Now: 00:13:48
Total: 01:25:56

This has to be seen on the Display. I messed around with it but couldnt really find a way. Now i found this Website where a good code is shown, that display the hours, minutes and seconds. Also the date and weekday but i dont need these.

Still no answers to my questions in reply #1

Now: 00:13:48
Total: 01:25:56

As you said, without answers, we’re only guessing.
It looks like he DOES need an RTC for the .’now’ time, but the other value appears to be a cumulative ‘on’ time counter.
No resetting needed, simply a counter to accumulate the on time, and reset or display that counter when needed.

UKHeliBob:
Still no answers to my questions in reply #1

I read that the rtc DS3231 is off 1 sec every month. That is more than enough. The longest period that could occur is probably 2 hours.

BaaamInYaFace:
I read that the rtc DS3231 is off 1 sec every month. That is more than enough. The longest period that could occur is probably 2 hours.

To get that level of accuracy over a period of a week will definitely require an RTC or other accurate source of the time rather than using the Arduino itself for timing

Do you understand why you do not need to reset the RTC ?

UKHeliBob:
Do you understand why you do not need to reset the RTC ?

I know. I already saw it before, you also mensioned it in your first Post.

UKHeliBob:
Save the time when the start event occurs and again when the end event occurs.

Like you also said it wouldnt be sensitive to reset the Clock. I think i dont really need a RTC. I just thought that the Code would be a little easyer to write.

So if i use the internal clock of the Arduino Uno, it would keep on counting after reseting it right? Like millis()

So if i use the internal clock of the Arduino Uno, it would keep on counting after reseting it right? Like millis()

The Arduino does not have an internal clock. It has an oscillator. If you use millis() for timing you don't need to reset that either. If the Arduino is reset then millis() will start counting from zero again.

Not that using millis() you will not get accurate timing and it will vary with temperature