Digital Clock Using Crystal Oscillator & Flip Flops

Introduction: Digital Clock Using Crystal Oscillator & Flip Flops

About: Rutgers Engineering Graduate, love all things electronic and love to share knowledge

Clocks are found in almost all types of electronics, they are the heartbeat of any computer. They are used to synchronize all sequential circuitry. they are also used as counters to keep track of time and date. In this instructable you will learn how computers count and essentially how a digital clock works using flip flops and combinational logic. The project is broken down into multiple modules that each perform a specific function.

Supplies

For this instructable you will need some prior knowledge in:

  • Digital logic concepts
  • Multisim simulator (optional)
  • Understanding of Electrical circuits

Step 1: Building the Time Base Module

The Concept behind a Digital Clock is that we are essentially counting up clock cycles. a 1 Hz clock is generating a pulse every second. in the next steps we will see how we can count those cycles to make up the seconds, minutes and hours of our clock. One way we can generate a 1 Hz signal is by using a crystal oscillator circuit that generates a 32.768 kHz signal (like the one i designed above which is called a pierce oscillator), that we can then divide by using a chain of Flip Flops. The reason 32.768 kHz is used is because it is higher than our maximum hearing frequency which is 20 kHz and it is equal to 2^15. The reason that is important is because a J-K flip flop output Toggles at the Positive or Negative edge (depends on the FF) of the input signal, therefore the output is effectively at a frequency that is half of the original input. By that same token if we chain 15 Flip Flops we can divide the input signal frequency to get our 1 Hz signal. I just used a 1 Hz pulse generator to speed up the Simulation time in Multisim. However on a breadboard feel free to build the circuit i have above or use a DS1307 module.

Step 2: Building the Seconds Counter

This Module is broken up into two parts. The first part is a 4-bit up counter that counts up to 9 which makes up the 1's place of the seconds. The second part is a 3-bit up counter that counts up to 6 which makes up the 10's place of the seconds.

There are 2 types of counters, a synchronous counter (where the clock is connected to all FF) and an asynchronous counter where the clock is fed to the first FF and the output acts as the clock of the next FF. I use an asynchronous counter (also called a ripple counter). The idea is that if we send a high signal to the 'J' and 'K' inputs of the FF, the FF will toggle its state at each cycle of the input clock. This is important because for each 2 toggles of the first FF a toggle is produced in the consecutive FF and so on until the last one. Therefore we produce a Binary number equivalent to the number of cycles of the input clock signal.

As shown above, to the left is my circuit that makes the 4-bit up counter for the 1's place. Below it i have implemented a Reset circuit, it is basically an AND gate that sends a high signal to the reset pin of the Flip Flops if the output of the counter is a 1010 or a 10 in decimal. Hence the output of that AND gate is 1 Pulse Per 10 Seconds signal which we will use as the input clock for our 10's place counter..

Step 3: Putting It All Together

By that same logic, we can continue to stack counters to make up the Minutes and Hours. We can even go further and count days, weeks and even years. you can create this on a breadboard, ideally however one would use an RTC (real time clock) module just for convenience. But if you are feeling inspired you would essentially need:

  • 19 J-K Flip Flops (or 10 Dual J-K ICs such as the SN74LS73AN)

  • a 1 Hz input source (you can use a DS1307 module it generates a 1 Hz square wave)
  • 6 Binary to 7-segment Decoders ( such as the 74LS47D)
  • 23 Inverters, 7 3-input AND gates, 10 2-input AND gates, 3 4-input AND gates, 5 OR gates
  • Six 7-segment hex displays

I hope you learned how a digital clock works from this instructable, please feel free to ask any questions!

Be the First to Share

    Recommendations

    • Fruit and Veggies Speed Challenge

      Fruit and Veggies Speed Challenge
    • DIY Summer Camp Contest

      DIY Summer Camp Contest
    • Summer Fun: Student Design Challenge

      Summer Fun: Student Design Challenge

    2 Comments

    0
    haseebakanwal9
    haseebakanwal9

    11 months ago

    please give the clear picture of this prohject