Digital clocks

Discussion in 'Feedback and Suggestions' started by Wendy, Mar 29, 2011.

  1. Wendy

    Thread Starter Moderator

    Mar 24, 2008
    20,766
    2,536
    I'm thinking of doing a series of submissions just on the various counters for a digital clock. Taken separately they aren't much, but build and repeat you could have a digital clock.

    Problem is, this is a popular homework assignment. I just saw a thread closed by Dave (good to see ya!) that had been hijacked twice (with poor results).

    Whatcha think, a valid concern, or is this a good idea? It would be 4 articles, a time base, a mod 10 counter w/ display, a mod 6 counter w/ display, and a mod 12 counter w/ displays.

    I get the feeling it won't help most of the people asking for clock designs, as they have trouble making the connections, but I could be wrong.
     
  2. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    I my school books. The sections about counters were quite thorough. So the problem is more lazy students, I think. Since this is a popular assignment. I would say no complete schematics. A block digram may be OK. As it may give a push in the correct direction. But nothing more. We can not take all the fun from the students.
     
  3. jpanhalt

    AAC Fanatic!

    Jan 18, 2008
    5,699
    907
    I wouldn't worry about homework cheaters. It is futile to try to control them, so why let them control what we do?

    Case on point, this morning there was a post advertising complete solutions for homework and FYP. No price was mentioned, but I assume that would be handled by PM. Besides, the more they cheat, the less competition for those who don't cheat and want to get ahead.

    John
     
  4. Georacer

    Moderator

    Nov 25, 2009
    5,142
    1,266
    I am in favour of posting schematics. I don't see how clock differ from any other circuit you have uploaded. I am sure the homework assignments will differ at least in one point from your uploads. Furthermore, any extensive content on clocks will give the Homework Helpers a reference link to take some work off their shoulders.
     
  5. magnet18

    Senior Member

    Dec 22, 2010
    1,232
    124
    I say go for the schematics, I found some full ones online without too much trouble, so you aren't giving the students any real advantage anyway.
    Also, I would like to see a section on features, like an am/pm light, blinking colons, alarm, ect.

    This reminds me... I really need to finish that darn nixie clock...
     
  6. Wendy

    Thread Starter Moderator

    Mar 24, 2008
    20,766
    2,536
    OK, just doodling at this point. A block diagram of the clock I'm thinking of...

    [​IMG]

    Hmmm, TTL or CMOS. I tend to favor CMOS, since the power supply isn't so picky.
     
  7. magnet18

    Senior Member

    Dec 22, 2010
    1,232
    124
    Wouldn't hours just be a divide by 10 and a divide by 2?
     
  8. Wendy

    Thread Starter Moderator

    Mar 24, 2008
    20,766
    2,536
    Think about it..

    11:00 PM
    12:00 AM
    01:00 AM

    Of course, the 24 hour vision works just fine

    23:00
    00:00

    When they invented the rules for clocks it was all analog baby.

    I'm thinking of an example of both for the TTL and CMOS argument. Still waffling.
     
  9. magnet18

    Senior Member

    Dec 22, 2010
    1,232
    124
    Hmm, guess you're right.
    With the nixie clock you just have to offset the cathodes by one.
     
  10. Wendy

    Thread Starter Moderator

    Mar 24, 2008
    20,766
    2,536
    CMOS it is. Rather than have several threads all over the place I'm putting them here. I'll reserve several pages at a whack for each article, and try to finish each section before moving on to the next. As a result this will be a long thread, I'm planning on it. If the mods would rather me do this somewhere else I can, but since this is for the ebook I think this would be appropriate here.

    The sections will be as follows:

    Introduction
    Time base from 50 Hertz
    Time base from 60 Hertz
    Precision time base from a crystal
    The Control Module
    Seconds, The Mod 10 Module
    Seconds, The Mod 6 Module
    Minutes, The Mod 10 Module
    Minutes, The Mod 6 Module
    Hours, The AM/PM Module
    Hours, The 24 Hour Module

    The idea is if every module is built separately you will wind up with a complete clock. If the interest is there I may do an alarm function, but this is a nice bit all by itself.

    I may modify the layout if something better occurs, or if I decide to merge two chapters (say seconds, minutes, and hours). At this point nothing is written in stone.

    If I write this I'm leaving the Radio Shack Conventions behind. If a part can be bought at Radio Shack I will provide the part number, but the vast majority it will not exist.
     
    Last edited: Jun 24, 2011
  11. Wendy

    Thread Starter Moderator

    Mar 24, 2008
    20,766
    2,536
    Introduction

    Digital clocks are probably one of the most common examples of digital circuits. They incorporate a wide range of basic digital circuits and concepts, and are almost always a class assignment for digital courses everywhere in the world.

    In designing a clock certain basic decisions have to be made concerning the design. CMOS circuitry is very flexible about power supply voltages (most CMOS can use 3V up to 15V), so this design will use 12VDC for the finished design, and 9V for individual protoboards.

    This is a block diagram of a typical digital clock.

    [​IMG]

    Like all schematics this block diagram follows the convention of the signal flowing from left to right. However, when the clock is build it will be flipped, with the time base mechanically on the right, and the hour display on the left.

    This block diagram will be broken into the following chapters.

    1. The Time Base and Control Circuit
    2. A Generic Mod 60 Counter
    3. The Seconds Counter
    4. The Minutes Counter
    5. The Hours Counter, 12 Hour and 24 Hour
    You should be able to lock the various protoboards together to make a complete clock, but provisions for testing each section will also be made.
     
    Last edited: Jul 17, 2011
  12. Wendy

    Thread Starter Moderator

    Mar 24, 2008
    20,766
    2,536
    1. The Time Base and Control Circuit


    [​IMG]


    PARTS AND MATERIALS
    • 2X 6VDC Lantern Batteries or 9V Battery
    • U1 - CD4060 CMOS IC, Crystal Oscillator with 14 bit ripple counter
    • U2 - CD4013 CMOS IC, Dual D type Flip Flop
    • U3 - CD4081 CMOS IC, Quad AND Gate
    • Q1-5 - PN2222 or equivalent (not critical)
    • CR1-2 - 1N4454 or equivalent (not critical)
    • D1-4 - Red LED (not critical)
    • X1 - 32.768 KHz Crystal (BG Micro P/N CRY32768KHZ)
    • C1-2 - 10pF Capacitors
    • C3-7 - 0.1µF Capacitors
    • C8 - 100µF Electrolytic Capacitors
    • R1 - 15MΩ 1/4W Resistor
    • R2 - 330KΩ 1/4W Resistor
    • R3-5,10-12 - 10KΩ 1/4W Resistors
    • R6-9 - 1KΩ 1/4W Resistors
    • S1-3 - 1/4" Tactile N.O. Momentary Push Button (BG Micro P/N SWT1162, Optional, can use wire)
    • Frequency Counter (Optional)

    SCHEMATIC DIAGRAM

    [​IMG]


    ILLUSTRATION

    [​IMG]


    INSTRUCTIONS

    Tactile switches are a way to have push buttons on a protoboard. They are NO (Normally Open) momentary contact types. They are called tactile switches because they have a nice click when depressed, and they are very inexpensive. You do not have to use them for this project, they can be replaced by wires. Shown below is how they are wired internally, and how you can use wire to replace them. Since they are used as feed through wires you need to used the equivalent circuit as show on the protoboard.

    R1 (15MΩ) may not be obvious from the drawing, it is a resistor placed on end to take up less space.

    [​IMG]

    The buttons control the rest of the clock, allowing you to set the time. S1, the Manual/Fast button, allows you to use S2/S3 as a manual button or 16 Hz to toggle the counters, while S2 (Minutes) and S3 (Hours) allows selection of which counters to set as well as sending a reset to the seconds counter, so the clock can be set with relative precision.

    LED D1 shows the straight time base. LED D2 shows the logic level of the seconds reset, when it is high the seconds will be frozen on "00". LED D3 is the Minutes counter input, and D4 is the Hours counter input.

    If you have a quality frequency counter capable of 6 digits of accuracy you can replace C2 with a trimmer capacitor, similar to a 4-36pf trimmer capacitor, and tweak the oscillator for even greater accuracy. As is the crystal oscillator will still be very close.

    Q1-4, R6-9, and D1-4 are not need for this circuit, but they will provide important trouble shooting information and help verify the circuit is working. D1 will show the 1 second clock, D2 will show the reset signal for the seconds counter, while D3 and D4 will show the signal sent to the respective minutes and hours counter. If the fast count option is used you will see the reset signal on D2 flicker in time with the other LED.


    THEORY OF OPERATION

    Every clock needs a time base. The more accurate the time base the more accurate the clock.

    This circuit uses a CMOS chip designed to be a time base, the CD4060. Most of the CD4060 is a 14 bit ripple counter, but the front end can be used for a crystal or RC oscillator. RC oscillators are very inaccurate, and drift badly over time, but crystal oscillators do not have this problem. A crystal looks like a tuned circuit. Its drift is very slow, and it will be a very stable frequency over a long period of time, which is ideal for a time keeping piece.

    This crystal is tuned for 32.768Khz. While originally developed for old TV sets, it has found a niche for digital wrist watches during the 1970's, and beyond. It is still used in large numbers for digital and quartz wrist watches, indeed it is the quartz in a quartz watch. When 32.768Khz is divided by a 14 bit ripple counter (÷16384) the output is 2 Hz. Add another ÷2 flip flop you have 1Hz, which is exactly what is needed for a 1 second time base. As a side benefit we also get faster frequencies, namely 32 Hz. U2b is used to drop this down to 16Hz, since the 4060 does not have this frequency available.

    Most time bases use crystals because of their stability and ruggedness. To make them even more accurate for advanced uses (such as test equipment) a crystal oven is build around them. The oven uses an insulator around a simple heater, sensor, and feedback circuitry to keep the crystal a constant temperature that is hotter than ambient temperature, thus eliminating one of the major variables that cause drift, temperature. An oven can be very simple to build, but there wasn't room for one in this project.

    Every clock also need a means to set the time, since the digital logic will be fairly random on power up. This is handled via the Control Circuit. The Manual/Fast button selects how you set the clock, either one counter per button push or sending a 16 Hz signal to the hours and minute and resetting the seconds counter while this is happening.

    This circuit also uses 3 different families of logic, CMOS, RTL, and Diode logic to simplify this circuit. CR1, CR2, and R12 create a diode OR gate, while R10, R11, and Q5 create a RTL inverter. U3c is an unused AND gate. It is always good design practice to tie the unused inputs of a CMOS gate down, to prevent unwanted and unexpected behaviors.
     
    Last edited: Aug 12, 2011
    thebob likes this.
  13. Wendy

    Thread Starter Moderator

    Mar 24, 2008
    20,766
    2,536
    • 5.PNG
      5.PNG
      File size:
      5.5 KB
      Views:
      60
    • 1.PNG
      1.PNG
      File size:
      4.9 KB
      Views:
      1,254
    • 2.PNG
      2.PNG
      File size:
      4.8 KB
      Views:
      1,270
    • 3.PNG
      3.PNG
      File size:
      14.9 KB
      Views:
      1,431
    • 4.PNG
      4.PNG
      File size:
      17.6 KB
      Views:
      1,273
    • images.zip
      File size:
      46.5 KB
      Views:
      35
    Last edited: Jul 23, 2011
  14. TBayBoy

    Member

    May 25, 2011
    148
    19
    I've always been fascinated by clocks, really looking forward to reading this, as for homework cheaters, there is no way to deal with that. They are only cheating themselves by not taking advantage of the learning environment, and soon get weeded out of the gene pool by Lord Ampere.
     
  15. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
  16. Wendy

    Thread Starter Moderator

    Mar 24, 2008
    20,766
    2,536
    Thankee Kindlee. If you have any ideas this is the time to input them. I would even be interested in parts suggestions or schematics, if you think they are something that would be good for a beginner. The 12/24 hour clock is a bit intimidating, but I'll come up with something. I would rather have a single schematic for both functions.

    If this were TTL I would aim for the 7490 and 7492, a bcd and mod 12 counter, fairly close to perfect for this application. I'll use something similar if I can, or go with the 4029. This chip may be what I use for the 12/24 side, since it is so versatile.

    So if I do use this chip, should I stick with it?

    I'm probably going to leave the trimmer capacitor out of the protoboard. Or I could use this one. One thing about using Radio Shack for a parts source, it simplifies thing a bit. However, Radio Shack has long since stopped stocking the 4013 or a trimmer cap for example, so this leaves me trying to come up with parts that are pretty universal and available.

    I've seen this, and it is interesting. I would like to keep this thread focused on the project for the e Book though. This includes schematic ideas or parts, or something I've missed. Of course, that also includes proofreading comments too.

    The LEDs, 555s, Flashers, and Light Chasers article took two threads and a blog before I found a happy compromise. I wound up settling for the blog because I have total control there. Posting in the forum I can't exercise my control freak tendencies. :D
     
    Last edited: Jul 18, 2011
  17. TBayBoy

    Member

    May 25, 2011
    148
    19
    I would suggest a settable alarm, 7 segment displays, I like the 12 or 24 hour idea. I'm still new to all this so will be absorbing what you write and may have questions :)

    I like your idea to move away from radio shack, our version here "the source" has an electronics department with three items in it, 2 of which are different lengths of coax cable :(.
     
  18. Wendy

    Thread Starter Moderator

    Mar 24, 2008
    20,766
    2,536
    I won't be making an alarm. All you need for an alarm is minutes and hours counters and a bunch of XOR gates (2 input) feeding a AND gate (16 input). I'm going to try to fit this on 4 protoboards, which may or may not be possible. An alarm circuit would add three more protoboards, maybe four. It is practically clock unto itself, same numbers of counters with the clock being replaced with a large number of gates.

    I may have to up the number of protoboards to do this. We will see.

    **************************************************

    Sometimes I get lucky. Someone had a question about the 4033 elsewhere on the forum, it and it's cousin (the CD4026) appear to be perfect for this application. They incorporate both the counter and decoder circuitry, which really saves on the space. I may be able to do this on 4 protoboards after all. If I had to have the decoder separate from the counter I think I would have to use 7 protoboards. I'll probably use the 4026. I have some ideas on the 12/24 hour counters (it will be a bit of a kludge, but it will work).

    **************************************************

    Control circuit is finished except for actual constrution and verification. I'll start the next step.
     
    • 9.PNG
      9.PNG
      File size:
      3.8 KB
      Views:
      1,232
    Last edited: Jul 16, 2011
  19. Wendy

    Thread Starter Moderator

    Mar 24, 2008
    20,766
    2,536
    2. GENERIC MOD 60 COUNTER


    [​IMG]


    PARTS AND MATERIALS

    • 2X 6VDC Lantern Batteries or 9V Battery
    • U5,6 - CD4026 CMOS IC, BCD Counter with build in 7 segment decoder
    • U7 - CD4013 Dual Type D Flip FLop
    • DS1,2 - MAN 74A 7 segment LED display (Radio Shack P/N 276-075)
    • C7,9,10 - 0.1µF Capacitors
    • C11 - 100µF Electrolytic Capacitor
    • R13 - 100KΩ 5% 1/4W Resistor
    • S4 - 1/4" Tactile N.O. Momentary Push Button (BG Micro P/N SWT1162, Optional, can use wire)

    SCHEMATIC DIAGRAM


    [​IMG]


    ILLUSTRATION

    [​IMG]


    INSTRUCTIONS

    This is a basic Mod 60 counter. The next two chapters will show how to convert it into a seconds and minutes counter, but this will allow you to familiarize yourself with the core design before building the second counter and modifying the first. Every time you press S4 you will see it count up one. When the number hits "59" the next count will be "00".


    THEORY OF OPERATION

    Most of the main logic is handled by the CD4026. This chip includes counter circuits as well as decoding logic. There are several outputs for auxiliary logic, such as carry and "Ungated C Segment", used to detect when a specific numeric value has been reached. Since the display segment pins are used for the LEDs they are unsuitable to detect specific number. Although it is not used, the display can be blanked by bringing the "Display Enable Input" low, which is why the "Ungated C Segment" output exists, it can not be turned off.

    Look at the simplified truth table for the CD4026:

    [​IMG]

    The carry bit come very close to being where it is needed to reset the most significant digit (MSD), but is not quite right. U7, the dual type D flip flop, is a single bit shift register, and shifts and inverts this bit by the needed amount, changing U6 from a MOD 10 into a MOD 6 counter. The second type D flip flop on U7 is tied down as with U3C on the control circuit.

    You may have noticed the MAN74A display has no current limiting resistors, which is not good design practice. CMOS chips have very limited drive, and this characteristic was used to replace the resistors. An average of 14ma per segment when this circuit was powered with 9V, and 20ma when power with 12V. This is well within the limits for the LEDs, but outside the limits for the CD4026's.
     
    Last edited: Jul 23, 2011
  20. Wendy

    Thread Starter Moderator

    Mar 24, 2008
    20,766
    2,536
    Well, I have my new breadboard for the project finished. When I have the project completely finished I'll post it as part of the article.

    [​IMG]

    Thanks to Pencil I have the info I need for the basic clock circuit. He pointed out this site. I'm going to violate one of my personal rules, and see if the smoke escapes the chips. Here is an intermediate drawing.

    [​IMG]

    My thought is the 4026 will limit the current itself. I'll let you know if it works.

    ******************************************

    Well, the time base oscillator puked on me. This has been done with other threads though, so I just need to keep experimenting until I find the right mix of components. One nice thing about the way I draw it up, if people follow my instructions exactly it should be extremely repeatable.

    4060 crystal oscillator strange behavior

    http://www.doctronics.co.uk/pdf_files/HEF4060B.pdf


    ***************************************

    OK, got the crystal oscillator time base working correctly, but I'm thinking of a redesign of the control circuitry. It is too over complicated for my taste. After building the mod sixty counter and using a push button I don't see any reason I can't single step to the needed numbers.
     
    Last edited: Jul 23, 2011
Loading...