Project: 12 Hour Clock Using Decade Counters

Thread Starter

kurtruk

Joined Aug 26, 2012
140



First off, I would like to give an explanation of how my clock works.

I'll start with the power supply. The alternating current is stepped down by the transformer. The AC is then passed through a bridge rectifier and some Capacitors, to get roughly 6.3V DC. The voltage regulator smooths the signal farther, and keeps it at a steady 5V. I included a LED and resistor to indicate when the power supply is on. I used a old AC chord salvaged from some non-working electronic appliance, and a container I had laying around from something. and made it into a wall-wart type power supply.

Next is the 1Hz time-base. This is the core of the clock. I originally was going to use a 32.768kHz crystal and a frequency divider such as the 4060. I accidentally ordered the wrong resistor and capacitor values and tried to wire them in parallel and series to get close to the approximate values. This however only worked part of the time, and eventually after I broke some ceramic capacitors out of frustration, became an alltogther non-ideal time-base. I took apart three clocks in order to build this time base. The first clock was digital, so it did not have any useable outputs. The second clock I was a cheap analog clock that I ended up frying. The third clock, I was able to use. Most analog clocks will have two .5Hz outputs to turn the second shaft once every second. Using a voltage divider circuit we supply the hacked clock with an appropriate amount of voltage. The two .5Hz outputs are then added together using two standard diodes to get 1Hz. From here things get tricky, and depend largely on the hacked clock. Using a 5V power supply the typical minimum high logic voltage level is 3.5V. Theoritically the output from the hacked clock could not be more than the supplied voltage (2.5V0, which is not enough to drive the decade counter. Somehow my hacked clock time base started working by putting a diode and resistor between the output and GND. I started a thread with a theory as of why, but didn't get much response. Basically I think that there is two circuits. One is through the hacked clock and has a voltage drop of 2.5V. And another one is through the diode and resistor between the output and GND, and has a voltage drop of about 5V. Every hacked clock will be different so it will take some testing and experimentation to find something that works for your hacked clock.

There is two LEDs between each of the 2 digit displays this represents the colon in time i.e. 12:30.

I will split the rest of the schematic up into 3 main parts: seconds, minutes, and hours.

Seconds: The 1Hz signal from the time-base is fed to the enable pin of the decade counter. I used a 4518. The enable pin is almost the same as the clock pin except, that the enable pin of the decade counter will count on the falling edge of the signal. The reset and clk are held low. Since the 4518 is a decade counter it counts from 0-9 and automatically resets. Therefor the binary sequence is as follows; 0000, 0001, 0010, 0011, 0100, 0101, 0110, 0111, 1000, 1001. If there is a connection from Q3 (the 4th binary place) to the enable of the next decade counter, then at 1000 (8), it will go high and remain high until the counter starts over from zero. Therefor the next counter counts after 10 seconds have elapsed. The next counter needs to increment at 6, so I a connected a AND gate to Q1 and Q2. Thus the output it high at 0110 (6), and resets the counter back to 0. This high signal is also connected to the enable of the next counter. The Binary outputs of the counters are led to a BCD decoder. I used a 4511. This takes the Binary input and then tells a 7 segment display, what segments to light to correspond to the decimal number. Because I find seconds display quite annoying on clocks, I attached a switch to blank out the seconds display and also the colon ( It would look silly for the time to be: 4:59:).

Minutes: The minutes unit works the same way except, that there needs to be a way to set the time. For this I used a SPST momentary switch, and a OR gate. The input of the switch is connected to out 1Hz timebase. The output is connected to the OR gate. The output of the switch is held low when not pressed by a pull-down resistor. The OR gate is used to ensure that the clock set signals and the minute increment signals do not conflict. Other than this the minutes work the same way as the seconds.

Hours: The hours work under the same principles, but more complicated because it has to count to 12 and them start over at 1. Another complication is, that I didn't want the time to be 01:23:45 instead it should be 1:23:45. To do this first of all I decided that I only need to use segments B and C on the 7 segment display, because it only needed to display 1 or nothing at all. I grounded all the other inputs to avoid floating. I also decided that since it was either on or off I did not need a BCD decoder. The first digit works pretty much the same way as the first digit of the minutes and seconds, except that it has a three input OR gate to it's enable pin (made out of two two input OR gates for convenience). The first input is used to increment the counter. The second input is used to set the hours. The third input pin of the OR is used to cause the counter to begin at 1 instead of zero. When the clock is at 13 the three input AND gate (once again made from two two inputs ANDs) goes high resetting both counters of the hours. The output of the AND gate also goes to the input of of the OR gate. Aided by propagation delay of the two ORs, by the time the high signal makes it to the enable of the counter the reset has gone back to low. Therefor the counter can counter puts out a 1. This all happen way too fast too see. The transistor is used as a simple switch because the max output current of the counter is 10mA which is too little to drive the two segments of the display.

Each segment of the display has a current limiting resistor of 180 Ohms.
BOM:
1 Bridge recitifier (I used DF02M)
1 5V voltage regulator
1 Transformer
1 1000uF Capacitor
1 .3 uF Capacitor
10 .1uf Capacitor (for Power Supply Bypass)
1 Hacked Clock
3 Standard diodes (I used 1N4148)
3 Dual decade counters (4511)
5 BCD decoders (4518)
4 2-Input ANDS (4081)
4 2-Input ORs (4071)
1 Fuse (I used .250A)
3 2 Digit 7 segment displays.
5 3mm LEDs
1 Standard Transistor
40 180 Ohm Resistors
2 10k Resistors
2 100k Resistors
4 270 Ohm Resistors.
1 360 Ohm Resistors.
2 SPST switches
1 SPDT switch
And of course something to build it on i.e. breadboard, perfboard, PCB, whatever you prefer.
And something to put the finished Clock in.

As always This parts list is very flexible and can be customized for one's own project.

I actually had three different PCBs. The first PCB contained the Displays and the current limiting resistors. The second PCB contained the BCD decoders. The third PCB contained the counters and logic gates. I stacked each board on top of each other using headers to connect them.

I like to think of building as three phases.
1. Planning: Making a schematic and drawings and planning how to build it.
2. Testing: Testing one/s schematic/ideas and making sure it works.
3. Creating the finished project.

Note: while testing is not necessary I would strongly advise it to avoid trouble. It is also a good idea to test your project as you build it, therefor if the finished project does not work, which is more than likely, you will now where to begin trouble shooting.


Once you have built the schematic and soldered it together, I would do a resistance check between GND and VDD to make sure there are not any shorts.

It is not my wish, that you take my schematic exactly as it is and build it. I find that by doing this one does not learn much and does not give their own personal touch on the project. For example I used Green 7 segments, because that's what color clock I like. You don't have to use green just because I did. Feel free to even completely change my design and improve upon it and be sure to give it your own personal flare.
 

Attachments

embpic

Joined May 29, 2013
189
Very Good Excellent
But i would like to suggest you that i saw your circuit diagram much larger if you think to build on any controller then it will be efficient in terms of time also and in terms of cost and size.

Reagds.
 

Thread Starter

kurtruk

Joined Aug 26, 2012
140
Very Good Excellent
But i would like to suggest you that i saw your circuit diagram much larger if you think to build on any controller then it will be efficient in terms of time also and in terms of cost and size.

Reagds.
Not quite sure what you mean. I know for timing applications a 555 timer would be more efficient if acurrecy is not needed. The reason I built this project was to learn about digital circuits and logic. The most efficient way to do would just program a microcontroller, but that is no fun.
 
Top