Introduction: Arduino Digital Clock Using DS1302

Introduction

Hello guys, I hope you all doing great. This is going to be a short and simple project about how to make a digital clock using Arduino.

In this project, we are gonna make a digital clock with the help of Arduino and a shift register. This can only display the time in 24 hr format with blinking dots(representing seconds).

I am using Real Time Clock Module(RTC) DS1302 for timing purposes. The great thing about it is using only one Shift register and a 4-digit 7segment display.

Step 1: ​What Do We Need?

Here is the list of parts we need:

  • Arduino Uno/Nano
  • RTC Clock Module(DS1302)
  • 4-digit Seven Segment Display
  • Shift Register(74HC595)
  • 220 Ohm Resistor x4 (To Decrease The Brightness)
  • CR2032 coin cell (For RTC module)
  • Jumper Wires
  • BreadBoard
  • Perf Board (Optional For Prototyping)Lithium-Ion Battery (For Power Source)

So This is what we all need.

Step 2: Connections/Wiring

In this, we connect the Segment Display to the Arduino and Shift Register as follows:

Pin A to the Q0,

Pin B to the Q1,

Pin C to the Q2,

Pin D to the Q3,

Pin E to the Q4,

Pin F to the Q5,

Pin G to the Q6 of the Shift Register

Pin DP(H) to the Pin 3 of Arduino

Pin Digit1 to the Pin 7 of Arduino

Pin Digit2 to the Pin 6 of Arduino

Pin Digit3 to the Pin 5 of Arduino

Pin Digit4 to the Pin 4 of Arduino

Also, connect 220-ohm Resistors with each digit of segment display. (See Diagram)

Now we connect the RTC Module to Arduino, insert the coin cell in the module, and connect according to the given diagram. Same for the Shift Register.

You can download these images from the link given below. Schematic BreadBoard Connections

Step 3: Coding

You'll see a code like this as shown in the image:

Only Set the current time in this line of code and upload it. After uploading, comment on this line (use double slash i.e. //) because once the time is set it remains unchanged.

Include the library(provided in the given link below) in the program by going to

Sketch< Include Library< Add .ZIP file< Add path of your downloaded file

Download the code and libraries from the given link below:

Download Code

Step 4: Prototyping(Optional)

We can make this project portable by doing connections on PCB.

While making it on a PCB make sure you are using female header pins to mount the Arduino circuits otherwise directly soldering may damage the device. Also, use a 16 pin IC base for shift resistor else device may get damaged (same happens in my case).

Also, I soldered Segment display on another PCB which can be mounted easily on a box or something else.

Connect each joint properly else the circuit may not work.

Suggestion: First make it on breadboard then you can solder it to PCB.