Tick, Tock!

Ornamental Clock Goes Digital

Chris Jared

Issue 67, February 2023

Instead of discarding a defunct ornamental clock, Chris saw an opportunity to make it electronic using some discrete components and his maker know-how.

Turning something analogue into digital is a thrill for most makers. In this fine example, Chris has replaced a broken analogue clock movement with discrete electronics and 60 dual-coloured LEDs to indicate hours and minutes around the perimeter of the clock face. Read on to hear how Chris went about designing and assembling the clock.

Thank you for sending us details about your amazing clock project. Please tell our readers more about yourself.

The first half of my professional career was as an electronics design engineer (hardware and firmware) and latterly as a software engineer specialising in membership databases. I am now retired.

What motivated you to add electronics to the clock?

My Daugther had a large ornamental clock approx 800mm in diameter which was on its last legs.

The clock mechanism, one of those small 1.5volt AA style devices common to most of the cheap clocks today had given up the ghost. The hands had broken off, and even before that, the hands were too small to see unless standing close. Also, the mechanism refused to work when hot (the clock was located on a feature brick fireplace and got warm in winter when the fire was going). I asked her if she would like it upgraded with LED lights at each minute around the rim, and she agreed.

How did you go about doing the upgrade?

From the outset, I decided that to limit battery consumption to a minimum, I would employ a hardware design based on CMOS devices.

These are the specs I started with...

  • All hardware, no software or firmware
  • 60 dual colour LEDs. Green for minutes, red for hours and part thereof (moves every 12 minutes)
  • Battery operated by 4 x AA rechargeables
  • Recharged automatically from a centrally located solar panel
  • Two toggle switches (Run/Set and hours/minutes)
  • Crystal controlled timing
  • All LEDs auto dim to black when the ambient light was such that the clock could not be seen anyway

The spec changed during the project… The ambient light in my daughter’s lounge was insufficient to replace the charge lost during operation, so the solar panel requirement was discarded, and replaced with a 12volt power pack.

Please tell us about the circuitry.

My first challenge was to get a 60 stage shift register effect which would turn on 60 LEDs one at a time in a never-ending loop. Two of these would be needed, one to emulate the minute hand (Green, in one minute steps) and the other the hour hand (Red, in 12 minute steps, 60 for 12 hours).

I decided to base my design around multiple CD4017 chips. After checking out the standard method of cascading these (an example of this was covered in issue 39) I decided to implement my own method to simplify the construction. My design resulted in six ICs all being clocked with the same signal, with the five ICs not in use at any one time being held in reset – more on the reset mechanism later.

Figure 1

Figure 1 shows the 60 minutes (minute 10 to 49 omitted, but identical except for the separate reset lines). The 12 hours circuit (in 12 minute increments) is also identical except for the slower clock rate.

There is a basic flaw in this configuration. When a 4017 is held in reset, The Q0 pin is high which will turn on the LED connected to it. This means that while the “real” minute LED is glowing, the “0” LEDs on the other 5 devices will also be on. I corrected this (Figure 2) by adding an inverter (one-sixth of a CD4069) and a 2 input AND gate (1 quarter of a CD4081) to ensure that the “0” LED could only be on if the device was not in reset.

Figure 2

To optimise the layout largely determined by the structure of the clock frame, I chose to use six identical display PCBs, each driving 10 dual coloured LEDs (red/green), with the remaining circuitry on a single control PCB.

Figure 3

Figure 3 shows the main components of one of the six display boards. Not shown are the 10 x 3 way headers used to connect to the LEDs, the 10 way header used to connect to the control board and a few extra components I’ll come to in a moment.

You will notice that there are no LED drivers shown. That is because I found them unnecessary. With a supply limited to 5 volts, the 4017 outputs are quite capable of driving the LEDs themselves without exceeding the IC specs, bearing in mind that each IC would be driving at most one LED at any one time. The LEDs I used came with a red and green lead, and a common cathode. Each of the 60 common cathodes are connected together, but not directly to ground. Between the cathode bus and ground, I connected a general purpose NPN transistor with the base connected to the +5 supply rail through a light dependent resistor. This effectively turns off the display when the ambient light in the room turns off and the family has gone to bed.

The next task was to generate the reset control signals, 12 in total, in 6 pairs, a pair for each display board. For this, I used another pair of CD4017s. In each case Q0 to Q5 removes the reset from each counter in sequence, allowing the display boards to step through their 10 stages. Q6 of each counter is used to reset the counter, thereby limiting the count to 6.

Figure 4

The next hurdle was to generate all the clock signals.

I needed:

  • One at one minute intervals
  • One at 12 minute intervals
  • One at 10 minute intervals
  • One at 2 hour intervals
  • Two other faster clocks to be used to set the correct time.
Figure 5

For the master clock, I used a CD4060 14 stage ripple counter with a built in oscillator circuit along with a 32.768kHz crystal and associated components wired as shown in Figure 5.

At the Q14 pin, this produced a 2Hz signal. Q4, Q7 and Q14 were made selectable via two toggle switches to the clock input of a series of dividers.

Figure 5a

For the dividing chain, I cascaded a series of CD4018 programmable dividers:

Divide by 10, divide by 6 and then divide by 2 produced the 1 minute clock.

Then another divide by 2 and divide by 6 resulted in the 12 minute clock

This left two further signals to generate. The 10 minute and 2 hour board clock signals shown in Figure 4.

Rather than use additional dividers, I elected to fabricate these signals from the Carry Out pins of each display decade counter using a 6 way diode / resistor OR gate (Figure 6).

Figure 6

Each Carry Out pin goes low for 5 minutes and then high for 5 minutes (on the Minutes ICs – 1 hour each on the hour ICs) producing the required 10 minute and 2 hour signals respectively.

Sometimes I tend to get ahead of myself. At this point, I thought “just apply power and it should burst into life”. And it did!

But then I discovered that I had made a major blunder. I had ended up with two sets of lights, one red, the other green, chasing their tails around the clock face. But the time they were indicating did not make any sense. I had overlooked the fact that the CD4017 chips do not have a power-on-reset function and their startup state is undefined, whereas I had assumed they would all start at zero. Of course, it didn’t matter for the main clock generator / divider chain, and as I was dealing with a 1 minute resolution, the odd second would not matter. But I had to sort out the display synchronisation.

Deciding to cover all my bases, I realised that as well as initialising the two board selection chips shown in Figure 4 so that they both started at zero at power-up, I should also build in a bit of self correction in case things got out of sync.

Figure 7

As the two reset pins were already used to limit the counts to 6 instead of 10, a bit of gating was required. I used a simple resistor/capacitor circuit (not shown) to provide the power-on reset, and applied it to two inputs (pins 2 and 13) of a new quad NAND Schmitt trigger IC. On the 2 hour counter I then ORed in the Q6 output to restore the main reset function.

The 10 minute reset was a little more tricky as I wanted a three way OR. The power-up signal, the one hour reset coming from pin 5 (Q6), and as a bit of extra insurance, when the 2 hour chip got to the end of its cycle (signalling 12 o’clock exactly) I wanted to ensure that the minutes were reset as well. This is done by NAND gate output pin 11 being fed back through a diode OR gate to pin 6.

The power supply came next. I used a 12 volt plug pack and a switchable battery pack holding 4 rechargeable AA batteries. My original intention was to use a small solar panel that I had lying around to do the recharging, but the light available at the location of the clock was not sufficient. I toyed with the idea of buying an infrared spotlight (the kind used in security installations that only switch on at night) to illuminate the solar panel to charge the battery, but I thought that was a bit over the top.

Figure 8

The power supply starts with a bridge rectifier and smoothing capacitor to allow for AC or either polarity DC. This feeds an LM317 adjustable voltage regulator. R1 and R2 set the output voltage to just under 8 volts. D4, a 2.5v voltage reference IC provides a reference for the comparator, a CA3130 BiMos Op-Amp Linear IC which operates well from a single low voltage supply.

There is a voltage divider across the battery output (R12, R13) which feeds to the negative input pin of the Op-Amp. Hysteresis is provided by R3 and R15 which sets the upper and lower limit of the charger.

With the values chosen, the battery begins charging when the battery voltage falls to around 4.2 volts (1.05 volts per cell) and stops when the battery voltage gets to around 5 volts (1.25 volts per cell). R9 limits the charge current when the charger is in use. The output of the Op-Amp drives the LED input of the Solid State Relay which connects and disconnects the charger to the battery.

Can you tell us how you designed and sourced the PCBs?

I used the free Autodesk Eagle 9.6.2 CAD package to draw the circuit and then their built-in AutoRouter to layout the PCB. The free version has limitations on the size of each PCB which was another reason for breaking up the functionality across multiple boards.

Once laid out, I got the boards manufactured in the USA by an outfit that caters for cheap prototype quantities of what they call “bare bones” product (double sided, plated through holes, but no odd shaped boards, cut outs, mounting holes, solder mask or screen printing). Pricing was acceptable, but the freight costs were eye-watering.

Was it easy to put it all together?

The project was treated as a one-off. There was no consideration of ever making another, or aiming towards commercial production. So what you see in the circuit diagrams has all the latest fixes applied that didn’t make it to the original PCB design. In my implementation, there are cuts and hacks and the power supply board has been split out making a board count of 8. All of the external connections on each board employed right angled pin headers, hand soldered to flat cable.

I bought 2 metres of 50 way cable, which was stripped into 3 way cables for connection to each LED pair and 19 way cables between the control board and each of the six display boards. Because the pin headers were pitched at twice the spacing of the cable cores I left a spare core between each of the 10 active conductors to improve the tidiness.

Chris Jared

Retired Hardware & Software Engineer