Binary Desk Clock: by Taifur
Binary Desk Clock: by Taifur
by taifur
Binary Clocks are awesome and exclusively for the person who knows the binary. If you are a tech guy this weird
clock is for you. So, make one by yourself and keep your time secret!
https://www.youtube.com/embed/B_1klIlCcmA
2. DS3231 RTC Module (buy from aliexpress.com) 1. CNC 3018 PRO Laser Engraver Wood CNC
Router Machine (buy from aliexpress.com)
3. MAX7219CNG LED Driver IC (buy from
aliexpress.com) 2. Soldering Station (buy one from aliexpress.com)
4. 20 PCS Blue LED, 5mm (buy from aliexpress.com) 3. Wire Cutter (buy from aliexpress.com)
5. 20 PCS Playing Marble (buy from aliexpress.com) 4. Titanium Coated Carbide End Milling Cutter for
CNC (buy from aliexpress.com)
6. Resistor 10K
7. Wires
Varnish can provide a beautiful finish to wood Before applying the varnish you need to remove any
projects and paintings. Before applying varnish to imperfections and blemishes before applying the
wood, sand your piece and clean your workspace. varnish. To do that Use 100 grit sandpaper for
Apply the varnish in several thin layers, letting each unfinished pieces, and work with the grain of the
one dry thoroughly before proceeding to the next. To wood. Sand gently until the piece is smooth. After
varnish a painting, let it dry completely and then cleaning the wood piece apply the varnish in a well-
carefully brush the varnish on. One coat is enough for ventilated area.
many paintings, but you can add an additional layer
as long as you first let the previous one dry
thoroughly.
The main component of the clock is an Arduino Pro individual LEDs while using only 3 wires for
Mini microcontroller board and a DS3231 RTC communication with the Arduino, and what’s more we
module. The connection of the Arduino Pro Mini and can daisy chain multiple drivers and matrixes and still
the RTC module is very simple. You need to connect use the same 3 wires.
SDA pin of the RTC module to the SDA pin of the
Arduino and SCL pin of the RTC module to the SCL The 64 LEDs are driven by 16 output pins of the IC.
pin of the Arduino. SDA and SCL pins are actually The question now is how is that possible. Well the
A4, and A5 pin of Arduino respectively. You also maximum number of LEDs light up at the same time
need to make a common ground connection between is actually eight. The LEDs are arranged as 8×8 set
Arduino and RTC modules. I used jumper wires to of rows and columns. So the MAX7219 activates
make the connections. each column for a very short period of time and at the
same time it also drives each row. So by rapidly
For showing hour, minute and second a binary clock switching through the columns and rows the human
required 20 LEDs. Arduino board has a limitation of eye will only notice a continuous light.
the GPIO pins. So, I used MAX7219CNG LED driver
IC for driving tons of LEDs using only three pins of The VCC and GND of the MAX7219 go to the 5V and
the Arduino board. GND pins of the Arduino and the three other pins,
DIN, CLK, and CS go to any digital pin of the Arduino
The MAX7219 driver IC is capable of driving 64 board. If we want to connect more than one module
we just connect the output pins of the previous DOUT pin of the previous board goes to the DIN pin
breakout board to the input pins of the new module. of the new board.
Actually these pins are all the same except that the
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.
/*
GIT: https://github.com/jarzebski/Arduino-DS3231
*/
#include
#include
#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;
Binary Desk Clock: Page 7
RTCDateTime dt;
LedControl lc=LedControl(12,11,10,1);
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 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;
hours_one = hours%10;
hours_ten = hours/10;
minutes_one = minutes%10;
minutes_ten = minutes/10;
seconds_one = seconds%10;
seconds_ten = seconds/10;
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);
In this stage, I will put all the LEDs to the holes of the cathode pin of a led to a digit pin of the IC and anode
wood. The connection of the LEDs is shown in the pin of the led to a segment pin of the IC. So, our
schematic. As we will use MAX7219 LED driver to column pins should be connected to the segment pins
drive the LEDs, all the LEDs must be connected in and row pins should be connected to the digits pin of
matrix form. So, I connected the anode pins of all the MAX7219.
LEDs in every column together and all the cathode
pins of every row together according to the You need to connect a resistor between ISET pin and
schematic. Now, our column pins are actually anode the VCC of the MAX7219 IC and this resistor control
pin and row pins are actually cathode pin. the segment pins current. I used a 10K resistor to
maintain 20mA in each segment pin.
For driving LEDs using MAX7219 you must connect
In this stage, I connected all the LEDs in a row- In this structure, no resistor is required because
column format. I need to use an extra jumper wire to MAX7219 will take care of the current. Before placing
connect the leds but you can made the connection the LEDs i will suggest you check every led. Because
without the help of extra wires if the lead of the LEDs placing a bed led will kill lots of time.
are long enough.
Our circuit board including RTC, Arduino, and MAX7219 is ready and we also prepared the LED matrix. Now we
need to connect al the things together according to the schematic. I used hot glue for fixing all the circuits in place
and avoiding any short circuit. I also added three button switches for adjusting the time. The buttons are placed at
the top right corner so that it can be easily accessible.
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. I applied hot glue in every hole at the top of the LEDs and gently placed the
marble in every hole. It will increase the slowness of the led. I used BLUE LED for my clock. It gives me the best
result.