The Logical (song) Clock


Anyone who has looked at my profile would know I like clocks, having published a couple of my creations.
The idea behind this one is a circular clock to emulate an analogue one using LEDs
No micro processor.
TTL was the new thing when I was in my last year at school that was in 1972, and it was then that I built my first clock with it, together with nixie tubes. This one uses variations of that original TTL family. Circular to resemble an analogue clock with seconds, minutes, hours.
Ease of Build.
From that I mean no SMD, although there is a proviso to that mentioned later. Also when I say ease of build that does not mean quick but no SMD. Yes I know SMD devices are not impossible to use but I'm old school.. There are over 240 components and over 820 soldering points.
No exotic or expensive components
The title is a take from a song by Supertramp in 1979 but there is no audio from this clock. I was also pondering on calling it the Analogical Clock.
Presentation
The components and circuit board were to be visible as a demonstration of working electronics.
I will be going through my thought processes so you get an idea about how I approach a project. I suggest you do not need any specialist tools. A decent soldering iron with a fine tip. 0.7mm solder. I still use 60/40 lead solder. Long nose pliers and side cutters. An oscilloscope is useful but not necessary however you will need a multi meter/voltmeter.
This still a 'work in progress'. The clock is finished and working but could be better. This article could also be better but I am publishing it and welcome suggestions about any shortcomings and how it can be improved,
Supplies
74HC00 2 input NAND x 1
74HC04 hex inverter x 3 *
74HC153 data selector x 1
74HC164 8bit bit shift register x18
CD4013D D flipflop x 1
CD4060 Ripple counter x 1
ICL7673 Battery backup switch x 1
IRF9024 MOSFET x 2
1N914 diode x 3
5mm LED x 120
5mm bi colour LED x 12
Buck/boost module x 1 (see picture)
LiPo charger module x 1 (see picture)
Cap ceramic 12.5pF x 1
Cap ceramic 22pf x 1
Cap ceramic 100nF see text
Cap variable 10pF see text
Electrolytic capacitor see text
Electrolytic capacitor 470uF x 1
Resistor 10M x 1
Resistor 150K x 1
Resistor 10K x 2
Resistor 47K x 8
Resistor 100K x 1
Resistor 220K x1
Resistor 330K x 1
Resistor 470R x14
Resistor 580R x 12
Switch tactile x 2
Switch slide x 2
Crystal 32.768kHz x 1
DIP socket 8 pin x 1
DIP socket 14 pin x 23
DIP socket 16 pin x 2
LiPo battery 3.7v x 1
PCB x 1
- This may be replaced with 74HC14 a Schmitt trigger input inverter
The components 'see text'. I am not 100% happy with the timing and power on reset so these are still being refined. I will update when I am happy
Shock horror for some. Nearly all the components were sourced from AliExress. I have not received any freebies or discount from AliExpress. I only mention them as a source of components I often use. Some components were sauced from CPC Farnell 'Other suppliers are available'. I would suggest that the 32.768Khz crystal and the load capacitors be quality components.
Disclaimer
This project, design Gerber files and finished board is offered 'As Is'. The clock works as described but I cannot take responsibility for anyone else's build or any errors in this published project. Everything is presented in good faith. I will help out as much as I can should anyone build it and has a problem. Updates are posted when anything of fair significance is changed or added, see the section 'Updates' for list.
Circuit Principles
A simple power input independent of mains frequency.
The clock circuit principle is not my own idea, I got my inspiration from an article '72 LED clock'. However I extended it to include seconds. Elektor magazine is also useful. My formal education, 27 years work as an electronics engineer in a broadcast TV station and my 71 years of life experience helped as well.
The time base is standard.
Time setting is by fast forward/stop, keeping things simple
Logic chips, either 74HCxxx or CDxxx, 1 IC that may be a bit unfamiliar, a couple of MOSFETs, a lot of LEDs and a good sprinkling of capacitors some resistors and a couple of modules to avoid reinventing the wheel..
.
Project Blocks
Lets break the project down into blocks and look at how it works.
The power supply
Timebase
Clock Logic
Power on reset
Adjust
The PSU



The idea was to use a standard mobile phone charger as these are easily available, even tucked away in a draw, and a micro or C USB type cable. The power supply also needs to be battery backed so that in the event of a brownout, a short disruption of power, the clock continues to keep time. I decided to use a li-ion battery, I already had a battery that is used in a games controller. This battery is given as 3.65v and a capacity of 3000mAh and when tested on the clock, ran it in excess of 13 hours. This battery was perfect as it is slim and would fit on the back of the board with self adhesive hook and loop tape. However any 3.7v would be fine. Looking around there is a nice module which has a micro, or C USB socket at its input and charges a single cell. It also has a separate load output. All very good except 2 things. The li-ion cell is only 4.2v maximum and we need 5v to power the logic and also you cannot charge the battery and have a load at the same time.
There is plenty on the net about overcoming the charge/load problem so I wont go into that. However contrary to the usual described way of overcoming the limitations I used a source selector IC, ICL7673
The battery backup IC is only capable of delivering about 30mA at its outputs but the couple of p-channel MOSFETs handle the power requirements. These status outputs, which go low according to which of the 2 inputs has the highest voltage on them are used.to select 1 of 2 MOSFETs The MOSFETs are fed with either the incoming 5v USB or the battery. Thus the selector IC8 is fed with USB supply or battery and switches the appropriate MOSFET on. The drains of the MOSFETs are connected together and feed the boost module which sets the voltage at 5v to power the rest of the circuit. When I ordered the boost module I ordered the wrong one and received a buck/boost version. Hence I had to design the PCB accordingly. However there is also provision for the one I intended to use.
2 switches are included so that all power can be removed from the circuit and also the battery can be disconnected. I did say no SMD. One component, ICL7673, is getting harder to find as through hole. However it is available as a 8-pin SOIC. It would be possible to use the SMD with a breakout board.
Timebase

As this is a clock, it needs a time base and there were various options to chose. I have to keep in mind the original concept. No microprocessor or programming
Mains frequency. Although at any particular time the mains frequency may be out a bit, over a period of time its accurate enough. However there are 2 main frequencies around the world, 60Hz and 50Hz so circuitry would have to cope with both. Plus in the event of loss of power at the very least all that could be arranged would be the clock would stop and at least not lose the time completely. However, once power has been restored the clock would be slow.
Then there is the good old 555 timer. Not particularly accurate.
Crystal and divider circuit had an attraction. Well proven circuit. Standard components. Also looking to another part of the clock, lends to supplying various frequencies in order to set the time.
As the circuit shows this is a standard CD4060 with a 32.768KHz crystal and load capacitors etc. This type of oscillator has been described elsewhere many times 3 frequencies are taken from the chip, 2 4 and 64Hz. When layout out the PCB the footprint of the trimmer capacitor was designed so that it would take a 2 pin trimmer or 3 pin. Not an ideal layout. If you use a 3 pin you should either trim one of the stator pins or bend it out of the way
The 2 Hz is fed into a CD4013 to further divide down to 1 Hz and then fed to the data selector, 74HC153. Also fed to the data selector is 4Hz and 64Hz
Clock Logic

The principle of the clock is that a '1' is put in a shift register 60 bits long made up of 8 x 74HC164 ICs. This 1 is shifted at a rate of 1Hz until 60 is reached when it is returned to the start. Also this increments another 60 bit shift register, which has also been loaded with 1 bit. This again shifts 60 times and returns to the beginning and also then shifts a 3rd shift register which as only 12 bits until it is returned to the beginning. Hence the first register counts up to 60 (seconds) and pushes the next one ( minutes) When it completes it pushes the next register (hours). The minutes register, when it completes shifts the hours register and so it continues. That's a 12 hour clock.
The outputs of the shift registers drive LEDs arranged so as to form the clock. The cathodes are all connected together for each bank of registers as only 1 LED is ever lit at a time. The exception is the hours register. The outputs are fed both to an inverter,74HC04,and a led. Because of this arrangement each led has its own load resistor. The direct connection is fed to one colour of the bi colour led, the inverted output to the other half of the bi led. Like this all the hours LEDs are lit, except the one displaying the actual hour changes colour.
Power on Reset

As already described, a 1 is loaded into the 2 long shift registers, this has to be arranged. Also the shift registers have to be reset on power on to ensure that only this 1 is present.
A 0 is applied to all the shift registers on pin 9. At the same time also a NAND gate stops clock transitions on pin 8. Also a 1 is put on the data pins at pin 1. At the end of the reset a high clock pulse is applied to pin 8 that loads the 1. Note that the timing is carried out with a RC timing circuit presented at the input of a inverter. This turns the analogue voltage decay or building to a digital 1 or 0
When power is applied, a single "1" bit is loaded into the first stage of both the minutes and hours registers. To accomplish this, a momentary low reset signal is sent to all the registers (at pin 9) and also a NAND gate to lock out any clock transitions at pin 8 of the minutes registers. At the same time, a high level is applied to the data input lines of both minutes and hours registers at pin 1. A single positive going clock pulse (at pin 8) is generated at the end of the reset signal which loads a high level into the first stage of the minutes register. The rising edge of first stage output at pin 3 advances the hours (at pin 8) and a single bit is also loaded into the hours register.
Reset and Adjust
We have already looked at how the clock works by way of shifting a '1' at 1 Hz. However, the shift registers are actually fed from a data selector IC, the 74HC153 already mentioned. This has 4 inputs, being fed with nothing, 1 Hz pulse, 4 Hz pulse and 64 Hz pulse. The output is determined by how 2 select inputs are set. So default 0 0 is 1Hz. 0 1 nothing or stop the clock. 1 0 4Hz and 1 1 64 Hz
From pushing the appropriate button you can stop the clock or run it at different speeds. The push buttons are not debounced which can lead to the odd jump of the LEDs. however I thought that the added components and taking into consideration of space, I would put up with this. It does not happen much
Proof of Concept

Having decided what I wanted to do, the next step was seeing if it would work.
A scaled down version of the clock was built on breadboard. This checked to see if the power supply and battery backup wold work. The logic was also checked as was the way to adjust the time.
As it wold be horrendously complex to build the complete clock like that only 2 stages were semi built. All worked but what I did find was breadboard is not king to logic circuits and any knock could disconnect a wire for only a very brief time and all failed. I even put the 'partial clock' in the greenhouse where I know ir would not be disturbed to check it.
All was well so on to the complete design using the schematic part of the PCB layout software.
Printed Circuit Board (PCB)



After proving the concept on a bread board the next step is the printed circuit board.
I use DesignSpark PCB. This is free, unlimited, updated, has a very helpful community forum and can produce industry Gerber files. All the pictures of the schematic and board layout are screen shots from the software. I chose to have a black background when I am designing. I have found how to turn my schematics into a pdf and now attach the whole schematic of the clock.
After drawing the schematic, having to create a couple of components and modules from scratch as they were not in the library, with just a few more clicks and the PCB layout is produced. At first this is very basic but after a while things start to take shape. I laid out the components so as to resemble a clock, circular. also placing the components so they look good. Then auto route. This routing is not perfect, some air wires failed to route. This was solved manually. The software does make a few rather strange routing decisions which again were manually corrected. As I like things to look pleasing to the eye some routes were adjusted to look good. I am not an expert at PCB design so the whole process did take a while and I am sure those with experience could make a better job than myself. When all was to my satisfaction the Gerber files were produced and zipped up ready to be sent to the fabricators. I have to say, this all took quite a while.
I do wish I could use a local company to produce the boards but the cost is way too prohibitive so its down to a Chinese company and in my case JLCPCB. I have used them quite a few times and have always been satisfied. Fast and low cost with quality that matches what I produce. I chose a standard green with while silk screen. There are various options you can chose according to your tastes. The board is 24cm x 24cm
Note that I have not received any payment or discounts from RS who supply DesignSpark PCB or JLCPCB and obviously if your want to make this clock you can use your own favourite software and fabricator.
I am offering boards, unpopulated, for sale. This is not a commercial venture so they are offered to cover all costs only. Boards will only be sent to the UK as I do not want to get involved with taxes, export forms etc. Please drop a message for further details.
Downloads
Arrival - Yet Another Nod, This Time to a TV Series the Prisoner



It's always exciting to get a package, especially PCBs as they are my creation and there is a fascination that a massive factory has made something for me, thousands of miles away. As a complete coincidence the package from AliExpress came in the same day!
The first job was to make sure every thing would fit. I had to define the PCB footprint for some items, switches, modules. The first error. The holes in the pads for the switched were too small. A bit of filing will be needed. Plus the spacing for the holes of the bi colour LEDs need adjusting. Any changes have been made to the pcb design in case I order more boards
The Build


I did not put all the components on the PCB at once, but built in stages as far as possible. I say this because some parts of the circuit relies on other parts so it might nor act correctly until it is fully completed. Firstly the power supply. The LiPo charger module is placed on the back so as to avoid a trailing cable on the front. In hind sight I could have placed it in one corner on the front. It has to be spaced off the board to allow for the thickness of the cable. The battery was not connected but the remaining circuitry was. Once switched on the output volts of the buck/boost module was set at 5v.
The the oscillator was built and checked working. An oscilloscope is handy here but a voltmeter on pin 3 will flicker showing all is ok. Then the further divider CD4013 was checked at pin 1
From there on its the power on reset ICs and components and the first shift register and 8 LEDs. If all goes well I then added each shift register and 8 LEDs checking in turn and so on until all installed and checked working.
The battery was then attached on the back of the PCB with self adhesive hook and loop tape.
However, see the section 'Adjustments and Alterations'.
Adjustments and Alterations

This is about problems found 'along the way;.
It was found that every time the hour LED shifted after 12 hours, it double triggered and 2 LEDs lit. The next 12 hours 3 LEDs lit and so on. This was cured by adding a 100nF ceramic capacitor from pin 1 of the to pin 7 of the 74HC164. This has not been altered on the schematic as this would result in a mismatch between the schematic and PCB. I had no intention of altering the PCB as that would involve a big routing change and have already spent a lot of hours getting this far.
The power on reset was unreliable so more thought needs to be put into that.
The clock was found to be running fast and that did cause a lot of head scratching as as far as I was concerned the circuit was fairly standard. The 2 resistors were lowered, no change. The crystal changed, no change. This has now been corrected. See 'Updates'.
And Finally.........
The completed board was powered up and the time adjusted and left to see if it was stable.
At present I have not found a way to send a video of the clock working to my computer because of the restrictions of the size of file allowed on my emails. Im working on this.
The End... Almost
You can now see how my mind works. I have something I want to do. Define the objectives. Plan, test. Produce. De-bug and finish.. The end result may be quite complex but if broken down into sections it becomes manageable,
Case
The cost of build, which component wise not too bad, although the PCB did cost a fair bit, increased considerably by carriage costs from China. I did invest a considerable number of hours during initial design, building testing etc. Thus I felt there was a bit of value in the end result. It would be a pity to waste all this investment by skimping on a case.
I went to a local picture framer and came up with a frame. Some time was spent on deciding the moulding, but also the glass. There were 3 options. Plain, anti reflection, ultra clear anti refection. Plain was quite good. The LEDs were not diffused and you could see the components fairly well. Diffused was no good. The LEDs were diffused and you could not see the components. The ultra clear anti reflective glass was perfect. You would never know there was glass there, The problem was this glass cost 8 times that of plain glass. The decision was made to go with the ultra clear glass which resulted in a cost of just under £90 in total.
The power is supplied via a USB cable so a hole had to be cut in the case to let the cable though. A short extension cable was used in the clock itself with just the end exiting from the case, In that way you can decide how long a USB cable to the power supply you need. (because of financial restrictions, this stage has yet to be done).
Updates
12th October 2025
The problem with the clock running fast caused some head scratching. Its a standard circuit. Even went so far as to clean the flux from the components that formed the oscillator. Ordered new crystal and capacitors from a different reliable source, all to no avail. I the decided to knock the oscillator way out by doubling one of the load capacitor. Contrary to expectations the clock now runs perfectly. At present I cannot explain this. The component values have been changed in the schematic. You might find, according to the particular crystal you use, that the load capacitors may have to be adjusted.
14th October 2025
Due to financial constraints a temporary frame purchased
15th October 2025
Some spelling errors in the article have been corrected.
17th October 2025
pdf of schematic added to step 10. Length of time the battery would run clock added to step 4.
19th October 2025
Disclaimer step 1 added. Boards for sale mentioned step 10. The footprint of component Vcap1 has been changed to accommodate both 2 pin and 3 pin trimmer capacitors. This was documented in step 5. Gerber files produced
20th October 2025
An error was found in the description of the time base, step 5, which was also carried over to step 8