Binary Desk Clock

by taifur in Circuits > Clocks

9927 Views, 66 Favorites, 0 Comments

Binary Desk Clock

cov11.jpg
IMG_20200123_140007.jpg
IMG_20200123_141150.jpg
IMG_20200124_135056.jpg
IMG_20200124_143518.jpg

Binary Clocks are awesome and exclusively for the person who knows the binary (the language of the digital devices). If you are a tech guy this weird clock is for you. So, make one by yourself and keep your time secret!

You will find lots of binary clocks of different types on the Internet. Even you can buy a binary clock from online store like amazon.com. But this clock is different from all and here I used playing marble to give it an elegant look.

Before going down please watch the demo video.

Bill of Materials

11.jpg
images (1).jpg
images.jpg

Hardware Components

1. Arduino Pro Micro (buy from aliexpress.com): This is the main heart of the clock and reads the time from RTC and give instruction to drive the LEDs accordingly. You may use Arduino Nano even Arduino Uno instead of Pro Micro if the size doesn't matter for you.

2. DS3231 RTC Module (buy from aliexpress.com): The DS3231 RTC keeps track of the time even when the power goes off. Though other RTC like DS1307 can be used the DS3231 is more accurate.

3. MAX7219CNG LED Driver IC (buy from aliexpress.com): Arduino has a limited number of pins. So, if you want to drive tons of LEDs without wasting Arduino pins MAX7219 is the lifesaver. It takes serial data and can drive 64 LEDs independently.

4. 20 PCS Blue LED, 5mm (buy from aliexpress.com): Blue gave the best result for me. You can try with other colors.

5. 20 PCS Playing Marble (buy from aliexpress.com): Standard size playing marble was used. The marble must be transparent to pass light.

6. Resistor 10K: Used to control the segment current of the MAX7219 IC. See the datasheet to know the exact value for different segment current.

7. Wires

8. Prototype PCB Board (buy from aliexpress.com): I used a prototype PCB board for MAX7219 IC with an IC base. You may also design your custom PCB board.

Hardware Tools

1. CNC 3018 PRO Laser Engraver Wood CNC Router Machine (buy from aliexpress.com): Theis DIY CNG machine was used for carving on the wood for marble and LEDs. This is an excellent machine with a low price for any maker and hobbyist.

2. Soldering Station (buy one from aliexpress.com): Some soldering is required for the project and a good soldering iron is a must-have tool for a maker. 60W is a good choice for DIY soldering.

3. Wire Cutter (buy from aliexpress.com)

4. Titanium Coated Carbide End Milling Cutter for CNC (buy from aliexpress.com): You may also try with the bit provided with the machine. In that case, you should make some changes to the design.

Engraving and Carving

IMG_20200118_105616.jpg
easal environment.png
IMG_20200116_203124.jpg
IMG_20200116_213925.jpg
IMG_20200118_105604.jpg

I took a 165X145X18.8 mm Soft Maple wood piece for placing the LEDs of the clock. At the top of every led, I will place a marble and the size of a standard playing marble is 15.5mm in diameter. So, I made 15.7 mm holes with a depth of 7mm. At the center of the hole, I made a 5mm drill for placing the LED. All the text was made with 2mm depth. You may increase or decrease the depth of your choice. You may also try laser engraving for the text.

The complete design was made by Easel from Inventables. Easel is a web-based software platform that allows you to design and carve from a single, simple program and most of the features are free to use. You only required to login to the system by creating an account or using Gmail.

Easel Pro is membership-based cloud software that builds upon Inventables’ free Easel software. Easel and Easel Pro minimize the barriers associated with complicated CAD and CAM product manufacturing software, making it easy for users to produce physical products.

Using Easel you can export the design file in G-code format or directly set up your CNC from the Easel environment and sent the command to the CNC. In that case, you need to install the driver for the Easel. You can also import a previously created G-code into the Easel IDE and modify. I included the design file herewith. You can easily modify the design according to your choice using Easel.

Sanding and Applying Varnish

IMG_20200120_141631.jpg
IMG_20200120_142017.jpg
IMG_20200120_142100.jpg
IMG_20200120_142311.jpg

Varnish can provide a beautiful finish to wood projects and paintings. Before applying varnish to wood, sand your piece and clean your workspace. Sanding gives a smooth look and prepares the wood for varnish. Apply the varnish in several thin layers, letting each one dry thoroughly before proceeding to the next. To varnish a painting, let it dry completely and then carefully brush the varnish on. One coat is enough for many paintings, but you can add an additional layer as long as you first let the previous one dry thoroughly.

Before applying the varnish you need to remove any imperfections and blemishes before applying the varnish. To do that Use 100 grit sandpaper for unfinished pieces, and work with the grain of the wood. Sand gently until the piece is smooth. After cleaning the wood piece apply the varnish in a well-ventilated area.

Varnish saves the wood from environmental dust and moisture but it can affect the color of the wood.

Making the Circuit

IMG_20200120_154052.jpg
binary_clock_schematic_bb.png
IMG_20200120_152631.jpg
IMG_20200120_155020.jpg

The main component of the clock is an Arduino Pro Mini microcontroller board and a DS3231 RTC module. The connection of the Arduino Pro Mini and the RTC module is very simple. You need to connect SDA pin of the RTC module to the SDA pin of the Arduino and SCL pin of the RTC module to the SCL pin of the Arduino. SDA and SCL pins are actually A4, and A5 pin of Arduino respectively. You also need to make a common ground connection between Arduino and RTC modules. I used jumper wires to make the connections.

The connection between Arduino and DS3231 RTC:

Arduino DS3231
SCL (A5) SCL
SDA (A4) SDA
5V VCC
GND GND

For showing hour, minute and second a binary clock required 20 LEDs. If you want to show date it requires more. Arduino board has a limitation of the GPIO pins. So, I used MAX7219CNG LED driver IC for driving tons of LEDs using only three pins of the Arduino board.

The MAX7219 driver IC is capable of driving 64 individual LEDs while using only 3 wires for communication with the Arduino, and what’s more, we can daisy chain multiple drivers and matrixes and still use the same 3 wires.

The 64 LEDs are driven by 16 output pins of the IC. The question now is how is that possible. Well, the maximum number of LEDs light up at the same time is actually eight. The LEDs are arranged as an 8×8 set of rows and columns. So the MAX7219 activates each column for a very short period of time and at the same time it also drives each row. So by rapidly switching through the columns and rows the human eye will only notice a continuous light.

The VCC and GND of the MAX7219 go to the 5V and GND pins of the Arduino and the three other pins, DIN, CLK, and CS go to any digital pin of the Arduino board. If we want to connect more than one module we just connect the output pins of the previous breakout board to the input pins of the new module. Actually these pins are all the same except that the DOUT pin of the previous board goes to the DIN pin of the new board.

The connection between Arduino and MAX7219CNG:

Arduino MAX7219
D12 DIN
D11 CLK
D10 LOAD
GND GND

Uploading the Program

prog.png

The whole program is written in Arduino environment. Two external libraries were used for the sketch. One is for the RTC module and another is for the MAX7219 IC. Download the libraries from the link and add to the Arduino IED before compiling the program.

Uploading program in Arduino Pro Mini is a bit tricky. Take a look at the tutorial if you never use Arduino Pro Mini before: https://alselectro.wordpress.com/2017/05/14/arduin...

/*
  GIT: <a href="https://github.com/jarzebski/Arduino-DS3231">  https://github.com/jarzebski/Arduino-DS3231
>
  GIT: <a href="https://github.com/wayoda/LedControl">  https://github.com/jarzebski/Arduino-DS3231
>
*/

#include "Wire.h"
#include "DS3231.h"
#include "LedControl.h"

/*
 Now we need a LedControl to work with.
 ***** These pin numbers will probably not work with your hardware *****
 pin 12 is connected to the DataIn 
 pin 11 is connected to the CLK 
 pin 10 is connected to LOAD 
 We have only a single MAX72XX.
 */
 

DS3231 clock;
RTCDateTime dt;
LedControl lc=LedControl(12,11,10,1);

int seconds, minutes, hours;
byte number[10]={B00000000,B01000000,B00100000,B01100000,B00010000,B01010000,B00110000,B01110000,B00001000,B01001000};

void setup()
{
   //Serial.begin(9600);
    /*
   The MAX72XX is in power-saving mode on startup,
   we have to do a wakeup call
   */
  lc.shutdown(0,false);
  /* Set the brightness to a medium values */
  lc.setIntensity(0,15);
  /* and clear the display */
  lc.clearDisplay(0);
  //lc.setLed(0,row,col,true);

//  lc.setRow(0,0,B11111111);
//  lc.setRow(0,1,B11111111);
//  lc.setRow(0,2,B11111111);
//  lc.setRow(0,3,B11111111);
//  lc.setRow(0,4,B11111111);
//  lc.setRow(0,5,B11111111);
 // lc.setColumn(0,2,B11111111);
 // lc.setColumn(0,3,B11111111);
 // lc.setColumn(0,4,B11111111);
 // lc.setColumn(0,5,B11111111);


  // Initialize DS3231
  clock.begin();
  // Set sketch compiling time
  //clock.setDateTime(__DATE__, __TIME__);
  pinMode(5, INPUT_PULLUP);
  pinMode(6, INPUT_PULLUP);
  pinMode(7, INPUT_PULLUP);
}

int menu = 0, up, down;

int hours_one;
int hours_ten;
int minutes_one;
int minutes_ten;
int seconds_one;
int seconds_ten;
  
void loop()
{ 
  if(digitalRead(5)==0){
    delay(300);
    menu++;
    if(menu>3) menu = 0;
    }
    
  if(menu==0){
  dt = clock.getDateTime();
  
  hours =  dt.hour;
  minutes = dt.minute;
  seconds = dt.second;

  if(hours>12) hours = hours - 12;
  if(hours==0) hours = 1;

  hours_one = hours%10;
  hours_ten = hours/10;

  minutes_one = minutes%10;
  minutes_ten = minutes/10;

  seconds_one = seconds%10;
  seconds_ten = seconds/10;

  lc.setRow(0,0,number[seconds_one]);
  lc.setRow(0,1,number[seconds_ten]);
  lc.setRow(0,2,number[minutes_one]);
  lc.setRow(0,3,number[minutes_ten]);
  lc.setRow(0,4,number[hours_one]);
  lc.setRow(0,5,number[hours_ten]);
  }

  if(menu==1){
    if(digitalRead(6)==0){
      delay(300);
      hours++;
      if(hours>=24)hours = 0;
      }
    if(digitalRead(7)==0){
      delay(300);
      hours--;
      if(hours<0)hours = 0;
      }
    hours_one = hours%10;
    hours_ten = hours/10;
    lc.setRow(0,2,B00000000);
    lc.setRow(0,3,B00000000);
    lc.setRow(0,1,B00000000);
    lc.setRow(0,0,B00000000);
    lc.setRow(0,4,number[hours_one]);
    lc.setRow(0,5,number[hours_ten]);
    }
    
  if(menu==2){
    if(digitalRead(6)==0){
      delay(300);
      minutes++;
      if(minutes>=60) minutes = 0;
      }
    if(digitalRead(7)==0){
      delay(300);
      minutes--;
      if(minutes<0) minutes = 0;
      }
    minutes_one = minutes%10;
    minutes_ten = minutes/10;
    lc.setRow(0,4,B00000000);
    lc.setRow(0,5,B00000000);
    lc.setRow(0,1,B00000000);
    lc.setRow(0,0,B00000000);
    lc.setRow(0,2,number[minutes_one]);
    lc.setRow(0,3,number[minutes_ten]);
    }
    
  if(menu==3){
    clock.setDateTime(2020, 4, 13, hours, minutes, 01);
    menu = 0;
    }
  

  //lc.setLed(0,row,col,false);
  //lc.setLed(0,row,col,true);
  //lc.setColumn(0,col,B10100000);
  //lc.setRow(0,4,B11111111);
  //lc.setRow(0,row,(byte)0);
  //lc.setColumn(0,col,(byte)0);

//   For leading zero look to DS3231_dateformat example
//  Serial.print("Raw data: ");
//  Serial.print(dt.year);   Serial.print("-");
//  Serial.print(dt.month);  Serial.print("-");
//  Serial.print(dt.day);    Serial.print(" ");
//  Serial.print(dt.hour);   Serial.print(":");
//  Serial.print(dt.minute); Serial.print(":");
//  Serial.print(dt.second); Serial.println("");
//
//  delay(1000);
}

Placing the LEDs

IMG_20200121_103126.jpg
led_connection_bb.png
IMG_20200121_103758.jpg
IMG_20200121_104308.jpg

In this stage, I will put all the LEDs to the holes of the wood board. The connections of the LEDs is shown in the schematic. As we will use MAX7219 LED driver to drive the LEDs, all the LEDs must be connected in matrix form. So, I connected the anode pins of all LEDs in every column together and all the cathode pins of every row together according to the schematic. Now, our column pins are actually anode pins of LEDs and row pins are actually cathode pins of LEDs.

For driving LEDs using MAX7219 you must connect cathode pin of a led to a digit pin of the IC and anode pin of the led to a segment pin of the IC. So, our column pins should be connected to the segment pins and row pins should be connected to the digits pin of the MAX7219.

You need to connect a resistor between ISET pin and the VCC of the MAX7219 IC and this resistor control the segment pins current. I used a 10K resistor to maintain 20mA in each segment pin.

Connecting LEDs

IMG_20200121_112152.jpg
IMG_20200121_113822.jpg
IMG_20200121_113835.jpg

At this stage, I connected all the LEDs in a row-column matrix format. I needed to use some extra jumper wires to connect the LEDs but you can make the connection without the help of extra wires if the leads of the LEDs are long enough to touch one another.

In this configuration, no resistor is required because MAX7219 will take care of the current. Your duty is to select the right value for the ISET resistor and pull up the ISET pin with this resistor. Before placing and connecting the LEDs I will suggest you check every LED. Because placing a bad LED will kill lots of time. In the next step, we will connect the row and column wires to the MAX ic.

Connecting Circuit Board With the LEDs

IMG_20200121_113840.jpg
IMG_20200124_110820.jpg
IMG_20200124_110827.jpg

Our circuit board including RTC, Arduino, and MAX7219 is ready for a long time and we also prepared the LED matrix in the previous stage. Now we need to connect al the things together according to the schematic. First, we need to connect the row and column wires to the MAX7219IC. The connection was mentioned in the schematic. To make it more clear follow the table given below.

LED Matrix MAX7219CNG
ROW0 DIGIT0
ROW1 DIGIT1
ROW2 DIGIT2
ROW3 DIGIT3
COLUMN0 SEGA
COLUMN1 SEGB
COLUMN2 SEGC
COLUMN3 SEGD
COLUMN4 SEGE
COLUMN5 SEGF

ROW0-> Topmost row

COLUMN0 -> Rightmost column (SS COLUMN)

After making the connection you need to fix the PCB board and Arduino with the wood piece to avoid breaking the connection. I used hot glue for fixing all the circuits in place. To avoid any short circuit use a big amount of glue to hide the solder joint at the bottom side of the PCB.

For making a clock usable you need to keep an option for adjusting the time when required. I added three button switches for adjusting the time. One for changing option and two for incrementing and decrementing hour and minute. The buttons are placed at the top right corner so that these can be easily accessible.

Placing the Marbles

IMG_20200121_165536.jpg
IMG_20200124_135325.jpg
IMG_20200123_111026.jpg
IMG_20200124_135323.jpg
IMG_20200124_143542.jpg
IMG_20200124_142710.jpg

This is the final stage of our project. All the circuit connection is completed. Now you need to place the marble at the top side of the wood clock. For placing the marbles I used hot glue. Use transparent white color glue stick for the purpose. I applied hot glue in every hole from the top side and on top of the LEDs I gently placed the marble in every hole. Adding glue evenly will increase the glow of the led. I used BLUE LED for my clock. It gave me the best result.

Give power to the clock. If it shows time then Congratulation!!!

You made it!

Enjoy!