.
letter_G.gif (2408 bytes)ames timer


Week 2 : Counter/display


.
Navigation

Outline

Adding LEDs
What to do RESET and ENABLE inputs
4017 essentials What have you learned?
build one ! contents Back to Games timer

.
Outline

In the first session, you investigated ways of generating pulses at slow frequencies. Circuits using large value resistor/capacitor combinations are not very accurate because of the wide tolerance and leakage current of polarised capacitors. A better solution is to use an astable circuit together with a binary counter/divider chain which reduces the frequency of the astable pulses. The 4060 cmos integrated circuit is ideal for the games timer application.

In this session, you will investigate how to set up the counter/display subsystem of the games timer using another cmos integrated circuit, the 4017 decade counter.

beginning of chapter Up


.
What to do

To find out about the 4017, you need a source of pulses. You could use the 4060 astable circuit investigated in the previous session, but it is more convenient to build a temporary alternative circuit.

About the easiest way of building an astable is using a special type of NAND gate, called a Schmitt trigger NAND gate. Here are the symbols for normal and Schmitt trigger gates:

normal and Schmitt trigger NAND gates

The Schmitt trigger gate has two different thresholds. If the voltage applied to one of the inputs to the gate starts at 0 V and is slowly increased, the logic 1 threshold, when the input starts to count as a HIGH voltage, is around two-thirds of the power supply voltage, that is, about 6 V with a 9 V supply. On the other hand, if the voltage connected to the input starts at 9 V and is slowly decreased, the logic 0 threshold, when the input counts as a LOW voltage, is around one-third of the power supply voltage, or about 3 V. This difference in thresholds allows you to use a Schmitt trigger gate as the basis for an extremely simple astable circuit.

The 4093 cmos integrated circuit contains four Schmitt trigger NAND gates, arranged like this:

4093 pin connections

You can make an astable by connecting a single resistor/capacitor network to a Schmitt trigger gate:

Schmitt trigger astable

You are going to build and test this circuit on prototype board. Start by giving the 'beastie' a power supply:

stage 1: 4093 power supply connections, click for next stage

Next add the components needed to make the astable. You also need to add a wire link between pins 1 and 2 of the 4093:

stage 2: 4093 astable, click for next stage

click to return Up to previous stage

Monitor the output of the astable at pin 3 of the 4093, using an oscilloscope.

You can estimate the expected frequency of the pulses produced from the formula:

In this case, R =100 kW, and C = 1 F. Taking values in MW and F:

How does this estimate compare with the actual frequency of the pulses observed at pin 3?

Use the grid on the oscilloscope screen to measure the period, T, of the pulses and then calculate the frequency from:

The frequency of the pulses varies with the power supply voltage to the 4093 and also depends on the threshold characteristics of the particular device.

beginning of chapter Up


.
4017 essentials

The 4017 is a divide-by-10, or decade counter, with 10 individual outputs which go HIGH in turn when pulses are fed to its CLOCK input. The connection details for the 4017 are:

4017 pin connections - click to return to LEDs
4017 pin connection diagram

To make the 4017 work, you need to connect the power supply pins ('beasties' need power supplies). In addition, you need to connect the ENABLE and RESET inputs to 0 V. With these connections in place, the pulses from the 4093 astable can be connected to the CLOCK input, pin 14.

The circuit diagram for this arrangement is:

4017 circuit diagram

Minimum connections for 4017 decade counter

Add the 4017 to your prototype board and make these connections:

stage 3: 4017 essential connections, click for next stage

click to return Up to previous stage

Provided you have built the circuit correctly, each of the 10 individual outputs of the 4017 should be pulsing. You should notice that the pulsing is slower and that each output is HIGH for a short time.

Check that all the outputs all appear to be doing the same thing.

In fact, each output goes HIGH for one tenth of the time and goes LOW at the same moment that the next output in the sequence becomes HIGH.

The V/t graphs in the diagram below show how the outputs change following the rising edges of the pulses at the CLOCK input:

4017 V/t waveforms

V/t graphs for 4017 counter

As you can see, each of the individual outputs goes HIGH in turn. The divide-by-10 output is HIGH for outputs 0 to 4 and goes LOW for outputs 5 to 9.

beginning of chapter Up


.
Adding LEDs

Now you are going to add LEDs to monitor the outputs of the 4017 counter. The best way of doing this is to add the LEDs one at a time and to check that each lights up at the correct moment in the counter cycle before adding any more LEDs. This way of working is extremely efficient. You know whether the circuit is working and, if there are any faults, you can correct them at once.

To work out where exactly the LEDs should be connected, you need to refer back to the pin connection diagram for the 4017. This shows that output 0 of the counter is located at pin 3. You need a wire link from pin 3 to the first LED:

stage 4: adding LEDs, click for next stage

click to return Up to previous stage

Similarly, output 1 is located at pin 2, so you need a wire link from pin 2 to the second LED. The 680 W resistors limit the current flowing through the LEDs to around 10 mA to avoid damage, either to the LEDs, or to the 4017.

You will need to connect a second small prototype board to make room for all the LEDs. Add additional LEDs each with its own series resistor in the correct sequence, again following the pin connection diagram:

stage 5: 4017 counter with LEDs, click for next stage4017 counter with LEDs for each output

click to return Up to previous stage

When you have completed the circuit, all 10 LEDs should light up in turn and the sequence will repeat over and over again.

beginning of chapter Up


.
RESET and ENABLE inputs

You are going to modify your circuit to investigate the effects of the RESET and ENABLE inputs. When the counter is free-running, these inputs are connected to 0 V.

The circuit needs to be altered so that, instead of being connected directly to 0 V, each of these inputs is connected to 0 V through a 10 kW pull-down resistor:

RESET and ENABLE with pull-down resistors and flying leads

A flying lead is just a piece of wire connected into the circuit at one end. If the free ends of the flying leads are left unconnected, the RESET and ENABLE inputs are held LOW as before. However, if the free end of a flying lead is connected HIGH, you will be able to discover the function of the corresponding input.

To get your prototype board to conform to this circuit diagram, you need to remove the wire links joining pins 13 and 15 of the 4017 to 0 V.

When this is done, the 4017 will probably stop working. Now connect the two 10 kW pull-down resistors, as indicated in this diagram:

stage 6: adding pull-down resistors

click to return Up to previous stage

With the pull-down resistors in place, your circuit should be functioning properly again, with the counter in free-running mode. Check your connections until you achieve this result.

Now investigate the effect of touching the free end of the RESET flying lead to the positive end of the power supply. What happens?

Pencil.gif (1143 bytes)

Each time you touch RESET to +9 V, the counter is stopped and LED 0 is illuminated. The counter is sent back to the beginning of its sequence, in other words, the counter is 'RESET'.

What happens when you connect the free end of the RESET lead to one of the outputs of the counter? To start with connect the RESET lead to output 6, pin 5.

How many LEDs light up?

Pencil.gif (1143 bytes)

Next, investigate the effect of the ENABLE lead. What happens when the free end of this lead is touched to +9 V?

Pencil.gif (1143 bytes)

Instead of being RESET, the counter is stopped wherever it happens to be in its sequence.

In the context of the games time, the action of the ENABLE input is very useful. If you connect the free end of the ENABLE lead to output 9 (pin 11), the count stops when it reaches LED 9. Try this.

Leaving the ENABLE lead in this position, briefly connect the RESET lead HIGH. The counter is RESET and LED 0 is illuminated. When you release the RESET lead, the counter counts through its sequence just once, stopping again when LED 9 is illuminated. Try this.

This is exactly the behaviour required for the counter section of the games timer. A tilt switch will be used to RESET the 4017 and the audible output will be triggered when the count reaches the final LED.

beginning of chapter Up


.
What have you learned?

You have found out how to make a simple astable circuit using a single Schmitt trigger NAND gate from a 4093 cmos integrated circuit. This circuit is very easy to build. The frequency of the pulses produced varies with the power supply voltage to the 4093, but can be estimated approximately from:

You have investigated the properties of the 4017 decade counter and you should have a clear idea of its capabilities. The behaviour of the counter can be manipulated using the RESET and ENABLE inputs.

The individual outputs of the 4017 provide enough current to operate an LED, assuming you limit the current to around 10 mA, using an appropriate value of series resistor.


beginning of chapter Up Back to Games timer