Introduction: Arduino Controlled DCF77 Synchronized Astronomical Regulator Master Clock

This Instructable shows how to add/build Arduino controlled DCF77 synchronization to a home built Regulator Clock using modified quartz movements see fig 1. See the original Instructable here for the slave/stand alone clock.

This design can be adapted to control any type of quartz clock including many additional slave clocks and uses a 2.2" TFT display on the main control board. Detailed instructions are included on how to modify UTS quartz clock movements (should work on most other quartz movements as well) so they can be controlled by an Arduino or any other Microprocessor.

fig. 2 the main control board and Peter Hillyer's TFT code working on a 2.2" TFT display

The Arduino decodes the DCF77 time signal from Germany using Udo Klein's DCF77 library v3 but using the appropriate library and some modification to the code should be able to use any world wide radio time code.

The Arduino Code is based on my Master Clock code and has been completely re-written for Udo Klein's V3 library by Peter Hillyer. Peter has also added code for a 2.2" TFT SPI display, auto summer winter correction of the Lavet type stepping motors for the hours/minutes and sound via a JQ6500 sound module controlled over the serial port.

Step 1: What It Does


DCF77 Synchronized time Uses Udo Klein's DCF77 v3 library

Full Westminster Chime and hours Chimes can be Off, always On & Timed

Manual control of volume

Automatic correction of Summer & Winter Time (manually triggered)

Hours, Minutes and Seconds displayed on Lavet type stepper motors

Clock and DCF77 status monitored on internal 2.2" SPI TFT display

Batt backup from 3 1.5v Alkaline AA batteries

Separate 30second slave/sync output

TFT display is automatically turned off when the clock case is shut to save power

Can be used as a Master Clock to drive all the clocks in your house/office

Step 2: Case & Dial Design

About Regulator Clocks

Regulator Clocks had unusual dials, with a large minute hand and smaller seconds and hour hands and were used in observatories around the world. This dial layout is designed to minimise mistakes when reading the time. Original versions of these clocks were very accurate are relatively rare and often expensive.

Dial Designs

The dials on these clocks all seem to have different designs with some starting at 0 or ending in 60, some with roman numerals and some with Arabic numerals or a mixture of both.

Dial Examples

Dial 1

Dial 2

Dial 3

I chose my favourite parts from each dial type (Arabic minutes ending on 60, Arabic seconds ending on 60 and Arabic 24 hour ending in 24 see fig.1.

My preferred layout was then drawn up in TurboCAD. Any other vectored drawing package can be used.


The case was from an old English School Dial Clock with the dial measuring 12" across. The clock has a large back box that is used to house the main board, TFT display and controls. The old dark stained case has been stripped back and bleached to remove the rosewood stain and lighten it several shades see fig. 2.

Step 3: Case

The case was from an old English School Dial Clock and was obtained from Ebay with the original dial in place. The brass bezel was missing and was purchased from a clock makers supply store again on Ebay.

The old dark stained case (fig. 1) has been stripped back and bleached to remove the rosewood stain and lighten it several shades (fig. 2).

To Bleach wood see this Instructable on How to Bleach Wood .

The original dial was rubbed down to remove all the old numbers. I then re-sprayed it off white to make the dial look old. A white dial on an old clock case looks out of place.

The case holds the 12" dial under a brass bezel. Four wooden pegs hold the dial surround to the back box. I have removed two of these pegs and replaced them with a pair of hinges (fig. 6) to allow easy access to the circuit board.

A side door is used to access some of the clock controls fig. 7.

Step 4: Dial Construction

fig.1 The dial has been designed and drawn up using a Cad package and printed onto inkjet transfer paper.

The designs is then applied to the off white painted dial blank.

Dial Drawing
You will have to make your own dial and the easiest way is to design it on a CAD program. A 12" dial will fit nicely on A3 paper so you may have to take it to a printer if you don't have access to one. You can print the dial in 2 halves on A4 paper and then join them together.

I print out a few designs on plain paper and try them out on the clock to see which I prefer.

There are probably many ways to draw dials and many different types of software to draw it.

I use TurboCAD and I start with the minute ring starting from a point in the middle of the dial. First draw a circle the actual size of the dial. This is your cutting guide for the finished dial. Then draw 2 circles centered on the middle point of the dial. These form the inner and outer edge of the minute dial ring. see fig. 2

fig. 3 Starting at the top of the dial draw a vertical line from the inner and outer minute ring. Select this line and then using "radial copy" copy this line 60 times with a 6° step angle (360°/60=6°).

fig. 4 The minute numbers are then added.
Choose the font and the size of numbers you require then draw a circle as before but add half the size of the numbers and a few millimeters to allow for the space between the numbers and the minute dial. You will now have the minute dial and a circle around it. Add a cross to the top of this circle. The radial copy as before with 12 copies with a step angle of 30° (360°/12=30°). You should now have the circle with 12 points for your 5 minute intervals marked out. Starting with the number 12 and selecting it's middle point place it on the top cross. Do the same with the number 5 but rotate it by 30°, the number 10 rotated by 60°, the number 15 rotated by 90° until you get to the number 55 rotated by 330°.

fig.5 Draw center points for seconds and hour dials and using the same technique you used for the minute dial draw the seconds and hour dials.
Draw dial labels as required. These can be anything you want. Often these included the makers name and city/town of manufacture. Delete all guide lines and points but leave in the 3 center points as these will be used on a paper print as a template for the dial spindle holes.

The paper template is fitted over the dial and the 3 center points are marked with a centre punch or nail and hammer. Pilot holes are drilled and then these positions are also marked on the movement mounting bar see the section "mounting the quartz movements". Increase the drill size in steps until the final spindle hole size is reached on the dial and movement mounting bar.
The final design is then printed out on A3 Lazertran inkjet paper as a giant decal. The centre points will allow you to position the clear decal over the three spindle holes.

The dial decal is then applied to the blank dial and then when dry 3 coats of acrylic varnish are sprayed over the top. This makes the decal background go clear so the off white dial can be seen with the dial lettering on top. See the instructions that come with the Lazertran paper for full details.

Step 5: Modifying the Quartz Movements

U.T.S. Quartz Clock Movement Hack

I use U.T.S. movements fig. 1 in most of my clocks as they are good quality, have a secure minute hand fixing and are available in high torque models for large hands. The minute hand of this clock uses a high torque movement (blue adjustment wheel) while the hour and second hand use standard movements (black adjustment wheel).

If you don't have U.T.S. movements then you should be able to find a way of modifying it as they are all very similar. The only ones you can't use are the "silent" movements with sweep second hands as they don't rely on a 1 second pulse to drive them.

Carefully prise the movement apart by sliding a thin screwdriver down the slots visible on the top and bottom of the case in fig.2 and release the locking tabs.

Fig. 3 remove the top and bottom case sections.

Fig. 4 The quartz PCB and motor section can then be lifted out as 1 part leaving the empty case and battery holder section. Pull the battery terminal out and discard.

Fig. 5 The quartz PCB and motor section removed in the previous step can now be modified.

Fig 6 Cut the track from the integrated circuit (the black blob) to one of the drive coils with a sharp knife.

Solder wires to the drive coils and feed them out into the empty battery bay.

Fig. 7 Using a small piece of vero board 19 holes x 4 strips make the quartz motor drive interface circuit.

The circuit has protection zener diodes x2 @ 8.3v, a 10K preset resistor to set the Lavett motor drive current, an On/Off switch and a pair of PCP connectors to connect the circuit to the drive output from the Arduino circuit board.

Fig. 8 shows the rear of the Vero board and the position of cut tracks.

Fig. 9 finally solder the wires from the motor coils to the Vero Board and snap the case back together. Glue the Vero Board in place with a couple of dabs of hot melt glue.

Step 6: Testing the Modified Movement

The movements in quartz clocks are actually Lavet type stepping motors.

The motor requires a very low current to drive it and can be driven direct from the Arduino or logic gate output via a trimmer resistor. The resistor is used to adjust the current to the motor so it works without being over driven. The motor is driven by reversing the polarity to the drive coil which causes the permanent magnet toothed rotor (in red below) to turn 180°. The toothed rotor will continue to turn in the same direction each time the drive motor polarity is reversed. 2 output pins from a logic gate are used to pulse the drive motor with 1 pin always the opposite to the other.

To test the modified movement turn the switch on the movement to on and momentarily connect a 1.5v battery across the clock pulse pins alternating the polarity. The movement should step each time the battery connection is reversed. Note you may have to adjust the the trimmer resistor down to get the movement to step.

Step 7: Mounting the Movements, Boards & Modules

The movements are mounted by their spindle fixing nuts on a metal bar. The metal bar is screwed to the back of the wooden dial surround.

The dial is fixed to the front of the wooden dial surround with tiny wood screws. The spindles of the clock movements protrude through the dial. The fixing nuts can't be seen once the dial is mounted. A brass hinged dial bezel is fixed around the dial.

The wooden dial surround is fixed to the wooden back box using hinges so it can be opened to allow access to the circuit boards and clock movements.

The circuit boards, speaker and battery backup batteries (if required) are all fixed to the backboard of the clock.

Step 8: TFT Display

TFT Module

fig.2 shows the full range of information on the display over a minute.

fig. 1 shows the front of the display module

fig. 3 shows the rear of the module.

The 2.2" LCD in the TFT01 is a IL19341 and has a 240 * 320 resolution.


Pins SDO: Serial clock output

LED: 3.4V Power Supply pin

SCL: Serial clock input

SDA / SDI: Serial data input

DC: Data / Command selection

RST: Reset, Low level active

CS: Chip Selection, Low level active

GND: Ground

VDD33: 3.3V Power Supply pin

A level converter is used between the Arduino and some of the TFT display pins as they require 3.3v. See schematic for details.

The display is split into 5 sections.

The first shows the current decoded time and date from the DCF77 transmitter

The 2nd row shows the following information: Makers name and S/W version Time first synchronised. This will show you the length of time the clock has been running. Quartz accuracy and Quartz frequency. The quartz crystal is only used when the DCF77 signal is lost and while the clock is in sync the quartz crystal in continuously "tuned" to the highly accurate DF77 signal. This row will show the actual "tuned" frequency of the quartz crystal along with the accuracy in Htz with 1Htz being the best. Seconds lost or gained. This will show the number of times the clock has been out of sync with the DCF77 clock and auto corrected for more and less than 1 second. This is useful if the clock is driving 1 second slave clocks as they could be out of sync if the auto correction fails. The auto correction adds or removes a 1 second pulse to maintain sync of the 1 second slaves. You would expect a 1 second loss to be registered for example when a leap second is injected.

The 3rd row shows the DCF77 signal status and quality

The 4th row has the BST (british summer time) indicator and slave pulse output monitor

The 5th row is the chime status monitor. Chime is green when chimes are always on, yellow when on timer and off when chimes are off.

Step 9: Sound Module

General Communication

The JQ6500 modules are simple modules which can play standard mono or stereo MP3 files, you can control with buttons (no programming needed), or via a serial communications protocol (JQ6500 Arduino Library available).

JQ6500-16P has an onboard 16Mbit (2 Mega Byte) Flash memory.
Using a Windows PC only (Chinese language but just two-clicks to browse your files and select to upload – so you can manage) software which is embedded into the device and appears when you connect it to USB you can upload your MP3 files directly to the device. See next step on Uploading Sound Files.

The device (appears to) accepts commands at any time.

Commands consist of 4 or more bytes

Each command starts with byte 0x7E

Followed by a byte indicating the number of bytes which follow including the terminating byte (including termination).

Followed by a byte indicating the command to execute

Followed by an optional first argument byte

Followed by an optional second argument byte

Followed by the byte 0xEF as the termination byte

for example, the command ”PLAY” (0x0D) is constructed with the following 4 bytes

0x7E – Start Byte

0x02 – 2 Bytes Follow

0x0D – Command Byte

0xEF – Termination Byte

and the command to play a specific file (0x012) has two arguments (folder number and file number) so it looks like this

0x7E – Start

0x04 – 4 Bytes Follow

0x12 – Command

0x02 – 1st Argument (in this case, “Folder 02”)

0x03 – 2nd Argument (in this case, “File 003”)

0xEF – Termination Byte

Please note that you are not sending ASCII characters here, but those raw bytes (ie 0x7E is 8 bits, not 4 characters!).

Normal commands provide potential response of two ascii characters “OK” and maybe “ERROR”, but generally ignore responses to normal commands (it’s best to clear your serial buffer before and after issuing a normal command).

Query commands return an unsigned integer as hexadecimal characters (ie if the response is the integer 1234, then the response is the 4 ASCII characters “04D2”, so yes, the commands are sent as raw bytes, and the response is ASCII).

Send commands

0x0D – Play, No Arguments

0x0E – Pause, No Arguments

0x01 – Next, No Arguments

0x02 – Prev, No Arguments

0x03 – Play file by index number, 2 Arguments. The index number being the index in the FAT table, or upload order. Argument 1 = high 8 bits of index number, Argument 2 = low 8 bits of index number.

0x0F – Change folder. 1 Argument. Argument 1 = 0x01 for Next Folder, 0x00 for Previous Folder.

0x12 – Play file by folder and name, 2 Arguments. This applies to SD Card only where you have folders named 01 through 99, and files in those folders named 001.mp3 through 999.mp3. Argument 1 = folder number, Argument 2 = file number. Note that arguments are a single byte, so effectively I think you can only access up to file 255.mp3 in any folder.

0x04 – Vol Up, No Arguments

0x05 – Vol Dn, No Arguments

0x06 – Set Volume, 1 Argument. Argument 1 = byte value from 0 to 30

0x07 – Set Equalizer Mode, 1 Argument. Argument 1 = byte value 0/1/2/3/4/5 for Normal/Pop/Rock/Jazz/Classic/Bass (actually “Base” in the datasheet but I think they mean Bass)

0x11 – Set Loop Mode, 1 Argument. Argument 1 = byte value 0/1/2/3/4 for All/Folder/One/Ram/One_Stop – I don’t know what “Ram” is, it’s not Random, it seems the same as “One”.

0x09 – Set the source, 1 Argument. Argument 1 = 0x01 for SDCard and 0x04 for the on board flash memory.

0x0A – Sleep mode, No Arguments. Supposedly a low power mode.

0x0C – Reset, No Arguments. It’s advisable to wait 500mS or so after issuing this.

Step 10: Uploading Sound Files

Uploading Sound Files to the JQ9500 module

fig. 1 Plug the module into your PC and run the file MusicDownloader.exe on the module.

fig. 2 Click on the 2nd tab then clock on the button to the right of the black box

fig. 3 A file requester will open. Select your sound files and clock on Open

fig. 4 Go back to the first tab and click the button after a short delay the files will start to be copied

fig. 5 When complete you will get this message

Further info on this module can be found here JQ9500 info

A copy of my chime files ready for uploading to the module can be fond in the zip file

001.mp3 to 012.mp3 are the hour chimes including the 4th qtr Westminster chime, 013.mp3 is the 1st Qtr chime, 014.mp3 is the 2nd Qtr chime and 015.mp3 is the 3rd Qtr chime.

Step 11: Veroboard Layouts

Veroboard Layouts

As this clock is a modification to an old slave clock there are 3 separate Vero boards. If you are making it from scratch then you would probably only want 1 or 2 separate boards.

Fig. 1 & fig. 2 Board 1 is the main Arduino DCF77 control and TFT display board. fig. 2 shown with no modules plugged in. Fog. 3 is the reverse copper side of the board.

Fig. 4 Board 2 is the Lavet motor driver board.

Fig. 5 Board 3 is the clock control switch board. Note SW1, 2 & 3 for setting the clock and the considerable amount of associated wiring can be left out as Peter Hillyer's design incorporates a set switch.

I have labled it "setswitch" or "sec reset". To use press the button and the clock stops. Set all the hour & minute hands to the next correct minute and put the seconds hand on zero. The clock will wait until the next minute and start the clock again so all hands are now in sync. On my clock the wiring was already there so I have both Peter's and my manually setting options.

Main Control Vero board Layout without modules note only some link wiring shown (mainly batt/eth runs) see schematic for full wiring

Fig. ^ shows the board layout within the case.

Step 12: Control Switches

The are a large number of switches in this clock many of them can be left out to make the construction simpler especially SW1,SW2 & SW3 as these were part of my original slave clock wiring.

The clock movements can also be modified to include the current limiting variable resistor within the movement taking up less space on the main boards.

SW1 2 way centre off non lockingMan stepping of seconds with SW2 set to Manual

SW2 2 way lockingAuto/manual control of seconds

SW3 1 way lockingHours movement On or Off

Reset 1 way non locking press On Resets Arduino and TFT display

Chime Mode 1 way non locking press On Selects Chime mode between On Green, On times Yel, Off

Advance 1 way non locking press On Sets clock into Summer Adavance Mode

Retard 1 way non locking press On Sets Clock into Winter Retard Mode

Sec Reset 1 way non locking press On Stops analogue movements and then restarts @ 0 seconds

Vol-/Prev 1 way non locking press On/Long PressShort press play prev sound, long press volumn down

Vol+/Next 1 way non locking press On/Long PressShort press play next sound, long press volumn up

Play/Stop 1 way non locking press OnToggles play/stop current sound

Step 13: Winter & Summer Time Correction

Winter Time correction

fig. 1 when the "Retard" switch is operated the display changes to show the retard count. When this count reaches 0 the hour and second hands restart


The code is set to wait for a manual trigger (retard switch pressed) before setting the clock back an hour.

When pressed the seconds and hour hand stop. Really only the hour hand needs to stop but I stop the seconds hand and keep the minute hand going to indicate the clock is in "winter retard mode".

The TFT display counts down the missed seconds from 3600 and when it reaches zero the hour and seconds hands restart with the hour hand now being an hour retarded.

Summer Time correction

The code is set to wait for a manual trigger (advance switch pressed) before setting the clock forward an hour. When pressed the seconds and hour hand start stepping forward 2 times a second.

Really only the hour hand needs to be advanced but I advance the seconds hand and keep the minute hand going normally to indicate the clock is in "summer advance mode". The TFT display counts the extra seconds from 3600 and when it reaches zero the hour and seconds hands stop advancing the hour hand now being an hour advanced.

see video fig. 2 showing summer time correction

Fully automatic Summer Winter Correction
If you just want auto control and 2 less switches to wire as per Peter's original design just modify the code.

Step 14: Schematic

Fig. 1 shows the main schematic. Full size image in zip file

Step 15: Code

View the code here

Download Code V1.4

Requires Udo Klein's V3 library Download here