Introduction: How to Make a Arduino Digital Clock

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...

Note:

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...

Comments

author
SimonC77 (author)2017-08-07

Hello iis it possible to use a bcd segment instead of the switches?

author
Madrajib (author)SimonC772017-08-09

Which Switches are you talking about?

author
SimonC77 (author)Madrajib2017-08-14

spdt switches

author
ElizabethH163 (author)2017-06-06

The lights that are under the numbers all light up and flash. When I unplug the ground, the flashing stops but then the brightness/dimness to differentiate between on and off are so similar, you can't tell what number it is. The buttons don't work and won't let me change anything. Please help. ​

author
Zahid_jony (author)2017-05-31

I have done it..... very good project. I like it.

author
Madrajib (author)Zahid_jony2017-05-31

Thats great .. Thanks

author
ixixvi (author)2017-05-03

Hi there. I can't find any anode seven segments nearby. Is it possible to replace the anode segments by cathode seven segments? And how to do it. Thanks!

author
Madrajib (author)ixixvi2017-05-23

Sorry ixixvi for such an late reply , i had final semester examinations going on.

You have to change a lot of code in the program ..

you can use not gate ics to the to all the pin ..

author
RajA46 (author)2017-05-14

Hour was not decrared in this slope ...please help me out...??

author
Madrajib (author)RajA462017-05-23

Sorry Raj for late reply. I think you have a Time folder already
in the libraries folder. delete all time Time folder and then download
the file and add it ...

It is working fine in my system. Also are you running windows installer version or

Windows ZIP
file for non admin install.

I am have a installer version .

author
RaghavT7 (author)2017-05-20

Madrajib, I have added library and I have windows 10 too, but it still shows 'Hour was not decrared in this slope'

author
Madrajib (author)RaghavT72017-05-23

Sorry Raghav for late reply. I think you have a Time folder already in the libraries folder. delete all time Time folder and then download the file and add it ...

It is working fine in my system. Also are you running windows installer version or

Windows ZIP
file for non admin install.

I am have a installer version .

author
Ed Marjosef (author)2017-03-31

i made it

author
maneg (author)Ed Marjosef2017-04-18

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?

author
Madrajib (author)Ed Marjosef2017-03-31

That's great ... Share it on instructable or in YouTube ..

author
Ed Marjosef (author)Madrajib2017-04-01

Thank you Madrajib ... I didn't use 7 segment instead I use the LED's as seven segment

author
Sandesh_SP (author)Ed Marjosef2017-04-11

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

author
Ed Marjosef (author)Madrajib2017-04-01

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

author
Madrajib (author)Ed Marjosef2017-04-01

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.

author
AmanS192 (author)2017-03-27

source code kaha hai bro

author
Madrajib (author)AmanS1922017-03-27

Bro Step 5 me hai... View all steps click karne se ayega sare steps!

author
travi (author)2017-03-17

Hi Rajib,

Nice post. But what if I want to make this clock with
bigger say 4 inches 7 segment display numbers. What changes do would I
need? Please provide the schematic and part details if you have.
Thanks

author
Madrajib (author)travi2017-03-17

Hie Travi, can you supply me the data sheet of 7 segment display you will be using so that I can make the schematic .

author
travi (author)Madrajib2017-03-18

Here is the link for datasheet:

elektrologi.kabarkita.org/wp-content/uploads/2015/08/LCS-40012YG11.pdf

author
travi (author)Madrajib2017-03-17

Hi Rajib,

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

Regrds,

Ravi

author
Benjamin Egyeku (author)2016-05-24

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

author

how to add the given libraries in Time.zip to arduino libraries

author
Madrajib (author)Benjamin Egyeku2016-05-28

Hello,

Benjamin Egyeku

Please follow the link below it has desrcibtion about how to add rtc


http://www.electroschematics.com/8921/digital-cloc...

author
Ed Marjosef (author)2017-03-14

How to add the given libraries in Time.zip to arduino libraries?

author
KevinD244 (author)2016-12-04

Arduino: 1.6.10 (Windows 10), Board: "Arduino/Genuino Uno"

C:\Users\Pallob Datta\Documents\Arduino\F2TUW2WIHDP0UUQ\F2TUW2WIHDP0UUQ.ino: In function 'void loop()':

F2TUW2WIHDP0UUQ:62: error: 'hour' was not declared in this scope

int timp = hour()*100+minute();

^

F2TUW2WIHDP0UUQ:62: error: 'minute' was not declared in this scope

int timp = hour()*100+minute();

^

C:\Users\Pallob Datta\Documents\Arduino\F2TUW2WIHDP0UUQ\F2TUW2WIHDP0UUQ.ino: In function 'void set_time()':

F2TUW2WIHDP0UUQ:81: error: 'minute' was not declared in this scope

byte minutes = minute();

^

F2TUW2WIHDP0UUQ:82: error: 'hour' was not declared in this scope

byte hours = hour();

^

F2TUW2WIHDP0UUQ:132: error: 'setTime' was not declared in this scope

setTime(hours,minutes,0,0,0,0);

^

exit status 1
'hour' was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

author
Madrajib (author)KevinD2442017-02-06

Sorry KevinD244 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...????

author
RahbanR (author)KevinD2442017-01-20

I'm having the same problem. Anyone found out the solution?

author
Madrajib (author)RahbanR2017-02-06

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 ..

author
Ed Marjosef (author)2017-01-26

Madrajib is it a 24 hour clock

author
Madrajib (author)Ed Marjosef2017-01-26

Yes , Ed Marjosef.

author
Ed Marjosef (author)Madrajib2017-01-27

Thank you very much sir

author
জ্ঞানপ (author)2017-01-06

how to wire up it with 4 digit 7 segment can anybody give me schematic

author
Mahmoud B.I (author)2016-11-07

hi :)
i have an error in the code when i wont to upload it
this is the error : ↓

Arduino: 1.6.13 Hourly Build 2016/11/07 03:34 (Windows 10), Board: "Arduino/Genuino Uno"

C:\Users\mahmoud\Downloads\final_clock_arduino\final_clock_arduino.ino: In function 'void loop()':

final_clock_arduino:62: error: 'hour' was not declared in this scope

int timp = hour()*100+minute();

^

final_clock_arduino:62: error: 'minute' was not declared in this scope

int timp = hour()*100+minute();

^

C:\Users\mahmoud\Downloads\final_clock_arduino\final_clock_arduino.ino: In function 'void set_time()':

final_clock_arduino:81: error: 'minute' was not declared in this scope

byte minutes = minute();

^

final_clock_arduino:82: error: 'hour' was not declared in this scope

byte hours = hour();

^

final_clock_arduino:132: error: 'setTime' was not declared in this scope

setTime(hours,minutes,0,0,0,0);

^

exit status 1

'hour' was not declared in this scope

This report would have more information with

"Show verbose output during compilation"

option enabled in File -> Preferences.


can you helo me :)

author
Md.yasinM (author)Mahmoud B.I2016-11-19

Hello..yer..add my skype=

(md.yasin5028)

author
Ments1946 (author)2016-04-26

Hello, im having a issue when im trying to upload your program to my arduino.. im getting this error code:

Hope you can help me out with this problem.

Arduino:1.6.7 (Windows 10), Kort"Arduino/Genuino Uno"

C:\Users\Ments\Desktop\final_clock_arduino\final_clock_arduino.ino:1:18: fatal error: Time.h: No such file or directory

#include <Time.h>

^

compilation terminated.

exit status 1

author

Hello please you have to download the libraries, example #include <Time.h>

author
Madrajib (author)Ments19462016-04-30

hie Ments1946, sorry for late reply.. did you include the time.h library in your arduino libraries folder????

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...

author
AzadR1 (author)2016-03-29

how do i make it without using the switch?

author
Madrajib (author)AzadR12016-04-04

Sorry for late response AzadR1 , you have use the Rtc module with the arduino , its simple...

here is one of the project,...http://www.electroschematics.com/8921/digital-cloc...

author
vvick1 (author)2015-11-25

what happen when i get out the power? the clock will be reset?

author
Madrajib (author)vvick12015-11-25

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.....

About This Instructable

8,605views

25favorites

License:

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