Digital electronics: Decoders

This article continues the theme of digital ICs from the previous couple of issues of Electronics in Meccano.

In issue 7 we covered binary counter ICs which produce a binary counting sequence on their outputs in response to a clock pulse input. These ICs can be used to count events such as the number of rotations of a wheel, but they cannot display their count in a way that humans can easily read, for example, as a decimal number on a display.

Displaying information - The technology

There are many different technologies that can be used to display information that humans can read, some of which are shown below along with a few of their typical applications:

Most of these displays are complex to control. CRT and Gas Discharge Displays both require high voltages, while LCD displays need a small AC supply. Although they can be purchased with the required electronics built in, these are suitable for computer controlled systems only.

LED displays are easier to control since in their simplest form they can be just standard LEDs arranged as required.

Displaying information - Methods of display

Using individual elements

Suppose that you want to show the result of a calculation. An easy way would be to arrange several lamps or LEDs in a line and label them ‘0’ to ‘9’. You could then light a single lamp or LED to display the result. This is easy to achieve using a decoder IC, but if the result of your calculation is over 9, you would have to add more lamps or LEDs!

Using segments

If you only need to display a number, then you could use a ‘seven-segment display’. These have seven specially shaped elements which when lit correctly produce the shapes of the numbers ‘0’ to ‘9’. They can also crudely display some letters of the alphabet, such as ‘a’ to ‘f’, which could be handy if you wish to display hexadecimal numbers. Standard decoder ICs can accept a binary number and switch on the correct segments of a seven-segment display to display a decimal number. Segment displays with more than seven segments are also available that can display the whole alphabet, but no standard decoder IC exists to control these.

Using pixels

If you wish to display graphics as well as letters and numbers, you could get a display specially built with the appropriate segments (very expensive!) or use another technique that uses uniform segments called ‘pixels’.

A pixel may be a small dot of phosphor in a CRT display, a small square etched on an LCD, or a single LED on a large LED display, but they are always arranged into a grid. The more pixels there are in the grid, the more complex the displayed image can be.

LED ‘moving message’ systems usually have one LED for each pixel and are commonly seen in shop windows and at railway stations.

Five pixels by eight pixels is a common size for a single letter or number on these displays Control of these displays is usually by computer because there has to be a way of storing the pattern of pixels that is to be displayed, but it is possible to build one using standard logic parts and a memory IC
(see the Moving Message Display System Project Report for some example circuits).

Building a display with individual elements

A green 10-LED bargraph display which fits into a 20-pin IC holderIf you want a set of ten LEDs to light one after the other, you could use the 4017 IC which is actually a counter and ‘1-of-10’ decoder combined. As you can see from the pin-out diagram of figure 1, it has ten outputs (Q0 to Q9) which will drive either single LEDs or LEDs in a ‘bar graph’ module like the one shown on the right. Each time that the clock input (CK) is taken from low to high, the next LED will light. After the ‘9’ LED, the sequence starts again from the ‘0’ LED.

Click here to read this datasheet in Adobe Acrobat format 4017 Datasheet
282Kb

 

Figure 1: Pin-out of the 4017 decoder IC

The circuit is shown in figure 3. You could clock the 4017 using a push button (suitably de-bounced with a monostable) or use an astable circuit to provide a regular pulse. These circuits are discussed in issues 3 and 4 of Electronics in Meccano.

The 4017 IC does not let you switch on the LEDs in any order that you wish. To do that, you will have to use a decoder IC that accepts a binary input. One such IC is the 4514 ‘1-of-16’ decoder which has 16 outputs (Q0 to Q15) and four inputs (A to D), as shown in the pin-out diagram of figure 2. The binary number on the inputs determines which output is active; for example, if the binary number is 0110b, then the sixth output (Q5) would be active.

Click here to read this datasheet in Adobe Acrobat format 4514 and 4515 Datasheet
262Kb

The outputs of the 4514 are ‘active high’.  This means that all the outputs are low except the ‘active‘ one determined by the binary number on the inputs.  If what you require is the opposite of this, then you can use the 4515 which has exactly the same pin-out and function as the 4514, except that its outputs are ‘active low’.

Figure 2: Pin-out diagram of the 4514 decoder IC

You could use the outputs from a 4520 binary counter as the inputs to the 4514 to achieve the same cycling effect as we did with the 4017 IC, except now with 16 LEDs (as in figure 4), or you could use four switches to tell the 4514 which output to make active (as in figure 5).

Suppose that you use the 4520 and 4514 together as suggested, but that you want to create a ‘1-of-12’ decoder that uses 12 LEDs instead of 16. You would need to restart the cycle as soon as Q12 became active. This can be achieved by using the Q12 output to reset the 4520 counter, as shown in figure 6. Using this technique, you can create a ‘1-of-n’ decoder, where ‘n’ is any number you want up to the limit of the decoder IC.

Remember that you do not have to use decoder outputs to drive LEDs – they can drive lamps, relays and motors as well. However, the outputs will not drive these devices directly because they can only provide a current of around 10mA. Figure 7 shows one output driving a transistor, which in turn drives
a motor.

A use for a decoder IC in Meccano might be the control of several motors using one switch and a push button. For example, a crane may have four or more motors/solenoids to be controlled, which would normally require several two-way switches with centre-off positions.  Instead, you could have a push button clocking a 4017 and use the first few outputs to switch in each motor/solenoid in turn. You would then need only one two-way centre-off switch to control the selected motor/solenoid.  This control system would have the advantage that fewer wires would be need to be routed up the tower in tower crane models which have a rotating jib, if the circuit is placed in the jib.  You would need one wire from the push button and one power supply wire, assuming that the chassis is used as the return path for the power supply. 

Another use for a decoder IC would be to switch on several motors, or other components, in a set order.
Switches wired in series, activated by various parts of the mechanism, could clock the counter via a monostable circuit so that the next component would be activated.

Figure 3: Using a 4017 decoder ICFigure 4: Using a 4514 decoder IC
Figure 5: A switch input to a 4514 input pinFigure 6: Resetting the counter when decoder output Q12 is active - a 1-of-12 decoder
Figure 7: An output controlling a motor

Figure 10: 7-segment displayBuilding a display with segments

As mentioned earlier, displays with seven segments are available which can display the numbers from 0 to 9 and a few letters of the alphabet as well. Most have red or green LEDs (sometimes even both in one package) and can be brought in several sizes.

A red 7-segment LED displayA typical 7-segment display is shown on the right. It has eight red LEDs (7 for the segments and one for a decimal point) with 5 pin connections on each side, as shown in figure 10. These pins are spaced at a 0.1" pitch so the display can be placed on a breadboard just like an IC. Soldering wires to the pins is not advisable, so you should use a 14-pin IC holder to accommodate the display in the same way that you would for an IC.

This 7-segment display has two ‘common cathode’ pins (4 and 12), either of which should be connected to the 0V terminal of your power supply. ‘Common anode’ displays are also available, but they cannot be used with the 4511 decoder IC which is described below. The other pins are labelled ‘a’ to ‘g’ and are used to light each of the 7 segments. The ‘DP’ pin lights the decimal point segment.

Figure 11: Pin-out of the 4511 decoder ICThe 7-segment decoder IC

The 4511 is a ‘7-segment decoder driver’ IC. The ‘driver’ part means that unlike most 4000 series ICs, it is capable of supplying enough current to the 7-segment display to make its LEDs shine brightly. This also means that it can be used to drive other types of 7-segment display that don’t use LED segments.

Click here to read this datasheet in Adobe Acrobat format 4511 7-segment Decoder Datasheet
330Kb

From the pin-out diagram of figure 11 you can see that there are seven output pins labelled ‘a’ to ‘f’.

These should be connected to the matching pins on the display via the usual current-limiting LED resistors
(see issue 2 of Electronics in Meccano for details of these).

The four input pins A to D accept a Binary Coded Decimal (BCD) number which means that only binary numbers 0000b to 1001b are valid inputs. Binary numbers from 1010b to 1111b are simply ignored and the display will go blank.

Three other input pins set the mode of the IC:

The circuit in figure 12 illustrates all of the above – the binary input to the 4511 is being provided by a 4518 BCD counter IC. This IC has exactly the same pin-out as the 4520 (with two counters in the package) and its only difference is that it counts in BCD instead of binary, which is what the 4511 needs. As before, you could clock the 4518 using a push button or use an astable circuit to provide a regular pulse.

Click here to read this datasheet in Adobe Acrobat format 4518 Counter Datasheet
323Kb

 

Figure 12: Driving a 7-segment display with the 4511 decoder IC and the 4518 counter IC

The 4029 counter IC can also count in BCD, and it allows you to count down as well as up. To get a multi-digit display, build one of the circuits in figure 12 for each digit you require and ‘cascade’ the counter ICs by connecting the QD output of the first counter to the Clock (CK) input of the next counter.

Goto top of page


Motor control with a Darlington Pair
By John Hewes

The job of a transistor is to allow the small amount of current that enters its ‘base’ terminal to control the amount of current flowing from its ‘collector’ terminal to its ‘emitter’ terminal. This allows a low power circuit to control a higher power circuit, either in an on/off fashion or linearly.

The low power circuit in figure 13 is simply a potentiometer (variable resistor) connected between +Vs and 0V such that the voltage on its wiper terminal will always be somewhere at or between these two voltages.

The small amount of current that is flowing out of the potentiometer’s wiper is amplified by two transistors, known as a ‘Darlington Pair’, so that the speed of a motor can be adjusted using the potentiometer.

The power supply for this circuit should preferably be un-smoothed (i.e., directly from the power supply rectifier, see issue 4 of Electronics in Meccano) which gives the advantage of reduced motor sticking at low speeds. However, a small disadvantage of the circuit is that the maximum voltage that the motor can receive is 1.4V less than the power supply voltage, due to losses in the transistors.

Pin-out diagrams for both the BFY51 and TIP31A transistors are shown in figure 14. Note that the TIP31A transistor must have a heatsink because the relatively high current that drives the motor is passing through it.

Figure 13: Motor control using a Darlington PairFigure 14: Pin-out diagrams of the TIP31A and BFY51 transistors

The Electronics in Meccano Circuits Shop Buy Four Motor Controllers from the Electronics in Meccano Circuits Shop

Click here for details

 

Goto top of page


Title: Shopping ListThe following lists the electrical parts that are discussed in the articles. Prices and order codes given are taken from the current Maplin catalogue, which is the probably best source of electronic components for the hobbyist in the UK.

If you have access to a company account with Rapid Electronics or RS Electronics you may find these companies are cheaper.

Digital electronics: Decoders
Maplin Order Code Price Page
NE555 Timer IC QH66W 29p 292
8-pin IC holder BL17T 14p 304
14-pin IC holder BL18U 19p 304
16-pin IC holder BL19V 19p 304
24-pin IC holder BL20W 24p 304
4017 1-of-10 counter/decoder IC QX09K 99p 250
4029 4-bit binary/BCD up/down counter IC QW20W 99p 250
4511 7-Segment decoder IC QX31J 99p 250
4514 1-of-16 ecoder IC with active high outputs QW85G £1.49 250
4518 Dual 4-bit BCD counter IC QX32K 99p 250
4520 Dual 4-bit Binary counter IC QX33L 99p 250
Red 10 LED Bar graph display BY65V £1.99 187
Green 10 LED Bar graph display YG33L £1.99 187
Red 0.3" 7-Segment display (common cathode) FR38R £1.34 188
BFY51 Transistor QF28F 49p 247
1N4148 Signal diode QL80B 8p 246
SPST toggle switch FH97F £1.09 308
0.1mF Capacitor BX76H 15p 91
Stripboard (about 24 holes x 12 rows) JP47B £1.79 204
Motor control with a Darlington Pair
 
Parts needed to build the motor speed controller in figure 13:
Maplin Order Code Price Page
1 x BFY51 Transistor QF28F 49p 248
1 x TIP31A Transistor QL15R 69p 248
1 x 1kW Resistor M1K 7p 221
1 x 1N4148 Signal diode QL80B 8p 246
1 x 10kW linear variable resistor FW02C 89p 226

Maplin charge £2.50 for delivery on orders under £30.00 inc. VAT.
Prices are taken from the September 2000 - August 2001 Maplin catalogue, and include VAT at 17.5%

Contact their order line on 0870 264 6000 or visit one of their shops.
Their customer service line is 0870 264 6002 and they have a website at www.maplin.co.uk where on-line ordering is available.

Goto top of page


EiM Logo

www.eleinmec.freeserve.co.uk

Electronics in Meccano July 2000 -- Issue 8

Edited by Tim Surtell
E-mail: timsurtell@eleinmec.freeserve.co.uk


| Home | Contents of Issues | Index | About | Letters | Printed Edition | Circuits Shop | Wizards | SELMEC | Links |