Introduction: How to Make a Software Clock

To explore the Arduino world I have, when buying the base Board, also purchased a multi-shield for an amount of just over € 7.00.

On this shield there are a number of options including a 4 digit display and 3 buttons, witch I first used to make a software clock.

Apart from the digits and the buttons I later have used the LEDs, the buzzerd and the potentiometer:

The LEDs to give a ¼ minute signal.

The buzzerd to generate an hourly chime.

The potentiometer to the evil time:

-turning clockwise is faster

-turning against the clock is slower

Step 1: The Program:

By perusing a concise manual and looking at examples (here and there) I came to the following program:

(sorry i don't know how how to get this in a nice window)

/* Learning how to programming Arduino */

/* by Rob van Staalduinen - Netherlands */

byte num[]={192,249,164,176,153,146,130,248,128,144,64,121,36,48,25,18,2,120,0,16};

// array with numbers 0-9 and 0.-9. (for hour digit [1])

byte time[]={0,0,0,0}; // array for putting the time in

byte push; // button-push delay counter

void setup ()

{ for (byte a=3;a<=13;a++) // sets datapins 4 to 13 to OUTPUT

{ pinMode(a,OUTPUT);} // 3=buzzer 4=latch 7=clk 8=data 10-13=leds

digitalWrite(3,HIGH);} // stops the buzzerd from beeping

void loop()

{ long speed = 37500+(1024-analogRead(0))*2; // time counter; changes time-speed for

// differend boards use potmeter on shield

for (byte c=10;c<=13;c++) // leds loop

{ digitalWrite(c,HIGH);} // sets seconds-led [c] to off

For (long a=0;a<=speed;a++) // delay timer

{ if (analogRead(1)==LOW) // reads button1

{ time[1]=time[1]+(!push);push=60;} // adds 1 to hours

If (analogRead(2)==LOW) // reads button2

{ time[2]=time[2]+(!push);push=60;} // adds 10 to minutes

If (analogRead(3)==LOW) // reads button3

{ time[3]=time[3]+(!push);push=60;} // adds 1 to minutes

push=push-(push>0); // down-counter for button-push

if (time[3]>9) {time[3]=0;time[2]=time[2]+1;} // sets minutes + 10 if over 9 and go to 0

if (time[2]>5) {time[2]=0;time[1]=time[1]+1;} // sets hours +1 if over 5 and go to 0

if (time[1]>9) {time[1]=0;time[0]=time[0]+1;} // sets hours + 10 if over 9 and go to 0

if ((time[0]>1)&&(time[1]>3)) {time[1]=0;time[0]=0; // sets hours to 0 if higher than 23

digitalWrite(3,LOW); delay(30);digitalWrite(3,HIGH);} // beeps every hour

for (char b=0;b<=3;b++) // loop for writing 4 digits

{ digitalWrite(4,LOW); // disable outputs

shiftOut(8,7, MSBFIRST,(num[time[b]+10*(b==1)])); // writes number-data

shiftOut(8,7, MSBFIRST,(241+(b==1)+3*(b==2)+7*(b==3))); // writes digit-data

digitalWrite(4,HIGH);} // send data to outputs

digitalWrite(a/(speed/4)+10,LOW);} // sets 15 seconds led

time[3]=time[3]+1;} // adds 1 minute to time

Step 2: The Shield

I can recommend the shield for beginners because it has except the above mentioned functions also various other connectivity options such as blue-tooth, voice recognition, infrared, variable resistor and various other connections for just about everything available for additional options.

The shield I found you can see with the following link:

There are also hundreds of other issues to find, a couple of them I already ordered.

Hopefully the program gives some look on the possibilities that Arduino programming offers and have I helped some people with this search a little further with their hobby.

Writing a program in as few bytes as possible I actually find even more fun than soldering.

Best regards,

Rob van Staalduinen

Step 3: Extra Information

Multi function shield connection pins (for programming):


0 – Pot

1 – Button 1 - jumper2 to -

2 – Button 2 - jumper2 to -

3 – Button 3 - jumper2 to -

4 – LM35 – jumper1 to +

5 – Shield connector 4


00 – Bluethooth

01 – Bluethooth

02 – IR

03 – Buzzer

04 – Display - load / latch

05 – Shield connector 1

06 – Shield connector 2

07 – Display - clk

08 – Display - datain

09 – Shield connector 3

10 – Led 4

11 – Led 3

12 – Led 2

13 – Led 1


sspence (author)2015-08-28

No ds1307? How do you keep time?


Simpel by calculating what time the program needs to work and put this calculation in a loop.

Let it work several times (abouth 39000) and put a minute extra to te array.

If you opens it in full screen you can see my comment.

p.s. there will come a extended version tonight.

Greetings Rob


That's not accurate enough to keep time. You need a RTC.


If I realy want to use it for timekeeping over a long period I am sure I need the RTC, but with an accuraty of 1/4 second a day for me it's enough.

It is to show what you can do with a multi board and how to program it.

Butt .... thanks for the tip.

tomatoskins (author)2015-08-28

This is great! I'd love to see a video of it in action!


See my updated program.

Greetings Rob