I made this digital clock using RTC DS1302, Arduino and dot matrix. I got a huge request on my Instagram for the tutorial. so, on your demand, I am publishing this article. This post will help you to make your own desk clock.
RTC (real-time clock) DS3231 is an I2C (Inter-Integrated Circuit) protocol Based clock. It has an integrated temperature-compensated crystal oscillator and crystal. Which makes is extremely accurate.
To work with this module you RTClib library. Download it and add it to your Arduino IDE. For add library open your Arduino ide go to sketch> Include library>Add .zip library. navigate to your downloaded location and click open. After doing this restart Arduino IDE software.
Connect module with your Arduino as show in schismatics. Connection is same for Arduino nano and UNO I2C pins are same in both boards. if you have any other board follow the following table for connection.
Connect Arduino 5v to RTC DS3231, Gnd to Gnd, A4 to SDA , and A5 to SCL.
Let’s upload an example code which gives you date and time on the serial monitor. Go to File>Example>RTClib>timestamp.
Open serial monitor by click on top-right magnifying lens icon or ctrl+shift+M or go to tools>serial monitor. Make sure Arduino is connected and baud rate is 57600.
The output is current date and time. The time is in 24 hours clock. you can convert it into 12hrs clock by simply subtracting 12, when the actual time is greater then 12.
MAX7219 dot matrix module
we are using an 8*8 matrix for the digital time clock. This module has a set of 64 LEDs arranged in the 8*8 matrix. I am using the max7219 dot matrix module. Connection of this module with arduino is very simple that’s why i am using this module.
You will need maxMatrix library download it and install it on your Arduino IDE software. We are using 2 matrix modules, one is for hours and the second is for minutes.
Download this code and upload to your Arduino. Few digital clock font will apear on your matrix screen.
Assembly on breadboard
I prefer to verify circuit first on breadboard. Mount every component on breadboard, and connect according to schematics.