An exploration of discrete logic components.

In this build we look at the 4017 decade counter and the 555 timer and how they are applied to a digital clock.
It came to my mind to ask about the basics of computer functionality when I considered my iPhone. Of course, these little wonders are now ubiquitous. But, often we are blind as to the actual workings of the machine. More about that here.
But this blindness I could not abide. I needed to know, without the benefit of having been conscious in its nascent era, more about the machinations of basic integrated circuitry and electronic computation.
I needed to know how we got here.
Naturally, this lead to attempting the most basic application of electronic circuitry I could think of— counting. Or more specifically (and usefully) counting in order to keep time.

This meant that we needed to be able to produce the following basic functions:
- incrementally count by 1 at a steady rate (1Hz=1 pulse per second)
- store the state of certain counts in order to be read at the output
- trigger other counts as certain units of time expire (such as trigger a minute advance when 60 seconds has transpired)
- set the time
- *bonus feature* run the clock at a faster speed (variable) for debugging circuitry
SO straight to it then….
This is my build of a digital clock.

Introduction
Below are the two relevant data sheets for this project. They were instrumental to the build.
It was vital to the project that I truly understand what I was doing during this build. I’ve been able to achieve results with electronics projects before that get the job done, but rarely am I informed at a deeper level. This is why I didn’t want to use a microcontroller such as an Arduino and have my developments be code-driven instead of hardware-driven.
Given I had the time to understand the basics of computer science through personal research, it served as a great “deeper level” prerequisite to understanding data sheets.
Part I: The Concepts
—The 555 IC—
Within the 555 datasheet is the pinout diagram for the 555 timer as well as a detailed explanation of the function of each pin.

There are a few operational modes of the 555 chip but we are using it in its astable mode as a multivibrator. This means that with the application of certain values of resistance and capacitance at the marked locations (Rx), we can alter the duty cycle of the waveform in order to achieve a 1Hz signal (1 pulse per second). This will serve as the fundamental clock signal which will set the rate of counting in the 4017.

We will use a handy 555-timer calculator for determining the values of Cx and Rx which can achieve our 1 second clock pulse. They are as follows:

I wanted to use the most commonly available resistors and capacitors in my personal kit so I chose the highlighted values. Moreover, this selection of components results in a period of .9924 seconds (1 second effectively) and a duty cycle of 50.8% thus rendering the active time of the pulse (when the light is on) nearly equal to its inactive state (when the light is off).
NOTE: it was necessary to add some resistors in series to R2 to really dial in a true second. These values never exceeded 100 ohms per R (I think I used x2) and I merely added them until it felt right given that I don’t have an oscilloscope. I was losing 2 minutes per 2 days on my clock but this is completely acceptable and this project is mainly for fun not for sending off nuclear rockets.
—The 4017 IC—
Let’s talk about the 4017 decade counter for a moment. The decade counter counts in tens, ergo decade, ergo duh. So… we need to count how many outputs are required in total on our build to achieve a system of counting that looks like this:

In plain English the flowchart is to be read as follows (part count in parentheses):
- We count 10 seconds (x1 4017 using all 10 outputs)
- We let the 10th second trigger 1/6 decaseconds (x1 4017(s) using only 6 outputs)
- We let the 6th decasecond trigger 1/60 minutes (x8 4017(s) using 60/65 available outputs)
- We let the 60th minute trigger 1/12 hours (x2 4017(s) using 12/17 available outputs)
With some simple addition we can see how many outputs there are in total:
Seconds (10) + Decaseconds (6) + Minutes (60) + Hours (12)= 88 total outputs
Now, it is important to introduce a feature of the 4017 decade counter to understand the preceding list and how we achieve counting past 10 via decade counters which we find necessary for minutes (60) and hours (12)— cascading. The 4017 chip offers the ability to cascade, or sequentially count forever, across multiple 4017 chips. Below is the feature as it is mentioned in the data sheet.

We will note, however, that upon using this cascading feature certain outputs are necessarily held high while the chip is counting thus rendering that output a non-unit for our purposes. Thus, the first chip in a cascade series has 9 available outputs (“9 Decoded Outputs”), but the next has 8, and they continue to have only 8 until the count resets back to the first chip. This is why we need x8 4017(s) to count to 60 ((9+8+8+8+8+8+8+8= 65 outputs (we don’t use the last 5)). Same concept goes for the hours except we’re only counting to 12.
I chose to include outputs on my build for viewing what was happening on those non-unit outputs (green LEDs), but this is extraneous. It is good however if you want to understand how the cascade effects proceeds from one chip to the next and when this occurs. Given the outputs of the chips are reduced to 8 throughout much of the counting, you’ll find that a chip carries over to the next one at odd intervals among the 60 minutes. I found this useful for debugging.
—Logic Gates—
It is also important to note that the use of the 4017 cascade feature requires logic gates. Specifically, we need AND-gates to achieve the cascade effect. A 7408 IC can achieve the functionality required.
Only our minutes and hours require cascading as their counts need to extend past the default 10 outputs on a single 4017 IC. Per the datasheet, there will need to be one AND-gate for every 2 chips. This means we’ll need four AND-gates for minutes (x8 4017(s)) and one AND-gate for hours (x2 4017(s)).

A single 7408 IC has 4 available AND-gates. This means we will need two 7408 ICs (using 5/8 available AND-gates).
NOTE: If you’re feeling frisky and don’t want to go with integrated circuitry for your AND-gates you can make 5 independent AND-gates from transistors and resistors alone. Information on that here.
So, once we’ve understood the 4017 cascade effect, the implementation of basic logic gates, the functionality of the 555 chip in astable mode, and the nature of our clock on a conceptual level, then we can get started with the build.
Part II: The Circuit Build

4017 Decade Counter Pinout

When we’ve achieved the proper rate of pulse (1Hz) from the 555 chip, taken from its output (pin 3), we will connect that signal into our first 4017 (seconds) decade counter’s “clock signal” pin (pin 14).
We tie the rest of our pins to their requisite position as per the diagram below so that the first 4017 IC counts to 10 over and over again. 10 seconds (our base counter)

We then tie the 10th output (Q9) to the clock input of the next 4017 which will count to 6 over and over again. Every time we hit the 10 from our seconds count, we pulse the next 4017 to advance 1 light forward of 6 decaseconds. To only use 6 outputs we need to set the RESET signal high for the counter to start over after reaching 6.

To achieve this we use the same exact schematic for a 10 count except we connect the RESET signal (pin 15) to pin 7 signal thereby achieving a reset upon the 6th output going low and the 7th output going high. 6 decaseconds
We then tie the 6th output (Q5) to the clock input of the next 4017, part of our sequence of 8 cascaded 4017(s), which will count to 60 over and over again. 60 minutes

We then tie the 60th output (IC8, Q7) to the clock input of the next 4017, part of our sequence of 2 cascaded 4017(s), which will count to 12 over and over again. 12 hours

Part III: Summary
This is where I must end this post. The following video should give insight into the functionality of the clock. My inbox is always open for questions should someone want to build one of their own and they get caught up.
***please forgive my failure to call the frequency Hz. I even labeled the clock mistakenly as 1MHz. We are not that fast here. It is definitely 1 Hz.
Thank you for viewing this post and I hope it can serve as an inspiration for people who want to be a little bit more in the light of how all these things work!!!







Leave a Reply