Arduino Binary 7 Segment Display Clock & Calendar





Introduction: Arduino Binary 7 Segment Display Clock & Calendar

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.


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: Vero Boards

Photo 1 shows the main Veroboard with 7 segment displays

Photo 2 Main Veroboard layout with board shown in it's natural white colour for clarity.

The board is painted matt black before components are mounted.

Note Resistor R4, LEDs D2 & D3 along with Rly conn not required.

Step 5: 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 6: Code

View the clock code here.

Download the code here.

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



  • Water Contest

    Water Contest
  • Creative Misuse Contest

    Creative Misuse Contest
  • Oil Contest

    Oil Contest

19 Discussions

my (your) binary clock and another Arduino RTC clock.
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.
Good new year and all that

clocks comparison.jpg
1 reply

Hi D6 Happy new year.

RTC are not very accurate 2 mins a months is prob about right. Do you set the RTC to "atomic time" each time the signal is in sync?

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.


I have put in a couple of debug line into your code, thus:

// render one dot per second while initializing
static uint8_t count = 0;

// ////////////// added debug lines ////////////////////////////////////


Serial.print("Sample pin = ");

Serial.print("Prediction Match = ");
Serial.print("State = ");
// ////////////// end of debug lines //////////////////////////////

The debug data I get back are: (typically)

Sample pin = 914
Prediction Match = 255
State = 0

Sample pin = 6
Prediction Match = 255
State = 0

Sample pin = 7
Prediction Match = 255
State = 0

Sample pin = 914
Prediction Match = 255
State = 0

Sample pin = 7
Prediction Match = 255
State = 0

I'd really appreciate your thoughts. I checked and the crystal is a crystal and not a resonator.



4 replies

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 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 and have a quick read through download the software and see what results you get.


just to let you know how I'm getting along with your project.

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 "Decoding Time Data" 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.

I'll keep you updated as I proceed.

Still love your project. Thanks. D6

Hi D6.

If you run the scope sketch you will get a serial output.

Compare your output to the example outputs on the page

scroll down below the code and you will see the 3 outputs.

The x's show the received signal each row being 1 second.

xxxxxxxxxxxxxxxxxxxxxxxxx is a 1


xxxxxxxxxxxx is a zero

in a good signal the 1 and zeros should be inline







There may be lots of noise in there as well but it will be decoded after several mins.

If you don't have a crystal the rows of 1 and zeroes will drift and will not be inline.








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.

This means a RTC is not required.

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.

See my post above.

Looks like the formatting has gone when I posted it.

In a quartz crystal the start of each 1 or zero should be inline down the page.

In a resonator the 1 and zeros will not be in line down the page and will drift.

Hi Brett,

Exquisite Instructable thank you.

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

"'time_t' in namespace 'DCF77_Clock' does not name a type".

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.

Many thanks


10 replies

That worked a treat thank you.

I had also upgraded the arduino ide and that destroys all previous libraries and work which is infuriating and unnecessary and "they" really ought to look at upgrades which add to the existing rather than delete it all.

Any way I'll upload a photo or two once my efforts on your master clock are a little more glamorous.


Hi D6 glad that worked I will paste a link to the v2 library on my site and instructable.

Look forward to seeing your photos.

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?

Also my dcf77 pins are marked "SDO, GND, PON, TCON, VDD" and I can't dcf77 seem to be able to get any info to correlate those to your pins "DCF77 Sig and DCF77 Mon" - what would you suggest for this?

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.

Are you perhaps using an Arduino Mega which does have digital pins that high? Or do you have a "special" Uno? or am I being daft?

My old school motto was "Perseverance" and I'm not about to give up as it really is a beautiful project.

Many thanks


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

Hope this helps.

Hi, just a major stumble - I have the dcf77 wired as follows:

vdd = 3.3vdc

tcon = analog 1

pon = gnd

gnd = gnd

sdo = nc

However the dcf77 flickers away for hours without producing a time for the clock.

Have I wired this incorrectly? And what and where is the dcf monitor connection?

I am getting SO close ...

Thank you


Oh and also - what is the "EZLink"? 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.

Still blinking away in the corner 36 hours now and no initialisation ....

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.

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

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

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.

I'll let you know when the test-bed version is up and running.


Aha there you see? - I knew I was being daft.

Thank you


Nice looking project with interesting features. The .gif(s) you included give the Instructable a very attractive layout.

Thanks for sharing. Saludos.