# Binary clock project

#### count_volta

Joined Feb 4, 2009
435
Hi, I have designed a binary clock using what they taught me so far in Engineering School. Now I'm going to build it and put it on my desk.

Basically its just a bunch of counters made from D flip flops with logic in between to detect 60 seconds, 60 minutes, and 24 hours. There is also other logic to do various other tasks. I will post the schematic eventually.

I designed the entire thing myself, all inspired from a simple 4 bit counter with T flip flops that I read about in my digital logic book. Then I just extended that small counter to use D flip flops and to make it into a clock. Its the first thing I ever designed, so I'm excited LOL.

I'm going to build this clock over the next month or so on a perfboard. This project should help improve my soldering skills as well.

I will keep all posts related to this project in this thread, and eventually have plans to transfer it over to the Completed Projects forum with schematics and detailed explanations.

For now I am bound to have many questions, and already do, so I will ask all the questions in this thread, and hopefully you guys will be kind enough to help me out. Thanks.

#### count_volta

Joined Feb 4, 2009
435
First thing is, we are learning about the many wonderful uses of comparators in EE school right now, and this gave me an idea.

I came up with a little circuit, that when the power goes out my clock power will be transferred over to a 5V battery source.

Ah right I forgot to say that I plan to use a 5V power adapter as the power source of the binary clock.

So a picture of the little circuit I came up with is attached to this post. Basically, when the power goes out, the comparator will turn on, thus powering a relay which will transfer power to the 5V battery.

I did not look into the details of what voltage the relay coil needs to close the switch and blah blah. So far its an idea.

So my question is, when the power goes out, the power to the clock will go to 0V for a second at least, thus clearing the current state of the clock counters.

Then the comparator will turn on, the delay of the relay needs to be accounted for and only about 2 seconds or so after the power goes out will my clock have power again from the battery. But now it will start from 0 hrs 0 mins 0 seconds.

On the one hand this is a useful thing, as it will tell me how many hours it has been since the power went out. On the other hand my clock will forget what time it is and that is bad.

So I'm thinking is there a way to make the transition between when the power goes out and when the power switches to the battery be so small that the clock will not forget what time it is? Or maybe add a capacitor or something so that power to the clock is never lost in the first place when the house power goes out.

Any suggestions guys? Thanks.

#### Attachments

• 28.8 KB Views: 58

#### count_volta

Joined Feb 4, 2009
435
Nah, I want to basically go with my idea. Sure I can google battery backup circuit, but where is the fun in that.

I will think about it a little more, I think a capacitor can do the trick.

#### count_volta

Joined Feb 4, 2009
435
I figured it out.

When the household power dies, the capacitor slowly begins to discharge, if the capacitor is large, the time it takes the relay to turn on and to switch to battery power will be fast enough, and thus the digital clock circuit will never really lose power in the transition and not lose its memory. Now I gotta try if this works.

Last edited:

#### JoeJester

Joined Apr 26, 2005
4,390
Where is your comparator getting it's +5V.. Vcc? Don't you think that is a critical part of your "power failure detection?

I still think you will lose your 1 PPS (pulse per second).

#### count_volta

Joined Feb 4, 2009
435
Where is your comparator getting it's +5V.. Vcc? Don't you think that is a critical part of your "power failure detection?

I still think you will lose your 1 PPS (pulse per second).
The comparator is getting 5V from the backup battery. The input impedance of the comparator is extremely high and thus the battery should not die for a long time.

I want to build this circuit and test it. I still need to figure out what voltage I should apply to the relay coil, so then the comparator VCC might even be lower than 5V.

I will report on the results.

#### tom66

Joined May 9, 2009
2,595
The comparator draws at least 1mA when idle (not input current.) Your battery will be dead in a couple weeks.

I suggest a PMOS transistor with the gate wired to your power source (<20V), the drain wired to the positive terminal of your battery, the source wired to the main 5V line. The PMOS transistor will switch over in a few microseconds, with a small capacitor (<1000µF) the transition will go unnoticed except by the reduced voltage from the battery.

This is very similar to the system used in laptops.