The picture above shows the inside of my clock.
Click on the picture for a hi-res version.
I'm amazed that I always seem to be able to fill the entire board space in my projects.
The download package also contains a hi-res picture of the inside of the clock with some labels on it. There you can see which parts are which.
Here's the story of the challenges I've faced during and after building the clock. Be prepared that a new electronic circuit hardly ever works without any problems. Neither did this clock.
At first I'd built and tested the circuit a block at a time.
I started with the button inputs, which could easily be tested.
This circuit is so simple that I didn't expect any difficulties there.
Then came the time base, which eventually generated a 1Hz signal. This is also quite easy to check. No problems were found there either. Adjusting the frequency to exactly 32768.00Hz was relatively easy.
The seconds counter was built next and was also easily checked. But then came the minutes counter. I had no display yet and I didn't want to bother connecting a logic analyzer to the counters to see if they were operating properly. That's when I decided to go ahead and build everything, including the display, in one go, without intermediate testing. There's only one down side to this approach. I'm bound to make errors, and I can't correct them until I'm completely done. And probably, by the laws of Murphy, there will be lots of errors.
And Murphy was right again. All sorts of weird and wonderful things were happening. The display lit up, but was flickering like crazy. There were digits, but the clock was far from telling the time to me.
The first error I encountered was a bit of a silly one really.
I had hooked up a current meter in series with the power supply, as my power supply can't measure the low currents required by the CMOS circuitry.
And at first there were only 4 chips connected.
The current was well below 1mA then, so the meter's range was set to the 2mA range.
But now, with the display connected the current was somewhere around 130mA. This caused an enormous voltage drop over the high shunt resistor of my multimeter. Therefore the supply voltage had a huge ripple on it. The power supply circuit hadn't been fitted yet, so there was hardly any capacity available to smooth the power to the CMOS circuits.
The fault was quickly found when I put my scope probe on the power rails. Surely my power supply didn't output such a dirty voltage! The culprit was soon identified.
Once I've fixed the current meter's range I noticed that the display was still flickering.
I've measured the display scan rate, to make sure if it was 32Hz, as it should be by design.
And it was.
I thought that frequencies above some 18Hz couldn't be seen by the human eye anymore.
That's why film is usually shot at a 24 frames per seconds rate.
So my 32Hz rate should be OK.
Apparently it wasn't. Perhaps it's caused by the 1:4 duty cycle of the scanning. Anyway, I decided to double the scan rate to 64Hz, which did the job quite nicely. This was easily done by using the 128Hz and 64Hz signals of the time base pre-scaler, instead of the 64Hz and 32Hz signals which I first used.
With a nice and stable display I was now able to test the rest of the circuit. But why can't I advance the minutes counter? It appeared that I have been nurturing a dead counter IC for over 30 years. After replacing it with another one the minutes counter could be advanced.
But what's this? The minutes digits were swapped. Apparently I had mixed up the anode wires for the minutes displays. You might expect the circuit diagram to be faulty, because the minutes display is upside down in order to create a colon. But no, it was simply my wiring error.
I could only set the hours when the clock was in RUN mode. Obviously this is a wiring error. I had connected pin 13 of IC9D to SET instead of the SET net, silly me.
With that fixed I noticed that the minutes counter was behaving strangely.
It counted up nicely from 0 to 7, but once it got to 8 it rapidly advanced and was reset back to 00 again.
From then on I could count up to 7, and at 8 it repeated counting up and was reset again.
The hours counter did something similar. Not quite the same, but as soon as the LSD of the hours showed 8 or 9 the MSD of the hours would quickly count up, resulting a very nervous left digit.
This one was a tough one to find. It had something to do with the MIN3 and HR3 lines being high, that's for sure. But the MSD of the minutes or hours shouldn't advance until that signal goes low again. Pin 9 of the minutes and hours counters is connected to ground. I didn't expect any problems there. And the voltage on pin 10 of the dual counter was high when MIN3 or HR3 is high, but there was some garbage on that voltage. Ah, that could be caused by current spikes due to the display scanning. I hadn't built the power supply part yet, and the anode voltage was still the same as the logic voltage. Let's build the power supply first then.
Alas, that wasn't the cause.
The supply voltage is nicely flat now, so I can't imagine that to be the cause of the problem.
I examined the high signal on pin of the hours counter a bit more closely now.
And it appeared there was a small short dip on that signal when the signal was high.
OK, that's what is happening.
A 128Hz signal on that line will indeed advance the counter.
In the case of the minutes counter this will cause the counter to count to 68 and then reset back to 0 again.
Yes, it will count to 68, because the LSD is not affected and remains 8.
The MSD will count up until the reset condition is reached (at 6).
I disconnected some signals, one by one, and when I disconnected the input to the demultiplexer IC12 the problem disappeared. Obviously I got some unintended feedback from the multiplexer. I've tried several solutions. A pull up resistor on pin 10 of the counter IC did the trick, but that would mean an increased power consumption. A small capacitor to ground didn't solve the problem. Swapping IC11 and IC12 didn't solve it either.
Eventually I found the solution. I replaced IC12 with a chip of a different brand and.... problem solved. Obviously the MSM4052 from OKI isn't very good. Now I'm using a Fairchild MB84052, with no more problems. I left the other 2 multiplexers the way they were. Even though they are both OKI brand, they don't do any harm there.
At least, that was what I thought. When I left my clock running for 24 hours for the first time I noticed that it suddenly was exactly 2 hours ahead. While experimenting with setting the time to various values I came across many weird and wonderful time jumps. As long as the hours counter is 22 or 23, the minute counter would jump from one value to a completely different value while increasing the minutes counter. Another funny and repeatable effect was when the minutes were set to 47, increasing the hours from 21 to 22 would result in the minutes to jump to 48 or 08. I certainly didn't build any circuit which would do that deliberately. In plain CMOS this would be a hell of a job if you had to. Without any further investigation about why these strange jumps occurred I immediately suspected IC11 to suffer from the same problem as IC12 did. So I also replaced that one with a Fairchild device and the problem was solved.
The MSD of the hours counter behaved a bit strangely now.
When it should show 10 or 11, it showed 00 or 01.
12 and 13 were OK again.
But 14 and 15 showed as 04 and 05 again.
There were 2 pairs good, and 2 pairs wrong, all the way to 23, which showed as 33.
Obviously another wiring error. I had connected the HR4 signal to pin 4 of the counter IC, instead of the HR4 net, stupid mistake. It should be on pin 11.
While I fixed this I noticed that I hadn't connected pin 2 of the hours counter IC at all.
That pin should be connected to the +5V.
I can remember deliberately not connecting this pin until the last moment, as I wanted to abuse this wire to sort of fix the wires which are running across it.
But in the end I simply forgot to put it in.
And now the clock appears to be working flawlessly.
Not bad for this first prototype.
What am I talking about, I don't intend to build any more.
Trouble shooting the clock was great fun I think.
There's so much to learn from trouble shooting.
It took me about 2 or 3 hours to iron out all the faults, time well spent I'm sure.
What it comes down to is that there was only one small design issue. The display scan frequency was too low. Furthermore I had 3 ICs which caused some trouble, one was completely dead, the others introduced some unwanted signals. And the rest were simply more or less stupid wiring mistakes I made myself.
At first I had intended to use a power good signal to enable the display driver. That would probably reduce the load on the outputs of the display demultiplexer, giving me a longer standby time. However it appeared to be only a marginal difference in power consumption, if any. Therefore I decided not to bother about disabling the display decoder any more. Now the INH pin of IC13 is permanently tied to ground.
With the display on, the circuit draws a maximum of some 160mA, when most of the segments are lit.
This is some 800mW max, not bad for an LED display clock.
When I disconnect the power supply, the clock continues to run on the voltage stored in its gold cap.
Even this gold cap hasn't got enough storage capacity to allow the display to keep running, so when the power is removed the display is disabled.
How much current is drawn when the display is off? This can easily be calculated by measuring the voltage drop across R25, which is about 3.2mV in my case. Ohm's law shows us that this is equivalent to 32µA.
I've turned the power off and hooked up my scope to the 32.678kHz test point TP1 to see how long it would keep running.
After 1 hour the peak/peak signal of the signal had dropped to about 3.1V.
That's when I reconnected the power again to check whether the time was still correct.
And it was indeed.
So the clock will continue running for at least one hour without power. That is more than enough for me, as I intent to keep it running 24/7 anyway.