# Doctronics

## 1 : BEGINNINGS

In this Chapter, you will find out how to generate digital signals, and how to use LEDs, or light-emitting diodes, to indicate a logic state. In addtion, you will find out how to build test circuits using prototype boards and how to use a multimeter to make voltage measurements.

In Chapter 2, you will investigate the properties of AND, OR, NAND, NOR and EXOR logic gates and summarise their actions using truth tables.

Custom Search

## 1.1 Signals from switches

Miniature tactile switches

Digital circuits process signals which are either LOW voltages, called 'logic 0', or just '0', or HIGH voltages, called 'logic 1', or '1'. To start investigating digital circuits, you need to know how to produce LOW and HIGH voltages by operating a switch.

Look at the circuit diagrams below:

 Signals from switches

These show two ways of arranging switches. In the first circuit, the 10 kΩ resistor is connected as a pull up resistor. This means that Vout from the circuit will be HIGH when the switch is open, and LOW when the switch is closed. In the second circuit, the 10 kΩ resistor is connected as a pull down resistor, with the result that Vout is LOW when the switch is open and HIGH when the switch is pressed.

Both of these circuits are examples of voltage divider circuits in which Vout depends on the ratio between Rbottom, the resistance below the Vout connection and Rtop, the resistance above the connection. The voltage divider formula is:

Work through the formula for the circuit with the pull up resistor, substituting a very large value for Rbottom, say 10 MΩ, to calculate Vout when the switch is open, and a very small value, say 1 Ω, to estimate Vout when the switch is closed.

All of this theory is nice (and arguably important) but you need to see the circuit in action to put the theory into context. This involves building a temporary, or 'prototype' circuit, as explained in the next section.

Prototype board is used for building temporary circuits, without needing to solder components together. Component leads and wire links are pushed into the holes in the board to make the right connections.

It is important to understand how prototype board works. Inside the board, there are metal channels with springy contacts, as shown in the diagram below.

 Inside prototype board

As you can see, the channels are arranged in rows. To see the detail, try zooming the image by dragging on the small red control. Place the cusor anywhere over the image and hold the left mouse button down to drag it around.

The small button links to the next stage in the prototype board sequence. This means that you can skip forwards and backwards from one stage of construction to the next, helping you to check that all the components and links are correctly located. Try it now. The button opens the drawing in a new window which you can resize to fill the screen.

Did you notice the two long channels at each side of the board? These are used to make power supply connections. 0 V is always connected on the left hand side of the board, with +V always on the right hand side. This is a convention which you should follow: most integrated circuits have pin layouts which conform to this arrangement and it is easier to interpret your circuits and fault find if you always know where the power supply connections ought to be.

 Making power supply connections

In the centre of the prototype board, there is a gap, and on either side, there are short channels each corresponding to a horizontal group of 5 holes.

• If you want component leads to be connected, plug them into the same horizontal row of holes.
• Opposite ends of a single component will always be pushed into holes on different horizontal rows.
• Integrated circuits fit across the gap in the centre of the board.

If you think about the arrangement of the metal channels inside the prototype board, all of this makes perfect sense.

Wire links are made using 0.6 mm solid core wire. You can remove around 5 mm of the outer PVC insulation from each end using wire strippers. Professional wire strippers available from Rapid work well. Light duty wirestrippers are OK if you are on a budget, but are less easy to use. Keep wire links for reuse. Two or three different colours of wire make circuits much easier to follow.

If you are using a prototype board at school or college, an adjustable voltage power supply will often be available. If you are working on your own, a good alternative is to use a 3xAA battery holder providing 4.5 V, together with a battery clip.

The picture shows a different type of battery holder, but the link points to the correct component. The battery clip suits a PP3 battery, but also connects with the battery holder. The ends of the leads from the battery clip are pre-soldered and can usually be pushed into the power supply holes without difficulty. The red lead is the +V connection, and the black lead is 0 V.

## 1.3 Building the prototype circuit

Carefully follow the diagram below. The push button switches used are 'miniature tactile switches'. These are cheap and have the advantage that the switch terminals can be pushed into the prototype board without damage.

 Building the circuit

Look at the way in which the push button switches are connected on the prototype board. The placement of the components and link wires exploits the way in which the contacts are arrranged inside the switch. As you can see in the diagram below, the top two pins of the switch are internally connected by a metal strip:

 Inside a miniature tactile switch

The bottom two pins are connected in the same way. As a result, either pin from each pair can be used to make connections to other parts of the circuit. This is a common arrangement for push button switches intended for use on printed circuit boards, PCBs, and helps to simplify the design of PCB layouts for keyboard circuits.

How can you tell what happens to the output signals when you operate the two switches?

You are most likely to use a multimeter to make measurements from circuits. As its name suggests, a multimeter is a versatile instrument which can be used as a voltmeter, as an ammeter (to measure electric current), or as an ohmmeter (to measure resistance). The diagram below shows one of several switched range multimeters available from Rapid:

 Switched range meter

The meter looks complicated but is simple to use. The central knob is rotated to select the function you want. This works in the diagram. Try dragging with the mouse using the red control on the meter knob. Clicking the text next to the black dots moves the knob to a new position immediately.

Click the button to open the meter drawing in a new window and resize to fill the screen.

You can get a good idea of how the meter works by exploring the diagram. To measure DC voltage, the ranges in the top left corner are used. If the knob is rotated to '20', then 20 V is the maximum voltage which the meter can measure. With this setting, the meter is said to have a full scale deflection, or fsd, of 20 V. This is appropriate for circuits with a 4.5 V power supply. If the knob is clicked round to '2000 m', the maximum reading will be 2000 mV, or 2 V, and so on. In this case, you want to measure voltages up to 4.5 V, so the '20' setting is correct.

To use the multimeter as a voltmeter, remember that voltmeters are connected in parallel with any test circuit. This makes it easy to connect a voltmeter to the circuit. For the Vout measurements you want to make here, the 'COM' socket of the meter is connected to 0 V. It is helpful to use BLACK-coloured leads for 0 V connections. For the 'VΩmA' socket, you should use a RED-coloured lead, with a probe or crocodile clip to connect into the circuit.

 Measuring Vout

The voltmeter is represented in a simplified form. What happens when you press the miniature tactile switch? Initially, the switch is an open circuit, the pull up resistor is doing its job and the voltage you measure is close to the power supply voltage, 4.5 V. When you operate the switch the switch becomes a closed circuit connecting to 0 V.

Move the red meter lead to the stripped end of the second link wire, coloured green in the diagram. What is Vout for the second voltage divider? What happens now when you press the switch?

• To generate a HIGH voltage, logic 1, when you press a switch, use a voltage divider circuit with a pull down resistor. The switch is at the top of the voltage divider.
• To generate a LOW voltage, logic 0, when you press a switch, use a voltage divider circuit with a pull up resistor. The switch is at the bottom of the voltage divider.

Review what you have learned so far in this Chapter. These voltage divider circuits allow you to send HIGH and LOW voltages to logic circuits and you will use them often.

## 1.4 Driving LEDS

LEDs, light-emitting diodes

It is not always convenient to use a voltmeter to investigate logic signals. Sometimes, you will want to 'see' what is happening using a light-emitting diode, or LED, which lights up when there is a HIGH voltage at some particular point in the circuit. The right way of doing this is about to be revealed.

 Lighting up an LED

The diagram shows an LED operated from a 4.5 V supply. You may know that an LED requires 10-15 mA of current to illuminate brightly and that a voltage of around 2 V, called the forward voltage, is needed across the LED. You should also know that a resistor must be connected in series with the LED in order to limit the current flowing through it.

How do you decide on the correct value for the resistance of the series resistor? As you can see, the voltage across the resistor is 4.5-2=2.5 V, that is, the power supply voltage minus the forward voltage of the LED. The current through the resistor is to be 10 mA. You can calculate the resistor values as follows:

The nearest E12 resistor values are 220 Ω and 270 Ω. (The E12 series is the common= series of resistor values available from electronics suppliers). Either resistor value could be used, with 220 Ω, the LED will be slightly brighter.

Although 10 mA is not a huge current, it is more than the ouptut of most logic gates can provide. This means that you should not connect an LED directly to your logic circuit. What was a HIGH voltage might be a HIGH voltage no longer, and what was a functioning circuit could easily be prevented from working!

Transistors, BC547B

The current required from the logic circuit must be reduced. This is a job for a transistor, connected as indicated in the circuit diagram:

 Using a transistor to drive an LED

The essential feature of transistor action is that a small current, the base current, controls the flow of a much larger current at the transistor's collector terminal. The current gain, hFE, of a typical small signal transistor is at least 100. That is, the collector current can be at least 100 times larger than the base current.

In this context, if the LED requires 10 mA, the current required to trigger illumination can be reduced to 10/100=0.1 mA. The 39 kΩ resistor in series with the transistor's base terminal limits its base current to this sort of level. All types of logic gates can easily provide currents of this magnitude and operation of the logic circuit will be unaffected.

The prototype layout diagram below shows you how to add transistor/LED driver circuits to your switch circuits.

Build the circuit following the prototype board layout and then test the operation of the two switches. Do the LEDs illuminate when Vout from the corresponding switch circuit is HIGH? Save your prototype board layout for Chapter 2.

## 1.5 What have you learned?

DOCTRONICS recommends...

• Logic circuits process voltage signals which can either be LOW, logic 0, or HIGH, logic 1. The logic 0 level is close to 0 V, while logic 1 is close to the power supply voltage, whatever that happens to be.
• You can generate logic signals using voltage divider circuits consisting of a push switch and a resistor. If a pull down resistor is used, with the switch at the top of the voltage divider, logic 0 is the initial logic level and a logic 1 is generated by pressing the switch. If a pull up resistor is used, with the switch at the bottom of the voltage divider, logic 1 is the intial logic level, changing to logic 0 when the switch is pressed.
• Prototype board is very useful for building and testing electronic circuits.
• You can investigate the behaviour of logic circuits using a multimeter. Usually, the multimeter is configured as a voltmeter.
• LEDs require too much current to be connected directly to the outputs of most logic circuits, but useful indicator circuits can be constructed using transistors to drive LEDs. The transistor increases the current available without loading the output of the logic circuit.