Simple Arduino based digital clock

Digital clocks usually have very confusing user interfaces to set the time. They require holding down buttons to go between different modes, and often you can only increment the time, for example, if you want to decrement one minute, you need to press a button 59 times. This was the main reason I created this clock.

This clock is based on an Arduino NANO, since that was what I had laying around, but almost any Arduino would work. I use a DS3232RCT module to keep track of the time. Since it has a battery backup it keeps the time during power failures, or if the clock is moved to a different position/power outlet. The time is shown on a serial LED display based on the TM1637 chip. Both the display module and the RCT module are available for cheap on eBay. My experience is that those cheap DS3232RCT modules are actually a lot better at keeping the time than most Digital clocks you can buy.

I have found that those cheap DS3232RCT modules are actually a lot better at keeping the time than most commercial digital clocks. The battery lasts for years, and they drift less than one minute over a period of one year.

I use a simple four-button interface to set the time. One button increments houres, one button decrements hours, one button increments minutes and the last button decrements minutes. All the buttons can be pressed for small adjustments, or held down to make large adjustments. This makes it easy and fast to set the time or adjust daylight saving time for the summer/winter. Lastly, I have also added a LDR (Light Dependent Resistor) connected as a voltage divider together with a 10K resistor. This acts as a light sensor. The brightness of the display is reduced when it is dark around the clock.

Here is the schematic:

The case for the clock is 3D printed from PLA. The STL-files, as well as the Inventor CAD-files, can be found together with the Arduino code in this downloadable folder: (7MB)

The code is based on some libraries you need to download before you can compile it, see the comments and the links in the main source file.

The best part about this clock is that it is easy to modify the code to add new features or modifications. For example, it would probably be pretty easy to add a buzzer and turn it into an alarm clock. My code is for a 24-hour clock since that is what we use in Sweden where I live, But it would probably be pretty easy to adapt the code to make it a 12-hour clock.