I had a UTC controlled clock in my shack. The drawback: It showed Central European Time, as controlled by DCF77, the time transmitter that is controlled by the Physikalisch-Technischen Bundesanstalt (PTB) in Braunschweig, Germany. So, when I made a QSO, I used to look at the analog clock, had to convert the time to digital, substract 1 or 2 hours depending on the summer savings and then I had the time. Of course you can buy a cheap digital clock and set it to UTC, but nothing beats an atomic-clock synchronised digital clock, right?
So I started to google for a digital clock with DCF77 receiver. I found one on the site of micro-examples.com. Based on a PIC16F84 and presenting the time in normal CET, but it included the source code, written in C. It happens that I used to program in C, so that made things easy... I downloaded the MicroC PRO compiler and changed the PIC to the more common 16C628a. The first compiler run showed no errors, so let's try to make the basic clock.
Click HERE for a full blown version.
I used 2N7000 FETs in stead of BC547 transistors that were used in the original circuit diagram. Just because I bought 100 pieces of those once, so I have more FETs than transistors. They do the job just fine.
Something else I changed: in the original design the digital point between hours and minutes was following the DCF77 signal, and the digital point of the Least Significant Minute segment indicated synchronisation to DCF. I changed that to a separate LED, L60. I'll get back to that later.
For the reception of the DCF77 signal I use a module that is provided by Conrad with partnumber 641138. The inverted output of the module is connected to pin 3 of the PIC (not on the schematic diagram).
So I flashed the HEX file into the PIC and soldered the basic components to the PCB. I applied power to the 7805 and it worked immediately:
In this version, the DP of the least significant Minute segment still shows the sync mode. As you can see, it's in sync on the picture. Time to change the software. At first, I did not like the way the 6 and the 9 were represented. Als you can see on the picture, it more looks like a "b" than a "6" and that is soooooo 1960. So I changed the software and added the horizontal bars to the 6 and the 9. The second change to the software was to actually read bit 17 and 18 from the DCF77 protocol. Those bits tell me whether to substract 1 or 2 ours from the time, depending on daylight saving. Of course if the hour is 0, it should go to 23 when substracting 1 and not to -1. In C this is pretty easy to change, so this also worked the first time I tried! It could have ended here, with a nice, cheap, easy to build DCF controlled UTC clock. In fact, this is all you need. But I wanted some eye-candy, to impress shack visitors... So I decided to add a ring of LEDs, counting the seconds until the full ring is lit, and then resetting to all off again.
The easiest way to accomplish that is a shift register. The 74HC595 is a 8-bit latched shift register with master clear and cascading output/input, capable of syncing or sourcing 35mA on the output. More than enough to drive a LED. So I would need a clock pulse, a latch pulse to follow the clock pulse and a master reset pulse. According to the documentation, if you tie the register clock and the latch clock together, the output will always be 1 pulse slow to the input. But that can be resolved in software. So, the only thing I need now is 2 more outputs on the PIC to drive the shift registers.
But there aren't any left... the B-port is fully used to drive the 7 segments and the digital point, and from the A-port 4 lines are used for driving the FETs and 1 is used as input for the DCF pulse. Nothing left... Time for the box of tricks. Let's have a look at the LED driving circuitry:
Click HERE for a full blown version.
The tric is done by using an extra 74HC10 3-input NAND port. The inputs are connected to the same outputs that drive the FETs. During a short time, I set the B-port to 0, and send out 0111 or 1011 on the A-port. That will drive 3 segments at a time, a situation that during displaying the time never occurs. Now, it either generates a Master Reset to the shift registers, or a Clock pulse. Virtually, I added 2 extra outputs to the PIC!
But does it work? I soldered 4 of the 8 shiftregisters on the PCB, added only 8 LEDs just for testing, and gave it a shot:
The idea works! The only thing that bothered me, was the function of LED 0. Or LED 60. It depends how you look at it. Time does not go from HH:MM:59 to HH:MM:60 but to HH:MM:00. That means that at the start of the minute, LED 0 (or 60) should be off. But that means it will always be off. On the other hand, if you count to 60, at the full minute all LEDS are on. One second later, only LED 1 is on. So, LED 1 is always on that way. Either way, there will be 1 LED without a function (always OFF or always ON). So I decided to assign the task of showing the synchronisation status to LED 60. If it is ON, there will be a perfect circle at HH:MM:59. If not in sync, there is a hole in the circle at the top.
In software, I generate a clockpulse every time the second changes. Is the second 0, I generate a Master Reset to the shiftregisters, but also a clockpulse That will load a 1 in the first position of the shift register, but because the register clock and the latch clock are tied together, the latch is 1 pulse behind the register and is not showing the 1 yet. That will happen at the second pulse, at HH:MM:01, thus turning the first LED ON.
I used a piece of 1mm thick single sided PCB from a flea market, and drilled the 60 holes in a circle. The rectangular LED display is in the center. The result:
The picture is taken exactly at the transition from 17:18 to 17:19; all LEDs are ON, and the 7-segment displays are just changing as you can see. I used yellow LEDs every 5 seconds, which gives a nice visual effect. Mission accomplished: a fully DCF-synchronised UTC shack clock with beautiful indication of the seconds!
As of the time of writing this article, we're looking at the possibilities to make a kit of this project, for our radio club. That involves a 20x20cm PCB with all components. So keep an eye on the club website if you're interested! If you want to try it yourself, the HEX code for the PIC16F628a is HERE. The code works for the simple clock and the shift-register addition.