Embedded microcontroller powered binary timer with inbuilt oscillator

This project has won me the first prize at IEEE GIKI Chapter All Pakistan Electronics Olympiad.

If you have been wondering how it looks like, here you go:

Well, the basic idea behind this binary clock is its ability to count time in normal decimal and convert the digits into binary coded decimal every second. Then it uses a sequence of Light Emitting Diodes to display its “zeroes” and “ones”, with an ON LED denoting a 1 and an OFF LED indicating a 0.

There are buttons to set the time, so you can use the timer as a real time clock.

Firstly, what you must have been waiting for, the source code of the firmware. Each and every line of code is my own work.

See the complete code here.
int baseConv(int i){
int binaryNum = 0, multiplier = 1;
for (int n = 0; n < 4; ++n){
binaryNum += ( i % 2 ) * multiplier;
i /= 2;
multiplier *= 10;
return binaryNum;

Yes, the blinking LEDs actually show the time in binary. See the following image:

LEDs showing time in binary.

See each row of LEDs denotes an ascending power of 2. The bottom most row is 2^0 which is 1. Next is 2^1 which is 2, followed by 2^2 and then 2^3.

For example…..The following state of the display shows the time 06:01:01

The display required 80 LEDs to be soldered!

In binary, the base is 2 so it must be clear by now! In binary, there are only two digits, 0 and 1, (or you can say an ON LED and an OFF LED)!

This is the principle of operation of the device. This can actually be done using flip flop integrated circuits but the circuit would be like 10 times bigger, so yes, this is a condensed version (using a microcontroller). Here’s how my final circuit looked like:

The large black thingy is the microcontroller (with the program code burnt inside it). The transistors you see are to amplify the 5V from the micro to 12V (so we can get a brighter looking display).

Thanks for reading!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s