Digital clocks are one of the great invention in the field of science.

Have you ever wondered "How to make your own digital clocks , just like in movies! "????

Well i have also spent ,my childhood in a dream to built my very own digital clock.. so i built one for my self ...

And am going to show you, How you can built an amazing digital clock with little ease and little components all by yourself....

I have used 4 7 segment common anode display to display the digits, 3 SPDT switches , which i took apart from an old mouse, some wires and an arduino. we can set the time holding the adjust key and pressing the minute or hour key to change the minute or the hour to our need..!

So Lets get started...!

Step 1: Components Required

Here the Components that you will Require :

1. An Arduino uno.

2. 4 7 segment common anode displays (if you have a 4 digit seven segment , don't worry the circuitry is same for both of them).

you can buy them from snapdeal , they are great ! i would recommend them from the site.

3. 3 spdt Switches (which i scavenged from an old mouse ).

4.some wires and jumper wires (any one will do!).

5. A breadboard.

6. 4 1kohm resistors.

Step 2: Wiring the Displays in the Breadboard!

Make the connections as shown in the picture above.. its quite simple.!

Take care of the connections , as coz there are too many wires you might get confuse.

Remmenber All a,b,c,d,e,f,g,dot segments of 4 displays are connected together.... and the com of every display i.e 3 and 8 are connected together with the resitors...

Do not worry!! , go slowly,and have some patience , you can do it.

Step 3: Adding the Resistors and the Keys

Attach 1kohm resistor with each com of the displays ... as shown in the figure..!

Add the Spdt switches or if you have push on buttons that would be great !...

Step 4: Connecting to Arduino

Now the connections are done for the display and the switches ... now time is to connect them to the brain..

it is simple..

For segment pins!

a to pin 2

b to pin 3

c to pin 4

d to pin 5

e to pin 6

f to pin 7

g to pin 8

dot to pin 9

For display pins

display 1 to pin 10

display 2 to pin 11

display 3 to pin 12

dispaly 4 to pin 13

now for the keys

key 1 which is the adjust switches ...

key 2 and key 3 are hour changing and minute changing switches..

we have to hold the adjust key1 and press the desire key to change the hour or the minute..!

see the pic above for the connection for the keys .. we have used the analog pins and used them as digital input pins... yes thats true we can use them as digital i/o pins too..

Step 5: Adding the Code!!!!

Now the most cool part ... writing and adding the code to the arduino....

I have attached the code and the time library file .. for calculating the time and displaying it....

In the code the hour() function tells us the hour, and the minute() function the minute , from the time we have switched on the board. the time fades dies when the power to the board is cut of.. and it starts again from 00:00 every time...


Please add the Time Folder in Time.zip, in your Arduino's libraries folder.

eg in my system:

C:\Program Files (x86)\Arduino\libraries

Do feel flexible in changing the code for your needs ... and if you have some quarries feel free to ask.

Have fun making it...

<p>i made it</p>
I have also include the library bt it still shows hour is not declared in this scope, please help me i have done all steps just stuck in code?
That's great ... Share it on instructable or in YouTube ..
Thank you Madrajib ... I didn't use 7 segment instead I use the LED's as seven segment<br><br>
Can any of you help me out even I'm trying with the same with LED's as 7 segment display. I'm receiving the time from internet via esp8266 and want it to display on the LED's. I'm able to get the time but couldn't able to display as each digit requires 7 control and total (7*4) control and the arduino doesnt have that many outputs. This project helps me but im not able to understand it. Could you please help in the common connection and what will be it if we use only LED's as 7 segment
And aslo I got rid of the resistors because the lights on the LED's are low when added a resistor, but when I got rid of it glows bright, but not too bright it's just slight of it... Anyways thank you so much for the project
<p>thats cool.. the leds required a bit more voltage than the segment .. may be thats the reason.. anyways it great that you made it in your own way.. keep going.</p>
<p>source code kaha hai bro</p>
<p>Bro Step 5 me hai... View all steps click karne se ayega sare steps!</p>
<p>Hi Rajib,</p><p>Nice post. But what if I want to make this clock with<br> bigger say 4 inches 7 segment display numbers. What changes do would I <br>need? Please provide the schematic and part details if you have. <br>Thanks</p>
Hie Travi, can you supply me the data sheet of 7 segment display you will be using so that I can make the schematic .
<p>Here is the link for datasheet:</p><p>elektrologi.kabarkita.org/wp-content/uploads/2015/08/LCS-40012YG11.pdf</p>
<p>Hi Rajib,</p><p>Thanks for quick reply. I want to use this common cathode 7segment display (green color). Please provide the schematic, program code and parts detail to my email id. Thanks in advance</p><p>Regrds,</p><p>Ravi</p>
<p>Hello thanks very much i made it and it working perfectly but i need your help i won't to add RTC to it can you help me</p>
<p>how to add the given libraries in Time.zip to arduino libraries</p>
<p>Hello,</p><p><a href="https://www.instructables.com/member/Benjamin%20Egyeku" rel="nofollow">Benjamin Egyeku</a></p><p>Please follow the link below it has desrcibtion about how to add rtc </p><p><br></p><p><a href="http://www.electroschematics.com/8921/digital-clock-with-arduino-and-ds1307/" rel="nofollow">http://www.electroschematics.com/8921/digital-cloc...</a></p>
<p>How to add the given libraries in Time.zip to arduino libraries?</p>
<p>Arduino: 1.6.10 (Windows 10), Board: &quot;Arduino/Genuino Uno&quot;<br><br>C:\Users\Pallob Datta\Documents\Arduino\F2TUW2WIHDP0UUQ\F2TUW2WIHDP0UUQ.ino: In function 'void loop()':<br><br>F2TUW2WIHDP0UUQ:62: error: 'hour' was not declared in this scope<br><br> int timp = hour()*100+minute();<br><br> ^<br><br>F2TUW2WIHDP0UUQ:62: error: 'minute' was not declared in this scope<br><br> int timp = hour()*100+minute();<br><br> ^<br><br>C:\Users\Pallob Datta\Documents\Arduino\F2TUW2WIHDP0UUQ\F2TUW2WIHDP0UUQ.ino: In function 'void set_time()':<br><br>F2TUW2WIHDP0UUQ:81: error: 'minute' was not declared in this scope<br><br> byte minutes = minute();<br><br> ^<br><br>F2TUW2WIHDP0UUQ:82: error: 'hour' was not declared in this scope<br><br> byte hours = hour();<br><br> ^<br><br>F2TUW2WIHDP0UUQ:132: error: 'setTime' was not declared in this scope<br><br> setTime(hours,minutes,0,0,0,0);<br><br> ^<br><br>exit status 1<br>'hour' was not declared in this scope<br><br>This report would have more information with<br>&quot;Show verbose output during compilation&quot;<br>option enabled in File -&gt; Preferences.</p>
<p>Sorry <a href="https://www.instructables.com/member/KevinD244" rel="nofollow">KevinD244</a> for such a late reply , i was busy in my interships .... there is no code errors , did you added the give libraries in Time.zip file to your arduino 's libararies folder...???? </p>
<p>I'm having the same problem. Anyone found out the solution? </p>
<p>RahbanR sorry for late reply .. did you added the given libraries in Time.zip to your arduino libraries folder...??? coz in my windows 10 its working just fine . there is no code error .. </p>
<p>Madrajib is it a 24 hour clock</p>
Yes , Ed Marjosef.
<p>Thank you very much sir</p>
<p>how to wire up it with 4 digit 7 segment can anybody give me schematic</p>
<p>hi :)<br>i have an error in the code when i wont to upload it <br>this is the error : &darr;<br><br>Arduino: 1.6.13 Hourly Build 2016/11/07 03:34 (Windows 10), Board: &quot;Arduino/Genuino Uno&quot;</p><p>C:\Users\mahmoud\Downloads\final_clock_arduino\final_clock_arduino.ino: In function 'void loop()':</p><p>final_clock_arduino:62: error: 'hour' was not declared in this scope</p><p> int timp = hour()*100+minute();</p><p> ^</p><p>final_clock_arduino:62: error: 'minute' was not declared in this scope</p><p> int timp = hour()*100+minute();</p><p> ^</p><p>C:\Users\mahmoud\Downloads\final_clock_arduino\final_clock_arduino.ino: In function 'void set_time()':</p><p>final_clock_arduino:81: error: 'minute' was not declared in this scope</p><p> byte minutes = minute();</p><p> ^</p><p>final_clock_arduino:82: error: 'hour' was not declared in this scope</p><p> byte hours = hour();</p><p> ^</p><p>final_clock_arduino:132: error: 'setTime' was not declared in this scope</p><p> setTime(hours,minutes,0,0,0,0);</p><p> ^</p><p>exit status 1</p><p>'hour' was not declared in this scope</p><p>This report would have more information with</p><p>&quot;Show verbose output during compilation&quot;</p><p>option enabled in File -&gt; Preferences.<br><br><br>can you helo me :)</p>
<p>Hello..yer..add my skype=</p><p>(md.yasin5028)</p>
<p>Hello, im having a issue when im trying to upload your program to my arduino.. im getting this error code: </p><p>Hope you can help me out with this problem. </p><p>Arduino:1.6.7 (Windows 10), Kort&quot;Arduino/Genuino Uno&quot;</p><p>C:\Users\Ments\Desktop\final_clock_arduino\final_clock_arduino.ino:1:18: fatal error: Time.h: No such file or directory</p><p> #include &lt;Time.h&gt;</p><p> ^</p><p>compilation terminated.</p><p>exit status 1</p>
<p>Hello please you have to download the libraries, example #include &lt;Time.h&gt;</p>
<p>hie <a href="https://www.instructables.com/member/Ments1946" rel="nofollow">Ments1946</a>, sorry for late reply.. did you include the time.h library in your arduino libraries folder???? </p><p>if not then it might be the reason.. download the Time.h zip file (I have provided it there in my instructables ) extract it and copy the Time folder inside your arduino/libaries/ folder... then compile it .... it would probably work... </p>
<p>how do i make it without using the switch?</p>
<p>Sorry for late response AzadR1 , you have use the Rtc module with the arduino , its simple... </p><p>here is one of the project,...<a href="http://www.electroschematics.com/8921/digital-clock-with-arduino-and-ds1307/">http://www.electroschematics.com/8921/digital-cloc...</a></p>
what happen when i get out the power? the clock will be reset?
<p>Yes it will.. you can reset the time using the keys... there is no need to change the code.. if you want the time to stay even after the power is gone.. you can use RTC modules.....</p>

About This Instructable




More by Madrajib:Book Holder : Using Old Keyboards  Android + Arduino Labyrith game  How to make a Arduino Digital Clock 
Add instructable to: