How to Create a Digital Counter from Scratch

Introduction

This article focuses on how to create a digital counter with no programming involved. It also covers the basics of the electronic parts that are used in this project, which are

  • 555 Timer
  • Decade Counter
  • 7-Segment Decoder
  • 7-Segment Display

The goal is to create a a digital counter that counts from 0 to 9, each number is displayed for roughly one second. The counter will go back to 0 after a cycle.

The workflow of the digital counter is simple. First, the 555 timer emit a digital pulse (the signal change from LOW to HIGH); the pulse travels to the decade counter and increases its count by 1 (or resets it to 0 if the counter is at 9); the decade counter then output the corresponding number as a 4-bit binary signal to the 7-segment decoder; the 7-segment decoder, upon receiving the signal, decodes the number and output the signal needed for the 7-segment display to light up the correct number.

Parts Needed

  • 30 Jumpers
  • 555P (555 timer)
  • SN74LS90N (Decade Counter)
  • SN7447AN (7-Segment Decoder)
  • LTS3401VE (7-Segment Display)
  • 1000 \(\mathrm{\mu F}\) Capacitor
  • 3 220 \(\Omega\) resistors
  • 1 670 \(\Omega\) resistor

The 555 Timer

The 555 timer is manufactured by Texas Instrument. It is named 555 timer because it has 3 \(5k\Omega\) resistors inside, as is shown in the block diagram below.

The block diagram of 555 timer

The block diagram of 555 timer. Image from ElectronicTutorials

As can be deducted from the block diagram, the 555 timer has the following properties that are essential to this project

  • PIN 3 (output) is HIGH when the voltage on PIN 2 (trigger) is smaller than \(\frac{1}{3}\) of VCC, LOW otherwise.
  • PIN 6 (threshold) reset the output to LOW if the voltage on it is higher than \(\frac{2}{3}\) of VCC
  • PIN 7 (discharge) is connected to ground when output (PIN 3) is HIGH. It is an open connection when output is LOW.

For this project, the 555 timer should behavior as an oscillator –– a signal source that oscillates between HIGH to LOW at a certain frequency. The circuit diagram of such application is this:

https://www.electronics-tutorials.ws/waveforms/tim58a.gif

Image from ElectronicTutorials

The frequency formula for this design is

\[f=\mathrm{\frac{1}{2\cdot\ln(2)\cdot R_2C}Hz}\]

Because the counter counts up one each second, the signal of the timer should be emitted once every second, in other words, has a frequency of 1Hz. Therefore, according to the formula above, \(\mathrm{R_2C=\frac{1}{2\ln(2)}=0.721}\). For the simplicity of calculation, a \(\mathrm{1000\mu F=1mF}\) capacitor is chosen. Given the capacitor, a \(670\Omega\) resistor is the industrial resistor closest to \(721\Omega\) that can be found. Therefore, the theoretical pulse frequency is 1.07Hz.

The Decade Counter

Here is the graph of SN74LS90N:

/Digital-Counter-Tutorial/_images/0.png

The decade counter takes one digital input, clock. It produces four bits of digital output DCBA representing a integer in closed interval [0,9] in binary, increasing once per clock signal. Here is a conversion chart from binary to decimal

Decimal \(2^3\) \(2^2\) \(2^1\) \(2^0\)
0 0 0 0 0
1 0 0 0 1
2 0 0 1 0
3 0 0 1 1
4 0 1 0 0
5 0 1 0 1
6 0 1 1 0
7 0 1 1 1
8 1 0 0 0
9 1 0 0 1

In the case of the decade counter, the most significant bit is \(Q_D\). Therefore, the output chart can be converted to this

Output \(Q_D\) \(Q_C\) \(Q_B\) \(Q_A\)
0 0 0 0 0
1 0 0 0 1
2 0 0 1 0
3 0 0 1 1
4 0 1 0 0
5 0 1 0 1
6 0 1 1 0
7 0 1 1 1
8 1 0 0 0
9 1 0 0 1

Note that the least significant bit is always changing. Therefore, it can functions as a clock signal.

To put them together, the decade counter should be connected as follow:

Pin Number To
1 PIN 12
2,3,6,7,10 GND
5 VCC
12 PIN 7 of 7-segment decoder
9 PIN 1 of 7-segment decoder
8 PIN 2 of 7-segment decoder
11 PIN 6 of 7-segment decoder
14 PIN 3 of the 555 timer.

The 7-Segment Decoder and 7-Segment Display

The 7-segment decoder takes 4 inputs, A, B, C and D, which are the binary representation of a number. It then outputs the correct signal (7 bits, as its name suggests) for controlling a single 7-segment display –– that is, turning on different LEDs of the display to produce a human readable number. The 7-segment display used in this project should be common anode.

Although it has the most pins among the chips used in this project, it is actually the most strait-forward chip. As is shown in the graph

/Digital-Counter-Tutorial/_images/1.png

PIN 1, 2, 6 and 7 should be connected to the output of the decade counter. PIN 9-15 should be connected to the respective pins of the 7 segment display, as is shown below

/Digital-Counter-Tutorial/_images/2.png

Note

The common anode of the display should be connected to VCC through a resistor. PIN 4, 6, 12, 17 of the display are internally connected.

Final Circuit

Here is a diagram of the final circuit

/Digital-Counter-Tutorial/_images/3.jpg

And a picture of the circuit on a breadboard

/Digital-Counter-Tutorial/_images/4.jpeg