Binary Clock in 7-Segments LED Display

1,824

14

4

Published

Introduction: Binary Clock in 7-Segments LED Display

About: I'm a Mechanical Engineer and an enthusiastic Maker. I like to create and code my projects using the Arduino.

Hello all,

This project will show you an unpublished Binary Clock using LED display of 7 segments (see VIDEO) and controlled by an Arduino.

The idea is very simple, just converting binary data of hours, minutes and seconds into "A to G" segments of display.

I've never seen before this concept and the results are very interesting and may also can be developed in many other ways in future.

In this post I will introduce you two versions:

1) Using my LED Display Module.

2) Using Display 4 digits x 7 segments (TM1637 - Catalex)

Let's see them !!

Step 1: Material List

Components:

  • 01 x LED display Catalex TM1637 (07 Segments x 04 Digits)
  • 01 x Arduino UNO R3
  • Some wires

Optional:

  • 01 x Multiple LED Display Module
  • 01 x FYQ-5642AX(Common Anode LED Display 07 Seg x 04 Dig)

Step 2: Development & Arduino Programm

1) Version with Catalex LED display (TM1637)

In this version I used a serial display Catalex with no mask.

Note: The schematics are also available in this step.

  • Arduino programming (TM1637 - Catalex Display)

2) Setup the time

The following statements in the program are used for the setup of hour and minutes.

Just adjust them before compile the program to Arduino as shown in this example:

hh = 16;   //Initial setup of hours<br>mm = 17;   //Initial setup of minutes

Step 3: How It Works

The main principle of this project is Binary Number.

For each number of hours, minutes and seconds you need to convert them from base-10 (decimal) to base-2 (binary) and them to code them into segments from "A to G" of the display.

But that is very easy using the Arduino programming.

All integer numbers inside the range of hours (00 to 23), minutes and seconds (00 to 59) are lower than 64 and so they can be arranged into the 7 segments.

Take a look on this:

// A

// ------ // | | // F | | B // | G | // ------ // | | // E | | C // | D | // ------ // 0 // ------ // | | // 16 | | 1 // | 32 | // ------ // | | // 8 | | 2 // | 4 | // ------

You can see the perfect corresponce between: Segments -->>-- Binary (Base-2)

G=32 / F=16 / E=8 / D=4 / C=2 / B=1 / A=0 

32 16  8  4  2  1  0

G  F  E  D  C  B  A

But hey !!! There is a trick here !

Remember that Base-2 starts from 1 (2 power 0) and not zero !!

Zero in this case means that the corresponding segment of display will be set to Off and I want that the first segment must be set to On.

How can we do this?

Take a look on following statements of programming:

<p>if (mm == 0) {<br>        shiftOut(dataPin, clockPin, MSBFIRST, 1);
      }
      else {
        shiftOut(dataPin, clockPin, MSBFIRST, mm << 1);
      }</p>

First I check if the variablle mm (minutes) is zero. If yes, I force the LED to be set to On.

For all the numbers higher than zero, I shift left one position of binary number to correspond to the correct segment that I need with the command hh << 1.

Example:

Minutes = 0 then binary is 00000000 and it will be set to 00000001

Minutes = 5 then binary is 00000101 and it will be shift left one position to 00001010

Step 4: Conclusion

Now you have an original binary clock and learnt something about base-2 numbers and programming.

The programs shown here work as example for future developments.

You can add more features on this clock using a RTC (Real Time Clock) for example or add some buttons to setup the time.

Use your imagination and go ahead.

I hope you have enjoyed this simple project and feel free to send your questions and comments.

Regards,

LAGSILVA

10.June.2016

Share

    Recommendations

    • Clocks Contest

      Clocks Contest
    • Planter Challenge

      Planter Challenge
    • Woodworking Contest

      Woodworking Contest
    user

    We have a be nice policy.
    Please be positive and constructive.

    Tips

    Questions

    4 Comments

    Hi, I tried to make this with a 7-segment LED HT16K33 backpack and it doesnt seem to be working. Any idea what I can do to make it work :-\

    I love this project

    IMG_2691.JPG
    1 reply