Digital Alarm Clock without using an RTC

Hi,

Wondering if it's possible to code a Digital alarm clock using just an Aruino Uno, an LCD screen and some pushbuttons?

There's lots of help on creating an alarm clock using an RTC, but I want to try it without as I think it'll give me better technical achievement marks.

Is this possible?

If it is not then I don't want to waste my time.

Thanks,

Steven

Yes, as long as you're not too concerned about accuracy.

It will be good if you replace the default ceramic resonator with a crystal. I would give you extra points for using watch crystal, internal oscillator and power save sleep to reduce power consumption.

AWOL:
Yes, as long as you're not too concerned about accuracy.

Hello,

Thanks for the reply.

Lets say I was concered about accuracy. Why would this be a problem?

After some googling, is it because "the Uno is not crystal-controlled, but rather uses a ceramic resonator? These can be less expensive, but typical accuracy is only on the order of ±0.5% (5000ppm)." --> Information I have found.

If it that's the case, then this would be something good to write about in my report, and I will use an RTC.

Thanks,

Steven

Smajdalf:
It will be good if you replace the default ceramic resonator with a crystal. I would give you extra points for using watch crystal, internal oscillator and power save sleep to reduce power consumption.

Hello,

Thanks for the reply.

Do you know how I would go about doing this? Sounds like a good, interesting but complicated technique!

I'll appreciate any help!

Thanks,

Steven

Sounds like a good, interesting but complicated technique!

But not as good as using an rtc. Even if you replaced the resonator with a more accurate crystal, the Arduino would still need to have the time set every time power was lost or the reset button was pressed. An rtc module has a coin battery to keep the time even when the Arduino loses power.

It you get an rtc, get one based on the ds3231 chip, which is more accurate than the older ds1307 chip.

Other interesting ways of getting the time include:

Using WiFi/ethernet to connect the the internet and get the time from a Network Time Server (NTP).

Using a GPS module.

Using a receiver module to get the time from a radio time source.

An ESP8266 is what I would use.
You can get an RTC shield for a WEMOS mini
You can use the WiFi to reach out to your internet and get the time,

with the ability to get the time from the net, the RTC falls away from the high priority.
as a note, you can add an SD card player and have all manner of alarm tones.

If you want to make an alarm clock without an RTC then I suggest you create a program for your Uno and run it for a while to observe whether it runs fast or slow relative to a proper clock.

Then add a correction factor to your program. For example if it runs slow by (say) 36,000 millisecs in 1 hour (and error of 1% if my maths is correct) then every "second" add 10 millisecs to the 1000 millisecs produced by millis().

I suspect you will get a pretty accurate clock with a bit of experimenting. There is some risk that the Uno's timekeeping will be affected by changes in temperature in a way that an RTC module won't. But I suspect your Uno won't be subject to much temperature variation.

...R

PaulRB:
But not as good as using an rtc. Even if you replaced the resonator with a more accurate crystal, the Arduino would still need to have the time set every time power was lost or the reset button was pressed. An rtc module has a coin battery to keep the time even when the Arduino loses power.

It you get an rtc, get one based on the ds3231 chip, which is more accurate than the older ds1307 chip.

Other interesting ways of getting the time include:

Using WiFi/ethernet to connect the the internet and get the time from a Network Time Server (NTP).

Using a GPS module.

Using a receiver module to get the time from a radio time source.

I think I'm going to go with the DS3231.

Thank you for your input!

Robin2:
If you want to make an alarm clock without an RTC then I suggest you create a program for your Uno and run it for a while to observe whether it runs fast or slow relative to a proper clock.

Then add a correction factor to your program. For example if it runs slow by (say) 36,000 millisecs in 1 hour (and error of 1% if my maths is correct) then every "second" add 10 millisecs to the 1000 millisecs produced by millis().

I suspect you will get a pretty accurate clock with a bit of experimenting. There is some risk that the Uno's timekeeping will be affected by changes in temperature in a way that an RTC module won't. But I suspect your Uno won't be subject to much temperature variation.

...R

This is perfect.

Thank you for this!

This is a 3rd year project, so even though I've decided to go for the DS3231, I'm going to do this method at first anyway, and then write about it in my report. So thank you, I would have never have thought about a correction factor.

Steven

This is a 3rd year project, so even though I've decided to go for the DS3231, I'm going to do this method at first anyway, and then write about it in my report.

Keeping reasonably accurate time after calibrating the Arduino resonator one issue.

Restarting after a power failure without an external time source is another very significant issue.

You can not make an Arduino clock of any real use without an external source of time.

cattledog:
You can not make an Arduino clock of any real use without an external source of time.

An RTC module does not have any external source of time. Why would a battery-powered Arduino need one?

I accept fully that an RTC will keep time more accurately. But there is no reason to expect it to be more reliable than a reliably designed Arduino project. Reliability and accuracy are two different things.

...R

An RTC module has an external source of time, it's called human input, which is all it needs, and not too often either. I'm not sure what the point of all that is. There has been only one sensible line written in this whole thread, and it is

You can not make an Arduino clock of any real use without an external source of time.

Accuracy and reliability are relative terms that may be addressed later, and hardly merit consideration until OP comes to terms with using an external source. It certainly is possible to build an Arduino clock without an external source of time, and is one of the better examples of a stupid waste of time in this arena - and all for the sake of about $2-50.

Nick_Pyner:
until OP comes to terms with using an external source.

I have been under the impression, based on the Original Post, that the OP is well aware that RTCs exist and are good timekeepers but that he wanted to experiment to see what is the best clock he can make without using an RTC.

...R

GPS time and internet time is more accurate than the rotation of the Earth itself.

But it seems like a fun experiment to do with the unassisted Arduino.

Nick_Pyner:
You can not make an Arduino clock of any real use without an external source of time.

I beg to differ.

The timekeeping you get from an Arduino without an RTC is about as accurate as what you would get from a mechanical clock.

A mechanical alarm clock is by no means perfect, but it is good enough to get you up at about the right time so that you can get to work (or class) on time.

A mechanical alarm clock has a lever marked "+/-" (or "F/S") by means of which its speed can be adjusted. This is useful in case the clock runs too fast or too slow. Adjusting the speed of a clock made from an Arduino is left as an exercise for the reader. (Hint: How would you change the speed of the blink in Blink Without Delay?)

Robin2:
The OP is well aware that RTCs exist and are good timekeepers but that he wanted to experiment to see what is the best clock he can make without using an RTC.

...R

Spot on.

I felt as though using an RTC module was taking the easy route and wouldn't give me very high 'technical achievement' marks. However, despite drawing the conclusion of going with the DS3231, at least now I've been able to code an accurate alarm clock without using an RTC which I can write about in my report, and then justify my reasoning for using the RTC module in the end :slight_smile: