loading

Unlike most other binary clocks this clock displays the binary time and date on 3 rows of 8 seven segment displays as one and zeroes rather than just rows of LEDs.

Full details on this my web site here.

An Arduino 328 Microprocessor is used to decode and display Time & date from the DCF77 "Atomic" Clock in Mainflingen near Frankfurt Germany
The DCF77 signal is decoded using the fantastic new DCF77 library written by Udo Klein meaning the clock stays in sync and keeps perfect time even with a massive amount of noise on the received DCF77 signal. Udo Klein's DCF77 library 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. I didn't want any switches on the clock so time display mode switching are carried out by 433MHZ remote control.

Specs

3 rows of 8 seven segment displays show time and date in binary

Time can be displayed in Binary coded decimal or Binary format

Main clock display can be remotely switched between full binary time display, binary coded decimal time and full binary display of date

Time and date is synchronized to the DCF77 time code transmitter is Germany

Main display brightness is auto adjusted to room level

PIR sensor automatically shuts down the main 7 segment display and LCD display when no one is in the room

USB connection for serial programming and reading via a CP2102 USB to UART / TTL Adapter

A Secondary 4x20 I2C LCD display is used to display time & date, display brightness, sync information,
signal quality, auto tune'd frequency and auto tuned quartz accuracy. The display also shows decimal time and date which is handy when you are learning to decode the binary displays in your head.

Step 1: Background

I have built a few binary clocks in the past. My first Binary clock was built in 1985 and was built into an old pendulum clock see image 2. The pendulum operated a contact every 0.5 second and drove the Binary Coded Decimal LED display via 5v TTL logic.

The 2nd image 1 was built in 1996. It uses CMOS logic and LEDs to display full binary time and was quartz crystal controlled.

While they were nice to look at they were very difficult to read in dim lighting or darkness as any LEDs that were off made it hard to see the value of the LEDs that were on.

What I needed was to show the Binary 1s and 0s on 7 segment displays. At the time it was too difficult and too expensive to consider so in the late 1990's while learning Visual Basic I built a software version " Windows Binary Clock" as a proof of concept. This is shown in image 3.

The Windows Binary Clock displays time in Binary Coded Decimal. The top row is hours the middle minutes and the bottom seconds. The 2 columns are split into tens and units.

With the advent of cheap modular displays and Microcontrollers I was able to build a hardware version of the clock...............................................

Step 2: How to Read the 3 Displays

The clock has 3 display modes.

1 Full binary time

2 Binary Coded Decimal time

3 Full Binary Date

see animation image 1

Full binary timeimage 2

Each row shows part of the time.

Top row displays hours.

Middle Row displays mins.

Bottom Row displays seconds.

On each row starting from right to left each digit represents the following decimal number 1,2,4,8,16 and 32

So the top row shows a binary 1 on the 4th digit 001000 so this indicates 8 hours.

The middle row shows a binary 1 on the 2nd and 4th digit 001010 so this indicate 2 and 8 or 10 mins.

The bottom row shows a binary 1 on the 1st, 3rd and 5th digits 010101 so this indicates 1 and 4 and 16 or 21 secs.

The time indicated is 08:10:23

Binary Coded Decimal Time image 3

This is the easiest display mode to read as decimal numbers are split into tens and units so the binary numbers are smaller.

Again each row shows part of the time but each row is also split into two with the right half showing the units and the left half showing the tens.

As before

Top row displays hours.

Middle Row displays mins.

Bottom Row displays seconds.

As the rows are split in 2 there are only 3 binary digits for the left number (tens) and 4 binary digits for the right number (units).

Top row left 3 binary digits are 001 this is 1 in decimal so the hours are 10 as this in the tens column.

Top row right 4 binary digits are 0111 this is 7 in decimal so the hours 7 in the units column.

Combining the the left and right columns give 17 hours.

Middle Row left 3 binary digits are 010 this is 2 in decimal so the minutes are 20 as this is the tens column.

Middle Row right 4 binary digits are 0011 this is 3 in decimal so the minutes units are 3.

Combining the left and right columns give 23 minutes.

Bottom Row left 3 binary digits are 001 this is 1 in decimal so the seconds are 10 as this is the tens column.
Bottom Row right 4 binary digits are 0110 this is 6 in decimal so the minutes units are 6.

Combining the left and right columns give 16 seconds.

The time indicated is 17:23:16

Full Binary Date image 4

This is the most difficult display mode due to the large number of binary digits to calculate. There are 8 digits representing from right to left 1,2,4,8,16,32,64 and 128. As this mode displays the date the rows have to display up to 99 to show the year.

In date mode the row are as follows.

Top row indicates the day and shows binary 00011110 this is 30 in decimal so it's the 30th day.

Middle Row indicates the month and shows binary 00001011 this is 11 in decimal so it's the 11th month November.

Bottom Row indicates the year upto 99 and shows binary 00001110 this is 14 in decimal so it's the 14th year.

The date indicated is 30/11/14. Note this is British date format for 30th November 2014. I think in America you would display the date as 11/30/14? If so just change the code for the rows accordingly.

In real life the clock is very easy to read especially in BCD time mode it's just very difficult to explain in writing!

When learning to tell the time in binary you can always refer to to LCD display of time and date for help.

There is a help button on the remote that will bring up the binary number series " 32 16 8 4 2 1 "on the bottom row of the LCD display.

Step 3: Components

The clock is built into a modified Ikea Borrby candle lantern.See how to modify the case here.

This clock also requires the front piece of glass removing and a sheet of dark neutral density acrylic cut to size and fitted in it's place. This adds contrast to the LED display and ensures the PCB, components and dark blue display background can't be seen.

The displays are mounted on the main veroboard on PCB headers with the components fitted below.

The 3 LED displays are Yellow 7 segment and come assembled and tested from Tindie other colours are available. You can get cheaper versions off Ebay from China but I have only seen Red display available from there.

A Secondary 4x20 I2C LCD display is used to display time & date, display brightness, sync information,
signal quality, auto tune'd frequency and auto tuned quartz accuracy. The display also shows decimal time and date which is handy when you are learning to decode the binary displays in your head. I2c4x

The transmitted DCF77 time and date code are received on a DCF77 Receiver module. I puchased my one here there are other available on the net.

Veroboard is used to make the display board and components are as per schematic.

The clocks LED and LCD displays are turned on only when someone is the room and this is controlled by a PIR module available from Ebay. This is modified and mounted remote from the clock as the PIR will not work through the glass of the display case. See mod details on my master Clock page here.

Remote control for the display is over 433MHz wireless link. I purchased a transmitter and receiver board from Hobby Components LTD and built the transmitter board into a small project box. the receiver is mounted on the clock main board. Make sure you purchase the correct module for your local laws in the UK it is 433MHz.


Step 4: Schematics and Wiring

Wiring for this clock is very straight forward as the display modules come assembled. Fit header plugs to the veroboard to take the three LED modules.

Each 7 segment display module has 6 connections Vcc,Gnd,DOUT,DIN,LOAD & CLK.

Vcc,GND, LOAD and CLK are just wired in the first module from the Arduino then looped out to the next module etc. DIN goes in the first module then DOUT of the first module connects to DIN of the 2nd module etc.

The LCD display just has 4 connections 5v, Gnd from the power rails and SCL and SDA connected to the Arduino.

The USB to CP210K module can be omitted if on board programming of the Arduino is not required. In this case the Arduino will need to be removed then programmed in your development board etc.

The DCF77 receiver may need it's own 3.3v power. You can buy 3.3v modules ready built from ebay.

Step 5: Code

View the clock code here.

Download the code here.

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

Hi,<br>my (your) binary clock and another Arduino RTC clock.<br>The radio binary clock holds perfect time whereas the RTC clock gains around 2 minutes each month ! I must revisit the code to see what is going awry.<br>Good new year and all that<br>D6
<p>Hi D6 Happy new year.</p><p>RTC are not very accurate 2 mins a months is prob about right. Do you set the RTC to &quot;atomic time&quot; each time the signal is in sync? </p><p>Using Udo Klien's DCF77 library it auto tunes the quartz crystal on the Arduino board in case signal is lossed so a RTC should not be required.</p>
<p>Hi,<br>I thought you may like to see this - first locked and synced at 10:17:08 this morning.<br>The missing led display is because one popped and all the blue smoke escaped.</p><p>Now to organise a casing - I'll probably be using an ex-DAB radio casing as I'm generally rubbish at carpentry. It will have a smoked perspex front. I am also adding the RTC and manual settings capability.</p><p>Perseverence paid-off.<br>D6</p>
<p>Well done! Great to see you have got it working.</p><p>Don't forget to post some more pics of your finished clock.</p>
<p>Hi Oliver,</p><p>I have almost finished making your Binary clock. I changed a couple of things to suit my taste although essentially it is the same. The case I used is a defunct DAB radio case turned on its side, I am adding a DHT module to display temperature and humidity and also I will be changing the remote to enable standard date and time display format. I altered the dimming display so that it dims in less light as I found it dazzling in the dark and more easily readable. The PIR sensor is mounted on the top with a tiny slipring unit so it can either be motorised or turned manualy in any direction. I have uploaded a photo here although my phone, despite being a Sony, has put a bloom over the displays. I've adjusted the image to get the displays almost readable. I tried and tried to make my own arduino although failed to transfer from a prototype board to a strip-board and after a couple of weeks with no success, I modded one of my UNO's with a crystal - accuracy 15.999975MHz - I will create an Instructable for this and record the pit falls and triumphs of my project journey.. I am experimenting with an audible 'tick tock' and am trying muffled relays and a solenoid. Lastly, I have a hankering for &quot;Steam Punk&quot; and so will be &quot;punking it up&quot; so to speak - I'll upload more images as soon as I am able.</p><p>Thank you for your help and advice and your fantasic Instructable.</p>
<p>Hi D6equj5.</p><p>Congrats on your progress so far.</p><p>I look forward to reading your Instructable and seeing your final &quot;punked&quot; up version.</p><p>Will be interesting to see how you get on with the &quot;tick tock&quot; sound from relays. A long way back I used a GPO 3000 type relay <a href="http://www.britishtelephones.com/shared/relays.htm">http://www.britishtelephones.com/shared/relays.htm</a> in an electric pendulum clock I built. The 3000 type relay drove my slave clock and was operated 1 second then released the next second. It had a wonderful sound and although it had a 50 v coil I managed to drive it with a much lower voltage.</p><p>I know what you mean about photographing clocks with displays, it is really difficult. What looks perfect with the human eye come out with a display that is too bright or if you get the display looking good then the case is too dark.</p><p>I often take 2 pictures, 1 with the display exposed correctly and then 1 with the case exposed correctly. I then combine the 2 in photoshop using different layers.</p>
<p>Quick question - why does the PIR connect to an analogue pin? I don't seem to be able to get mine to work on an analogue pin - the PIR give a digital output.</p>
<p>It is fine to use analogue pins as digital pins. If the output from your PIR is high then the displays will be on. I think the detectors can be set in 2 modes Non-repeatable trigger or Repeat Trigger. I think the link should be set to repeat trigger. Some may let you choose hi or low output make sure yours is set to high output.</p><p>Let me know if it works.</p>
<p>Good advice thank you, yes it worked beautifully.</p><p>D6</p>
<p>Hi,</p><p>I have put in a couple of debug line into your code, thus:</p><blockquote>// render one dot per second while initializing<br> static uint8_t count = 0;<br> Serial.print('.');<br><p>// ////////////// added debug lines ////////////////////////////////////</p><p>Serial.print(count);</p><p>Serial.print(&quot;Sample pin = &quot;);</p> Serial.println(analogRead(dcf77_sample_pin));<br> Serial.print(&quot;Prediction Match = &quot;);<br> Serial.println(DCF77_Clock::get_prediction_match());<br> Serial.print(&quot;State = &quot;);<br> Serial.println(DCF77_Clock::get_clock_state());<br> freqadj();<br> signalmatch();<br> Serial.println();<br>// ////////////// end of debug lines //////////////////////////////</blockquote><p>The debug data I get back are: (typically)</p><blockquote>Sample pin = 914<br>Prediction Match = 255<br>State = 0<br><br>Sample pin = 6<br>Prediction Match = 255<br>State = 0<br><br>Sample pin = 7<br>Prediction Match = 255<br>State = 0<br><br>Sample pin = 914<br>Prediction Match = 255<br>State = 0<br><br>Sample pin = 7<br>Prediction Match = 255<br>State = 0</blockquote><p>I'd <em>really</em> appreciate your thoughts. I checked and the crystal is a crystal and not a resonator.</p><p>Thanks</p><p>D6</p>
<p>Hi may be worth double checking your board for a crystal. There is a crystal on board but it is not used for the arduino (I think the serial port). If you look at my modified board here http://home.btconnect.com/brettoliver1/Master_Clock_MK2/images/UNOquartz.png you can see where I have desoldered the resonator and soldered in a crystal and caps. You can see there is a crystal on my board as well. There is a software tool to check your boards accuracy and signal polarity. If you go here http://blog.blinkenlight.net/dcf77-scope/ and have a quick read through download the software and see what results you get.</p>
<p>Hi,</p><p>just to let you know how I'm getting along with your project.</p><p>I am getting occaisional signal from using an Arduino Pro-Mini (with 16MHz crystal) - the best I have managed so far is with all the circuit boards balanced on my lap in the dining room facing the wall. I have concluded I require a better antenna and have set about acquiring a 100mm x 10mm model which, I anticipate, will improve signal strength and quality no-end here in RG30. Whilst I await delivery, I am adding an RTC and the means whereby it can be pre-set with the date and time and then when a signal is locked it can be adjusted to the signal data from the DCF77. I found the blinkenlight 'scope' sketch although can't for the life of me figure out what it is showing me although another of the sketches &quot;Decoding Time Data&quot; I have found to be very useful as it gives me an understandable representation of the signal and how the time facets are built from that signal and also I can move the antenna about and instantly see the affect it has upon the quality of the data acquired.</p><p>I'll keep you updated as I proceed.</p><p>Still love your project. Thanks. D6</p>
<p>Hi D6.</p><p>If you run the scope sketch you will get a serial output.</p><p>Compare your output to the example outputs on the page </p><p><a href="http://blog.blinkenlight.net/dcf77-scope/">http://blog.blinkenlight.net/dcf77-scope/</a></p><p>scroll down below the code and you will see the 3 outputs.</p><p>The x's show the received signal each row being 1 second.</p><p>xxxxxxxxxxxxxxxxxxxxxxxxx is a 1</p><p>and </p><p>xxxxxxxxxxxx is a zero</p><p>in a good signal the 1 and zeros should be inline</p><p>eg</p><p> xxxxxxxxxxxxxxxxxxxxxxxx</p><p style="margin-left: 100.0px;">xxxxxxxxxxxxx</p><p style="margin-left: 100.0px;">xxxxxxxxxxxxx</p><p style="margin-left: 100.0px;">xxxxxxxxxxxxxxxxxxxxxxxxx</p><p style="margin-left: 100.0px;">xxxxxxxxxxxxxxxxxxxxxxxxx</p><p style="margin-left: 100.0px;">There may be lots of noise in there as well but it will be decoded after several mins.</p><p style="margin-left: 100.0px;">If you don't have a crystal the rows of 1 and zeroes will drift and will not be inline. </p><p style="margin-left: 100.0px;">eg</p><p style="margin-left: 100.0px;">xxxxxxxxxxxxxxxxxxxxxxxxx</p><p style="margin-left: 100.0px;"> xxxxxxxxxxx</p><p style="margin-left: 100.0px;"> xxxxxxxxxxxxxxxxxxxxxxxx</p><p style="margin-left: 100.0px;"> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</p><p style="margin-left: 100.0px;"> xxxxxxxxxxxx</p><p style="margin-left: 100.0px;">RTC</p><p style="margin-left: 100.0px;">Once working the DCF77 library will auto adjust your crystal frequency. After a few days of running the Qtz accuracy on the display will come down to 1Hz or maybe 2Hz. This is far better than a RTC and means your clock will stay in time for many days without any signal.</p><p style="margin-left: 100.0px;">This means a RTC is not required.</p><p style="margin-left: 100.0px;">If you manage to get a 100mm DCF77 aerial can you let me know the source as I have never been able to get one.</p>
<p>See my post above.</p><p>Looks like the formatting has gone when I posted it.</p><p>In a quartz crystal the start of each 1 or zero should be inline down the page.</p><p>In a resonator the 1 and zeros will not be in line down the page and will drift.</p>
<p>Hi Brett,</p><p>Exquisite Instructable thank you.</p><p>I am making one of these clocks however I have a problem in that the DFC77 library is causing compiler problems and I get errors. I have downloaded it a couple of times in case the first was corrupted in some way although I still get the message </p><p>&quot;'time_t' in namespace 'DCF77_Clock' does not name a type&quot;.</p><p>I know this would normally be caused by a library failing to load properly - have you any suggestions? I have everything wired on a breadboard and need to run the program to test before soldering to circuit boards.</p><p>Many thanks</p><p>D6</p>
<p>It may be the new version of the library no longer works with my code. Go to this page scroll down and try release 2 <a href="https://github.com/udoklein/dcf77/releases" rel="nofollow">https://github.com/udoklein/dcf77/releases </a> </p><p>Let me know how you get on.</p>
<p>That worked a treat thank you.</p><p>I had also upgraded the arduino ide and that destroys all previous libraries and work which is infuriating and unnecessary and &quot;they&quot; really ought to look at upgrades which add to the existing rather than delete it all.</p><p>Any way I'll upload a photo or two once my efforts on your master clock are a little more glamorous.</p><p>D6</p>
<p>Hi D6 glad that worked I will paste a link to the v2 library on my site and instructable.</p><p>Look forward to seeing your photos.</p>
<p>Just one other thing - the dcf77 appears to need to connect to pins 23 and 24 of the Arduino Uno, but my uno only goes up to D13 - what would you suggest?</p><p>Also my dcf77 pins are marked &quot;SDO, GND, PON, TCON, VDD&quot; and I can't dcf77 seem to be able to get any info to correlate those to your pins &quot;DCF77 Sig and DCF77 Mon&quot; - what would you suggest for this?</p><p>And lastly you have the IR output to pin 26 and the ldr to pin 25 but again these can't be right as Uno's only go to D13.</p><p>Are you perhaps using an Arduino Mega which does have digital pins that high? Or do you have a &quot;special&quot; Uno? or am I being daft?</p><p>My old school motto was &quot;Perseverance&quot; and I'm not about to give up as it really is a beautiful project.</p><p>Many thanks</p><p>D6</p>
<p>I used a UNO to prototype the circuit and then built the working circuit on a DIY UNO which is just an Atmega 328 chip on a vero board. The pin numbers are the numbers on the Atemega 328 chip. You just need to translate the pin numbers back to the UNO boards names/number. See this pic</p><p> <a href="http://rc-master.ucoz.ru/Arduino/Pinout/Arduino_uno_Pinout.jpg" rel="nofollow">http://rc-master.ucoz.ru/Arduino/Pinout/Arduino_un...</a> </p><p>Hope this helps.</p>
<p>Hi, just a major stumble - I have the dcf77 wired as follows:</p><p>vdd = 3.3vdc</p><p>tcon = analog 1</p><p>pon = gnd</p><p>gnd = gnd</p><p>sdo = nc</p><p>However the dcf77 flickers away for hours without producing a time for the clock.</p><p>Have I wired this incorrectly? And what and where is the dcf monitor connection?</p><p>I am getting SO close ...</p><p>Thank you</p><p>D6</p>
<p>Oh and also - what is the &quot;EZLink&quot;? You refer to it on the schematic and in the code although there is no explanation as to what it is or where it is.</p><p>Still blinking away in the corner 36 hours now and no initialisation ....</p>
<p>The EZLink is just a remote control module so you can change the display between BCD,Full Binary and date. There is a link on page 3 along with vero board layouts. You can also do it with a manual switch or just with links.</p><p>I think the problem with initialization maybe that you are using a modern UNO board. The modern boards do not use a crystal but a resonator. The DCF77 library needs an accurate timebase for initial syn to the DCF77 signal. I modified my UNO by adding a crystal and capacitors see instructions here <a href="http://home.btconnect.com/brettoliver1/Master_Clock_MK2/Master_Clock_MK2.htm#Mod" rel="nofollow">http://home.btconnect.com/brettoliver1/Master_Cloc...</a></p><p>I did not mention it as the instructable design uses a stand alone Atemega chip with a crystal. Crystals and capacitors can be purchased off ebay as a kit <a href="http://www.ebay.co.uk/itm/Atmega328P-Kit-Arduino-Uno-Bootloader-16MHZ-Crystal-22pF-Capacitors-/131558080462?var=&hash=item1ea178ffce" rel="nofollow">http://www.ebay.co.uk/itm/Atmega328P-Kit-Arduino-U...</a></p>
<p>Thank you - that makes good sense. I have a spare Mega2560 with (I think) a crystal as opposed to a resonator so I'll switch to using that for now.</p><p>I'll let you know when the test-bed version is up and running.</p><p>D6</p>
<p>Aha there you see? - I knew I was being daft.</p><p>Thank you</p><p>D6</p>
<p>Nice looking project with interesting features. The .gif(s) you included give the Instructable a very attractive layout.</p><p>Thanks for sharing. Saludos.</p>

About This Instructable

3,077views

16favorites

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: