In this project, we are going to make a LED Binary Clock Using Arduino. Here we have designed a printed circuit board (PCB) to implement this clock. To design PCB layout, we have used EasyEDA online PCB designing tool.
- Arduino Nano
- DS1307 RTC
- 32.768Khz Crystal
- 3v coin cell
- Resistor 1k, 10k
- Power Supply
Circuit Diagram and Explanation:
This is very simple, cheap and interesting project for the learner. In this LED Binary Clock Circuit, we have used Arduino Nano to control the whole project like reading time from RTC and showing that on LEDs. A 3.0v coin cell is connected to RTC IC for backup. Learn more about using DS1307 RTC with Arduino here.
20 LEDs are connected here in matrix form. So here we have 6 columns and 4 rows. 2 columns used for showing hour, next two columns for minutes and next to columns for seconds. We have used 6 PNP transistor to triggers LEDs in 6 columns. The user can power the whole circuit by 5v only, here we have used laptop USB for power supply. Rest of connections are shown in circuit diagram.
Further, check the complete Arduino Code and Demonstration Video at the end of this Article.
How to Calculate and Read Time in Binary Clock:
As we are familiar with binary numbers that are zero and one. So by using these, we can show time and we can convert that binary time into the decimal. By using the number 8 4 2 1 (written on the Right side of PCB), we can convert binary to decimal.
Suppose we have a binary number like:
1 0 1 0 so it will be 10 in decimal. When we convert binary to decimal we only add ones.
Here from MSB (Most significant bit) side, we have 1 it means 8 and next is 0 means that is 0 and not to be included. Next is again 1 means 2 and the last is 0 so the last one will also not be included.
So finally we have
Basically, we can take it like this:
8x1 + 4x0 + 2x1 + 1x0 = 10
Now we can understand time from the picture:
In above, we can see there are 6 columns and 4 row. In these, we have 2 columns group HH for Hour, MM for Minute and SS for seconds. At the right side of PCB, we can see row numbers 1, 2, 4, and 8, these numbers are used for converting binary number to decimal
Note we are reading columns from Right-Hand side. So first of all, see HH columns, there are two columns of time. In the first column of time, there is no led is glowing means:
2x0 + 1x0 = 0
In next column, we can see there is single led is glowing in the 1-row means. So according to 8 4 2 1
8x0 + 4x0 + 2x0 + 1x1 = 1
So in Hour HH column, we got 01.
In the first column of MM (minutes), we can see there is single led is glowing in the 1-row means
4 2 1 4x0 + 2x0 + 1x1 = 1
In the second column of MM, we can see there is single led is glowing in the row number 8 means
8 4 2 1 8x1 + 4x0 + 2x0 + 1x0 =8
So we got minute as 18
In the first column of SS (seconds), we can see there is single led is glowing in the row number 4 means
4 2 1 4x1 + 2x0 + 1x0 = 4
In the second column of SS, we can see there is two led is glowing in the row number 1 and row number 4 means
8 4 2 1 8x0 + 4x1 + 2x0 + 1x1 =5
So we got minute as 45
So finally we have got time as 01:18:45
HH MM SS 01 18 45
Complete Arduino Code and Demonstration Video is given at the end of this Article.
Circuit and PCB Design using EasyEDA:
To design this LED Binary Clock Circuit, we have chosen the online EDA tool called EasyEDA. I have previously used EasyEDA many times and found it very convenient to use since it has a good collection of footprints and its open-source. Check here our all the PCB projects. After designing the PCB, we can order the PCB samples by their low cost PCB fabrication services. They also offer component sourcing service where they have a large stock of electronic components and users can order their required components along with the PCB order.
While designing your circuits and PCBs, you can also make your circuit and PCB designs public so that other users can copy or edit them and can take benefit from there, we have also made our whole Circuit and PCB layouts public for this Arduino Binary Clock, check the below link:
You can view any Layer (Top, Bottom, Topsilk, bottomsilk etc) of the PCB by selecting the layer form the ‘Layers’ Window.
You can also view the PCB, how it will look after fabrication using the Photo View button in EasyEDA:
Calculating and Ordering Samples online:
After completing the design of this Arduino Binary Clock PCB, you can order the PCB through JLCPCB.com. To order the PCB from JLCPCB, you need Gerber File. To download Gerber files of your PCB just click the Fabrication Output button in EasyEDA editor page, then download from the EasyEDA PCB order page.
Now go to JLCPCB.com and click on Quote Now or Buy Now button, then you can select the number of PCBs you want to order, how many copper layers you need, the PCB thickness, copper weight, and even the PCB color, like the snapshot shown below:
After you have selected all of the options, click “Save to Cart” and then you will be taken to the page where you can upload your Gerber File which we have downloaded from EasyEDA. Upload your Gerber file and click “Save to Cart”. And finally click on Checkout Securely to complete your order, then you will get your PCBs a few days later. They are fabricating the PCB at very low rate which is $2. Their build time is also very less which is 48 hours with DHL delivery of 3-5 days, basically you will get your PCBs within a week of ordering.
After few days of ordering PCB’s I got the PCB samples in nice packaging as shown in below pictures.
And after getting these pieces I have soldered all the required components over the PCB, placed the coded Arduino Nano and powered it with 5v supply to see the Binary Clock in Action.
Recommended TI Whitepapers
#define d1 12
#define d2 11
#define d3 10
#define d4 9
#define d5 8
#define d6 7
#define r1 6
#define r2 5
#define r3 4
#define r4 3
volatile int count=0;
void Clear(int d)
digitalWrite(13, digitalRead(13) ^ 1);
void show(int d)
DateTime now = RTC.now();