loading

This clock is designed as a stand alone clock or as a master clock to drive slave clocks and is portable with battery backup. See the clock's website for further details LCD Master Clock Home Page

Update- Automatic Summer advance and Winter Retard button added to the version using Udo Klein's DCF77 library. Press button once to watch the clock advance or Retard 1 hour.

This clock uses an Arduino 328 Microprocessor to decode Time from the DCF77 "Atomic" Clock in Mainflingen near Frankfurt Germany. Time is displayed on a modified skeleton clock controlled by the microcontroller and a Blue 4x20 LCD display. Clock pulses to drive slave dials are monitored on an LED panel. 3 x 1.5volt AA cells provide battery backup when disconnected from the mains. The main board has a USB to UART connector so the clock software can be updated from a PC or even a Mac. Serial code is included for monitoring over the USB but is commented out.

Updated code included to run Udo Klein's DCF77 library. Udo Klein's DCF77 library keeps the clock in sync and keeps perfect time even with a massive amount of noise on the received DCF77 signal. The DCF77 library also continually "Auto Tunes" the quartz crystal so in the rare event the signal can't be decoded the clock remains accurate within 1 sec over many days. This is crucial for a Master clock that drives 1 second slaves as seconds drift will cause the slave clocks to lose sync with the Master Clock time.

Code for the standard library is also included if you have a very good DCF77 signal.

Step 1: Making the Case

The case is a modified BORRBY candle lantern from Ikea.

The case is modified as follows:

1 Drill out the welds holding the top to the main frame

2 Remove the top

3 Cut out the ventilation grill on the front to make space for the LCD display

4 Cut wood or metal sheet to fill the ventilation grills that remain

5 Fill gaps between base and frame with wooden strips. The base circuit board sits on this wood. Remove candle spike from base and add four feet.

6 Add a new plywood top and fix with hinges a the back. A recess will need to be cut in the top to take the top of the LCD circuit board that protrudes from the base.

7 Add a handle and cut a hole in the base for the cables.

8 Fix LCD display in cutout

9 Fix Skeleton Clock movement by suspending from top

10 Slide in PCB and LED display panel

Step 2: LCD Display Using Udo Klein's DCF77 Library

The LCD display has the following specs.
· Operating voltage: 5V· Alphanumeric character set· 4 lines of 20 characters· Blue Backlight· Module size: 98 x 60 x12mm· Display size: 75 x 25mm· I2C 2-wire connection· Built-in Contrast Adjustment

LCD Display using Udo Klein's DCF77 Library

The code uses a PIR movement detector to turn the LCD display on and off. This Library is able to decode the DCF77 signal even if it contains a massive amount of noise. The library also "auto tunes" the Arduino Quartz crystal in the rare event the DCF77 signal is lost (no backup RTC required). For this Library to work your Arduino must use a Quartz crystal as a timebase not a problem if you build your own Arduino as I have. If you are using an Arduino Uno a Quartz crystal can be added my modding the UNO board. See how to do it here Mod standard Uno

Row 1 always shows the current time and date
Row 2 Clock Name, also shows the makers name and software version number. Row 2 then switches to show Slow and Fast 1 second pulses.

As this clock drives other slave clocks as well as the built in analogue display this row monitors the main decoded display and it detects a jump in the seconds backwards or forwards. These will be shown as fast or slow seconds on Row 2 along with the date and time they were detected. On initial power up there are no fast or slow pulses so Row 2 Slow Pulse will be "0" and the date and time indicates when the clock was first power up and synchronized. The Fast Pulse will also show "0" but the date and time will show as "Never" The only time you would expect to see a Slow or Fast pulse detected is if the DCF77 signal was removed for several days then reconnected or if a leap second is injected (fast pulse)

Row 3 DCF77 decoder state

Row 4 Sig Match - Once locked into the DCF77 signal Udo Klein's library can predict what the next signal pulse should be. The Signal Match displayed as a percentage shows the quality of the received signal. 100% being a perfect match to the predicted signal.

Row 4 also shows the "auto tuned " quartz frequency.
When receiving the normal DCF77 signal Udo Klein's library uses this to work out how well the internal quartz crystal is running. It will then tune the quartz frequency up or down to allow it to keep almost perfect time if the DCF77 signal is lost.

Row 4 also shows the tuned accuracy of the quartz crystal. Once the clock has run for a number of days the accuracy of the quartz crystal is tuned until it reaches a max accuracy of 1Hz.
The attained accuracy is displayed. This is fully dynamic so the quartz crystal is continually tuned no matter the temperature or age drift of the crystal. Remember this is not the accuracy of the clock but the accuracy of the quartz crystal if the DCF77 signal was to fail.

Row 4 also shows Winter/Summer time.

Step 3: LCD Display Using Standard DCF77 Library

The standard DCF77 library and code display is shown above.

This code also switches the LCD display off overnight. On start-up the clock attempts to decode the DCF77 signal and will show the "Waiting DCF77 Sync" screen image 1.

Once the signal is decoded the display switches to full time, date and data display. image 2 and 3.

The LCD display shows;
Time and Date Last time the clock sync'd to the DCF77 signal The sync status Last time the clock missed a pulse ( and was corrected by adding a pulse) Number of pulses missed in last 24hrs Pulse length 100ms = 1, 200ms = 2 Cycle length 1000ms and EOF (end of field) indicator The clock will shutdown the LCD after midnight and will turn back on at 06:00hrs. This can be easily changed if required by editing the code.

Step 4: Analogue Skeletal Display

Apart from the LCD display the clock also tells the time on an analogue display driven and controlled by the Atmega microcontroller.

The skeletal display is a modified quartz unit. The quartz crystal board is cut out and the 1 second drive from the main board is connected direct to the drive motor.

The hour and minutes are set from the standard knob on the back of the movement but the seconds are set by using 2 switches on the rear the the clock case. 1 stops the seconds and the other advances the seconds.

Step 5: Code V1 Using Udo Klein's DCF77 Library

LCD Master Clock using Udo Klein's DCF77 library or download from here Download code

Note this clock uses Udo Kleins Release 2 library download here DCF77 Release 2

Step 6: Code V2 Standard DCF77 Library

DCF77 master Clock using the DCF77 library from https://github.com/thijse/Arduino-Libraries/downloads

Download the code from here

Step 7: Video

Short Video clip showing the clock operating and chiming from 23:59:55 to 00:00:32

Chimes are via separate circuits but can be electromechanical or samples via a sound board.

Step 8: Pulse Monitor Display

LED panel shows the slave clock and chime pulses output from the clock. See panel above.

Step 9: Vero Board and Schematic

The clock is controlled by a Atmega 328 the same as a Arduino UNO.

Vero Board layout
The cut out on the right of the board goes to the back of the case and allows cable access to sockets to all pins. Outputs are included to enable feeds to other clocks via transistor drivers as required.

There is a 3.3v power module on the board that feeds the DCF77 aerial/receiver.

The board also contains a USB to serial adaptor so the Atmega IC can be updated.

The schematic can be seen here Schematic

<p>Awesome! Looks very professional.</p>
<p>Your clock is really nice and good looking! To drive the analog clock with steppers and avoid the need of setting it would be a really nice upgrade... Still the look is incredible!</p>
<p>Hi plouc have added 1 button summer winter correction now on the version using Udo Klein's DCF77 library</p>
<p>Thanks plouc. Not sure if I have the skills to integrate a new stepper motor into the analogue movement. Using the modified quartz stepper motor I have to manually set the analogue clock 2 times a year for winter and summertime. I could just delay the clock for an hour with the Arduino in Autumn and add 3600 extra pulses (in the half second) in spring to auto set for winter/summertime. It would be a great upgrade and will be worth experimenting with. I have implemented a similar thing on my master clock 30 second clock drive. There are some videos on the site showing winter/summer correction. http://home.btconnect.com/brettoliver1/Master_Clock_MK2/Master_Clock_MK2.htm</p>
<p>Hello Oliverb, your clocks are amazing. I am currently building my own, highly inspired by yours.</p><p>The knob on the back of the skeletal turns with the minute hand, so it is not possible to stick a stepper motor to automate the time setting, because the stepper would prevent the minute hand to turn freely the rest of the time...</p><p>I am wondering how you openned the quartz plastic box of the skeletal clock. Did you have to unscrew everything to access the engine ? Mine has the screws unaccessible because hidden by the plastic (metalic color) dial which cannot be unscrewed. I guess I will have to play a little with my Dremel...</p><p>Thanks.</p>
<p>Hi Again Brett</p><p>I just thought I would give you a followup on the progress of my clock.</p><p>I am now in the final stages of assembly. I have etched a PCB and mounted the front led panel to my clock. Just waiting for a larger skeleton clock insert, the original one I bought was too small. But have now found the larger version.</p><p>I have re-written a lot of the code, I have incorporated one of these cheap audio modules to store and play the chimes, it is under serial control from the Arduino now so that all the parameters are accessible. Using a good quality loudspeaker driver it sounds the part too.</p><p>I have loaded Westminster chimes so that they play on the 1/4, 1/2 and 3/4 hour. As well as a full chime of the hours on the hour. Code is incorporated to silence the chimes during the night, with the mode selected with a tactile switch. I am also using a tactile switch to halt the quartz movement for sync purposes. The way I set the quartz movement is to wait until the movement shows &quot;60&quot; seconds then press the button, this stops the movement until the main clock reaches &quot;01&quot; second the quartz movement then starts again, and I can set the hours minutes using the normal knob at the back, knowing that seconds are in perfect sync.</p><p>This is the audio module I used </p><p><a href="http://www.ebay.co.uk/itm/JQ650-64Mbit-Mini-U-disk-Audio-Player-TF-Card-MP3-Sound-Voice-Module-Arduino-/131573197958?hash=item1ea25fac86:g:4koAAOSwstxVOL2C">http://www.ebay.co.uk/itm/JQ650-64Mbit-Mini-U-disk-Audio-Player-TF-Card-MP3-Sound-Voice-Module-Arduino-/131573197958?hash=item1ea25fac86:g:4koAAOSwstxVOL2C</a></p><p>When completed I would love to send you some pictures. Not sure how I can get your email address though.</p><p>Kind regards</p><p>Pete</p>
Hi Pete.<br><br>That's good news about your clock. I have looked at the audio module and added it to my &quot;clock collection&quot; on ebay.<br><br>The sound module in my clock is quite out of date now. On my latest chiming clock I have used this 1 from Adafruit https://www.adafruit.com/products/2217 it is very good quality but expensive. <br><br>That's a very good idea on setting the second hand in my version I have a stop and fast forward switch that takes a bit of practice to get the second hand in sync.<br><br>Look forward to seeing your finished clock. Will you be publishing it on instructables? <br><br>Will send you a personal message with my email.
<p>Hi</p><p>This is an excellent article. Thanks so much for sharing.</p><p>I am attempting to have a go at building one for myself, but I cannot for the life of me get the code to compile. I am using the latest 1.6.5r2 release of the IDE for windows </p><p>I have all the required libraries, but am getting all sorts of errors.</p><p>I would be obliged if you can help identify the issue.</p><p>Many Thanks</p><p>Pete<br><br><br>Here are the errors reported by the IDE</p><p><br><br><br><br><br><br><br><br><br><br>DCF77_UdoKlein_2_1:181: error: 'time_t' in namespace 'DCF77_Clock' does not name a type<br>DCF77_UdoKlein_2_1:181: error: ISO C++ forbids declaration of 'now' with no type [-fpermissive]<br>DCF77_UdoKlein_2_1.ino: In function 'uint8_t Timezone::days_per_month(const int&amp;)':<br>DCF77_UdoKlein_2_1:182: error: request for member 'month' in 'now', which is of non-class type 'const int'<br>DCF77_UdoKlein_2_1:186: error: request for member 'year' in 'now', which is of non-class type 'const int'<br>DCF77_UdoKlein_2_1:186: error: request for member 'year' in 'now', which is of non-class type 'const int'<br>DCF77_UdoKlein_2_1:186: error: 'bcd_to_int' was not declared in this scope<br>DCF77_UdoKlein_2_1.ino:186:64: note: suggested alternative:<br>In file included from DCF77_UdoKlein_2_1.ino:74:0:<br>C:\Private Data\Arduino\arduino-1.6.5-r2\libraries\dcf77/dcf77.h:143:13: note: 'BCD::bcd_to_int'<br> uint8_t bcd_to_int(const bcd_t value);<br> ^<br>DCF77_UdoKlein_2_1.ino: At global scope:<br>DCF77_UdoKlein_2_1:205: error: variable or field 'adjust' declared void<br>DCF77_UdoKlein_2_1:205: error: 'time_t' is not a member of 'DCF77_Clock'<br>DCF77_UdoKlein_2_1.ino:205:15: note: suggested alternative:<br>In file included from DCF77_UdoKlein_2_1.ino:74:0:<br>C:\Private Data\Arduino\arduino-1.6.5-r2\libraries\dcf77/dcf77.h:158:7: note: 'Clock::time_t'<br> } time_t;<br> ^<br>DCF77_UdoKlein_2_1:205: error: 'time' was not declared in this scope<br>DCF77_UdoKlein_2_1:205: error: expected primary-expression before 'const'<br>DCF77_UdoKlein_2_1:1501: error: expected '}' at end of input<br>'time_t' in namespace 'DCF77_Clock' does not name a type</p>
Hi g0pkh.<br>The code for this clock was written using Udo Klein's original DCF77 library. I think he has completely re-written the library now and called it version 3.<br><br>Check to see what version of the library you have installed as I don't think my code will work with version 3.<br><br>Let me know how you get on.
<p>Thank you so much for taking the time to reply.</p><p>I did suspect that, I noticed that there was a later version of the library available now. Trouble is I cannot find the earlier one.</p><p>Would there be any possibility of emailing the version you used to me?</p><p>I would appreciate it. With such complex code, I would like to get your version working before I try using a later version of the library.</p><p>Many thanks </p><p>Pete</p>
<p>Try this link for release 2. <a href="https://github.com/udoklein/dcf77/releases" rel="nofollow">https://github.com/udoklein/dcf77/releases</a></p><p>Regards.</p><p>Brett.</p>
<p>Excellent.</p><p>Thankyou very much Brett. Downloading the V2.0 library worked great.</p><p>The code compiles fine now.</p><p>Kind regards</p><p>Pete</p>
<p>Hi Brett</p><p>Just to let you know, I now have a basic clock operating, with just the LCD display at the moment. Have now modified your code to use the V3 DCF library. Have managed to source the same case and skeleton clock. </p><p>I am now experimenting with some of latest audio player modules.</p><p>I don't have any slave clocks, so am concentrating mainly on a chiming stand alone version.</p><p>regards</p><p>Pete</p>
<p>Hi Pete that's great news.</p><p>I have just built a stand alone chiming calendar clock <a href="http://home.btconnect.com/brettoliver1/Calendar_Clock/Calendar_Clock.htm" rel="nofollow">http://home.btconnect.com/brettoliver1/Calendar_Cl...</a></p><p>The clock uses a Adafruit sound board that is very good quality <a href="https://www.adafruit.com/products/2217" rel="nofollow">https://www.adafruit.com/products/2217</a></p><p>I have just used the direct inputs from my Arduino to trigger the chimes but you could use the serial input to give greater control.</p>
<p>few times we find a good Instructable with a nice looking outcome.</p><p>Thanks for sharing!</p>
<p>Excellent work! The clock looks fantastic!</p><p>I am wondering where to get the analog skeletal clock from. I found on the www <a href="http://www.turners-retreat.co.uk/projects/project-kits/clock-movement-accessories/skeleton-clocks/silver-skeleton-clock" rel="nofollow">this clock</a>. It looks identical to yours. Could you confirm that?</p>
<p>It is very similar to my movement but has a 150mm dial my clock dial is around 107mm. There are some smaller dials on the same site but they don't have a seconds hand. </p>
<p>Had another look and it could be that movement as 150mm is the overall size. My dial is around 107mm.</p>
<p>looks great.<br>I was wondering why you are using 6 LCD libraries:</p><p>#include LCD.h&gt;<br>#include LiquidCrystal.h&gt;<br>#include LiquidCrystal_I2C.h&gt;<br>#include LiquidCrystal_SR.h&gt;<br>#include LiquidCrystal_SR2W.h&gt;<br>#include LiquidCrystal_SR3W.h&gt;<br>(I left out the opening barckets, so it wouldnt be seen as html)</p><p><br></p>
<p>Sorry diy_bloke only 1 is required</p><p>Should be #include LiquidCrystal_I2C.h&gt; only.</p><p>I will update the code.</p>
<p>yeah I thought there was probably a mistake :-)</p>
<p>It is a bit unclear to me wether your skeletal display clock is just a stand alone device or if in anyway it is steered, triggered by your Atmega circuit/clock</p>
<p>The Skeletal clock is controlled by the Atmega. The schematic shows the connections along with the manual control switches. I will update the Analogue Skeletal Display step to make it clearer.</p>

About This Instructable

12,190views

292favorites

License:

More by oliverb:Arduino controlled DCF77 Synchronized Astronomical Regulator Master Clock Brompton Bike Hidden Storage Cupboard Arduino Pragotron TFT Clock Controller 
Add instructable to: