How to Make a Arduino Digital Clock

15,310

28

70

Published

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

Also i have attached a 12 hour format code too. It just uses hourFormat12() function to get the 12 hr format.

By default the Time library returns 24hr formated 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...

note: I have updated the Time.zip file as it was deprecated in newer versions of Arduino IDE.

Share

Recommendations

  • Creative Misuse Contest

    Creative Misuse Contest
  • Clocks Contest

    Clocks Contest
  • Oil Contest

    Oil Contest

70 Discussions

0
user
Bilal530

Question 5 weeks ago

sir please can u tell me how i can solve this error i have added the time folder to the arduino/libraries and i also read all answers to this question i tried every single thing you told in the answers but it is still having a same error

please sir help me out as early as possible

44.PNG

Sir i have make your ,arudino digtal clock
Pc using perotus 8 pro all circuit is complete but ardino program i need hex file of that code plz give me

Good day sir. Ahmm can i ask if the code for the hour sir because just like the others sir we do have the same problem that hour was not declared. Im hoping you can help me with this sir. Thank you

can you send me the code please i need it please do help me

how can i convert this 24 hours digital clock code to 12 hours format???
Or can you give me the 12 hours format digital clock code for this same diagram????

how to convert it 24 hours to 12 hours formate sir????

Dear Sir,
I have a letest arduino version software and I have follow of your instruction and i have alredy connect breadboard to arduino wires of your instruction.When i have download of your first link Sketch file and open in arduino but upload not properly.I dont know any technical problem show here.Please tell me How to upload directly without any programing.Thank you sir.If you want E-mail me for sending any code Sketch file please send (ayandeysarkar76@gmail.com).I likes your videos every time....I hope you understand and I wish you are help me for this problem journey.Thank you.


Show less


0
user
RajA46

1 year ago

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

3 replies

Sorry RajA46 for such an late reply and error. actually the Time library i have used was for old version of arduino ide. it was update after arduino ide 1.6.1 version, hence the error.

here is the link to new updated library, but before you use it delete the Earlier Time folder from libraries folder

C:\Users\lenovo\Documents\Arduino\libraries and also from

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

now dowload the zip file and add it to arduino,

https://github.com/PaulStoffregen/Time.git

To add it go to sketch->Include Library->Add .Zip Library and find the zip file.

after that go to sketch->Include Library->Time

And it will work.

yeah i have the same problem too. pls, i really need your help, hour is not declared in the scope

Hi. I just followed the note you have provided, and sadly there is always an error in verifying the code. Is there any alternatives you could suggest in order to fix the error? The error always says that the "hour' was not declared in this scope. Though, I'd already add the time folder in time.zip in my arduino's libraries folder. Please reply. I'm truly in need of help. Thank ypu.

2 replies

did you add the zip file without unzipping it???

Try this:

Delete the time library from the libraries folder.

open arduino ide.

select "Sketch" tab from the top left menu bar.

select "Include Library" and select Add .ZIP Library from the drop down.

located the time.zip file and press ok.

this would include the time library to the Arduino libraries,

and now include the library by again selecting including library option and selecting time library from the drop down

Sorry MikeK277 for such an late reply and error. actually the Time library i have used was for old version of arduino ide. it was update after arduino ide 1.6.1 version, hence the error.

here is the link to new updated library, but before you use it delete the Earlier Time folder from libraries folder

C:\Users\lenovo\Documents\Arduino\libraries and also from

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

now dowload the zip file and add it to arduino,

https://github.com/PaulStoffregen/Time.git

To add it go to sketch->Include Library->Add .Zip Library and find the zip file.

after that go to sketch->Include Library->Time

And it will work.

Dear Sir,

You can give me arduino digital clock "code",i can not found.please help me.

1 reply

Dear AyanS14, the code it right there in the instructable page.
Under the STEP 5: ADDING THE CODE!!!!
Below the image you will seen final_arduino.ino name click it it shall start downloading..