Digital Alarm Clock based on Arduino MEGA board and 2×16 LCD display is the topic of this post. Similar design based on Raspberry Pi can be found at this link. For PIC16F877 version click here. This design should also work on Arduino UNO or any other compatible boards. However I did not test it. Arduino sketch can be downloaded here and if you look closely at the attached code you’ll see that basically it’s a bunch of counters incrementing each other. There are 2 counters for Hours, Minutes and Seconds – one for 10’s and one for 1’s. Also there are counters for setting the Alarm .When the 2 sets of these counter are equal the buzzer will work for 1 minute. The design schematic diagram is shown in the next figure.
I’ve used 2 standard breadboards for building a prototype. This project doesn’t need a lot of external components, even the pull up resistors for push buttons are internal in the ATmega2560 chip. Later you can transfer the parts to a strip board.
In order to set the time you’ll need to press Time Set and Hours or Minutes buttons at the same time. The same principle is true for setting the Alarm. Press Alarm Set and Hours or Minutes buttons together. You can see how it works in the short video next. The Alarm is working at the last few seconds of the video.
Few ideas for improving this design. Currently setting the Time/Alarm will introduce a small error to 1 second delay changing the Clock timing. Probably the correct way to do it is to use Timers that run in background and are not influenced by the main program. I’m working on improving my Arduino programming skills, so maybe I’ll revisit this design later. Meanwhile feel free to experiment with this code/project.