Electronics Lab Manual This manual was originally written in TEX by Harold Stokes for Physics 340, the electronics lab for physics majors at BYU through Spring 2006. When the lab courses were rearranged to put the electronics lab at the front of the sequence as Physics 140, the manual was modified by Robert Davis and Grant Hart to better suit the new clientele. It has been modified by Branton Campbell to adjust the labs and sequence. Many of the changes were suggested by the student Laboratory Assistants as they have observed the difficulties some of the exercises presented. Rob Davis and Branton Campbell, with students Kristian Sims and Michael Rawlins developed and tested the Audio Amplifier exercise. Bryan Peterson separated the AC Measurements and RC Circuits labs to allw more time to become acquainted with the oscilloscope. The introduction to the oscilloscope was rewritten, along with some of the exercises, since we have changed from a Tektronix analog oscilloscope to a LeCroy digitial oscilloscope for the exercises. We appreciate the assistance of the many students that have contributed ideas and corrections to the manual. Lab Kit Contents 51 resistors, 1 4 W, 5% 1 each: 120, 150, 180, 220, 270, 330, 390, 470, 560, 680, 820, 1.2k, 1.5k, 1.8k, 2.2k, 2.7k, 3.3k, 3.9k, 4.7k, 5.6k, 6.8k, 8.2k, 12k, 15k, 18k, 22k, 27k, 33k, 39k, 47k, 56k, 68k, 82k 2 each: 100, 100k, 1M, 10M 5 each: 1k, 10k 2 2 2 4 2 1 1 4 1 4 1 2 1 1 2 1 1 1 1 2 1 1 1 1 1 2 1 1 1 1 1 1 2 1 100 pF ceramic capacitors 1000 pF ceramic capacitors 0.01 µF ceramic capacitors 0.1 µF ceramic capacitors 1 µF electrolytic capacitors 10 µF electrolytic capacitor 100 µF electrolytic capacitor 1N4148, signal diodes W04G or VM48, diode bridge red LEDs 2N3904, npn small-signal transistor 2N3906, pnp small-signal transistors IRF3704, power MOSFET phone jack pushbutton switches #47 incandescent lamp speaker i TL3472, dual op-amp 311, comparator 555, timers 7400, quad NAND gate 7402, quad NOR gate 7408, quad AND gate 7414, hex inverter 7432, quad OR gate 7474, D-type flip-flops 74193, up-down counter 74154, 4-bit decoder DC10SRWA, 10 segment LED display TDA7056B, audio amplifier 78L05, positive output 5 V regulator wire kit breadboards 9 VDC power supply Resistor Color Code The values of resistors are indicated by three bands of colors. Each color corresponds to a number: 0 1 2 3 4 5 6 7 8 9 -1 -2 black brown red orange yellow green blue violet gray white gold (exponent only) silver (exponent only) The three bands represent three numbers: n1 , n2 , n3 . The value of the resistor is given by R = n1 n2 × 10n3 (in ohms). For example, if the three bands are yellow, violet, and red, the value of the resistor is 47 × 102 = 4700 Ω. The fourth band on the resistor indicates tolerance: gold = ±5% and silver = ±10%. This is rare in modern resistors, but if there is no fourth band the tolerance is ±20%. If there is a fifth band on the resistor it generally indicates the quality of the resistor. High precision resistors (2% or better tolerance) will have four bands to indicate the value – 3 digits plus a multiplier. The tolerance band is then the fifth band with possible values: brown = ±1%, red = ±2%, green = ±0.5%, blue = ±0.25%, and violet = ±0.1%. ii Resistor Values in Lab Kit (Quantity in parentheses) brown red orange yellow green blue brown-black 100 (2) 1k (5) 10k (5) 100k (2) 1M (2) 10M (2) brown-red 120 (1) 1.2k (1) 12k (1) brown-green 150 (1) 1.5k (1) 15k (1) brown-grey 180 (1) 1.8k (1) 18k (1) red-red 220 (1) 2.2k (1) 22k (1) red-violet 270 (1) 2.7k (1) 27k (1) orange-orange 330 (1) 3.3k (1) 33k (1) orange-white 390 (1) 3.9k (1) 39k (1) yellow-violet 470 (1) 4.7k (1) 47k (1) green-blue 560 (1) 5.6k (1) 56k (1) blue-grey 680 (1) 6.8k (1) 68k (1) grey-red 820 (1) 8.2k (1) 82k (1) iii 45 50 55 60 50 55 60 30 30 45 25 25 40 20 20 40 15 15 35 10 10 35 5 5 -+ +- 1 A BCDE A BCDE FGH I J FGH I J 1 -+ +- Breadboard Layout Above is shown the layout of a breadboard similar to the one you will be using during this course. There may be some minor differences between the diagram above and the actual breadboard you will be using. The dots represent holes into which you can insert the ends of wires and the leads of resistors, capacitors, ICs, and other electronic components. The lines on the figure show how the holes are internally connected. Voltages from the power supply and ground are usually applied to the bus lines along the top and bottom edges of the board so that every component on the breadboard can have easy access to them. Your breadboard may not have numbers and letters to organize the rows and columns. For most of the exercises you can ignore the numbers and letters. iv 3-Terminal Packages (printed side up) DRAIN SOURCE DRAIN GATE IRF 3704 COLLECTOR BASE EMITTER 2N 390x IN GND OUT 78L05 IRF3704 N-Channel MOSFET 2N3904, NPN transistor 2N3906, PNP transistor 78L05 5-Volt Regulator IC (integrated circuit) Packages TL3472 op-amp W04G Diode bridge AC 1 + ~ + 04 W 2 V+ 8 − G − V+ 8 1 7 2 + 7 2 6 3 BAL 6 3 5 4 V- BAL 5 4 − + ~ - 1 GND + 3 555 Timer LM311 Comparator AC 7400 NAND gates 4 V- 7408 AND gates 7402 NOR gates 1 8 2 3 7 4 5 6 6 7 5 8 GROUND TRIGGER OUTPUT RESET CONTROL VOLTAGE THRESHOLD DISCHARGE V+ 7414 Inverters 7432 OR gates 1 VCC 14 1 VCC 14 1 VCC 14 1 VCC 14 1 VCC 14 2 13 2 13 2 13 2 13 2 13 3 12 3 12 3 12 3 12 3 12 4 11 4 11 4 11 4 11 4 11 5 10 5 10 5 10 5 10 5 10 6 9 6 9 6 9 6 9 6 9 7 GND 8 7 GND 8 7 GND 8 7 GND 8 7 GND 8 74154 Decoder 7474 Type-D flip-flops 1 1R VCC 14 2 1D 2R 13 1 Y0 VCC 24 DC10EWA LED bar 74193 Counter 2 Y1 A0 23 3 Y2 A1 22 1 D1 1 20 VCC 16 2 19 1 n.c. 2 VP 4 Y3 A2 21 2 Q1 D0 15 3 18 5 Y4 A3 20 3 Q0 MR 14 4 17 6 Y5 E2 19 4 CPD TCD 13 5 16 E1 18 3 VIN 4 SGND 3 1CLK 2D 12 5 VCTRL 4 1S 2CLK 11 5 CPU TCU 12 6 15 8 Y7 Y15 17 6 Q2 7 14 9 Y8 Y14 16 7 Q3 10 Y9 Y13 15 8 GND D3 7 Y6 5 1Q 6 1Q TDA7056B Audio-amp 6 OUT+ 2S 10 PL 11 7 PGND 2Q 9 D2 10 8 13 9 12 10 11 8 OUT- 7 GND 2Q 8 11 Y10 Y12 14 12 GND Y11 13 v 9 9 n.c. Lab 1 Voltage and Current Notes for Lab 1: Voltage and Current Electric Charge: Electric charge is a fundamental property of matter. The electric force between charged objects varies like the inverse square of the distance between them, and the more electric charge an object has, the more electric force it experiences in the vicinity of other charged objects. Electricity and gravity are similar in this respect. But unlike gravitational mass, electric charge comes in two varieties, which American physicist Benjamin Franklin discovered to be opposites that can cancel one other out; he coined the terms positive and negative to describe them. Opposite charges attract one another, and like charges repel one another. Though we can’t reverse the direction of gravity to make objects fall up rather than down, it is possible to reverse the direction of an electric force by changing the sign of one of the charges. Thus, electric forces can either push or pull, while gravity can only pull. It is often helpful to think of electric charge as a fluid like water. A cup of water can be subdivided over and over again until arriving at a smallest indivisible building block, the H2 O molecule. Similarly, electric charge has a smallest indivisible building block: the electron charge. The standard international (SI) unit of electric charge was named in honor French engineer Charles Coulomb, who first quantified the strength of the electric force. A Coulomb (C) of electric charge is equivalent to the charges of 6.241 × 1018 electrons, so that one electron charge (e) is equivalent to 1.602 × 10−19 C. Electric charges you may have experience with include the charge on a balloon that you rubbed on your hair or sweater (10−6 C), the charge transferred in a bolt of lightening (15 to 300 C), or the charge in a AA battery (7.5 kC). Electric Current: The flow of electric charge is analogous to the flow of a fluid, and it is useful to think of the electric charge flowing through a wire in terms of water flowing through a pipe. When electric charge flows through a circuit, we refer to the rate of flow as the electric current. Just as the flow of water can be measured in liters per second, electric current can be measured in Coulombs per second (C/s). In honor of French physicist, Andre Ampere, who made major contributions to early study of electricity, the SI unit of electric current is the ampere which is usually abbreviated as amp or just "A". One amp is equivalent to one Coulomb/second (C/s). Electric currents common to everyday experience might include those flowing through an LED light bulb (20 mA), an incandescent bulb (1.0 A), a laptop computer (3.0 A), an electric range (20-30 A), an electric car (200-500 A), or a bolt of lightening (35 kA). As you know, a sufficiently large electric current can do damage to an object that it flows through. For steady currents in humans, 1 mA generates a mild tingle, 10 mA hurts, 10-100 mA results in loss of muscle control and potentially fatal heart fibrilations, 100-2000 A can stop the heart and damage nerve tissues, and larger currents can further cause severe burns (http://en.wikipedia.org/wiki/Electric_shock). Conductors, insulators, and resistance: It is possible for electric charge to flow through otherwise empty space, an example being the solar wind, a very hot but neutral collection of fast-moving electrons and protons. But at ordinary temperatures, opposite electric charges 3 4 Notes for Lab 1, Voltage and Current strongly prefer to come together to form electrically neutral atoms, which then further coalesce into various forms of matter, such as gas, liquid and solid. It should probably be surprising that electric charge can actually flow inside of a liquid or solid material. A material that permits such an internal flow of electric charge is called a conductor, while a material that does not is called an insulator. By surrounding conductors with insulating materials such as air, glass, wood, plastic, etc., one can define very specific pathways for the flow of electricity in a circuit. In the context of electronics, the most common conductors that you will encounter are metallic wires. But in reality, all materials (even those that we call insulators) conduct electricity to some degree. The words metal and insulator are technical terms that identify the physical mechanism of current flow in a material. For an object made of any given material, the resistance of the object quantifies just how hard or easy it is for electric current to flow through it. In recognition of the pioneering work of German physicist Georg Ohm, the SI unit of electric resistance is the ohm, abbreviated as Ω. For a one-centimeter length of rod or wire with a 1 mm diameter, the resistance of some common materials are 0.002 Ω for copper, 0.9 Ω for graphite, 76 × 106 Ω for pure silicon at room temperature, and 1 × 1020 Ω for wood or glass. With such high values of resistance, it’s no surprise that wood and glass are called insulators. Passive two-lead circuit elements designed to have intermediate values of resistance in the range from about 0.1 Ω to 107 Ω are known as resistors, and are typically made of carbon or of thin-film ceramic materials. A resistor impedes or resists the flow of current – hence the name. When a battery pushes electric current through a conducting wire, electric charge is transferred from one battery terminal to the other, while the conductor itself remains electrically neutral. Franklin correctly hypothesized that this is possible because the conductor itself is comprised of equal amounts of positive and negative charge, some of which is free to move inside the conductor. He found that a that an object can become positively charged either by adding positive charge or by taking away negative charge. From the outside, we can’t tell the difference. The electrically-charged mobile species within a conducting material are called charge carriers. The atomic nucleus of each atom is positively charged, whereas the electrons that orbit the nucleus are negatively charged. In most metals, one or more of the outermost electrons of each atom become delocalized so as to travel freely throughout the entire conductor rather than being associated with a specific atom. In contrast, the positively-charge atomic nuclei are not mobile. Thus, in a metal, the charge carriers are negative! In insulators, the charge carriers can be either positive or negative, and are not delocalized, but rather hop from site to site when the temperature is high enough to occasionally kick them over local energy barriers. Based on this conduction mechanism, semiconductors and ionic conductors are actually classified as insulators, though they don’t insulate well in practice. Consider a battery with its positive terminal on the left and its negative terminal on the right, connected to each other by a conducting wire. Electric current then flows through the wire from the positive terminal to the negative terminal (from left to right). If we could see the microscopic activity inside the wire, we might see positive charge carriers flowing in the direction of the current (left to right), or alternatively, negative charge carriers flowing opposite the direction of current (right to left), or maybe even both. From outside the wire, Notes for Lab 1, Voltage and Current 5 however, these scenarios look the same and have the same outcome. If the wire material is a metal, we often conveniently pretend that the charge carriers are positive, flowing from left to right in the direction of the electric current, though we know that this isn’t true. The carriers in a metal are negatively-charged electrons, and must therefore flow opposite the current (right to left). The decision to designate the electron charge as negative rather than positive was arbitrary and historical, and certainly makes the study of electricity more confusing. But as long as we all agree on the convention, it doesn’t matter. So don’t rock the boat! Electrons are negative; and they flow left, we say that the current flows right. Electric Potential or Voltage: Analogous to pressure in a water-flow circuit, voltage is what causes electric charge to flow in an electric circuit. Just as increasing the pressure at one end of a hose increases the flow of water, increasing the voltage across a conductor increases the flow of charge. And reversing the direction of the voltage reverses the direction of flow. In recognition of Italian chemist/physicist Alessandro Volta’s invention of the electrochemical battery, the SI unit of voltage is the Volt (V). Electric potential is a more formal name for voltage. Electric potential (voltage) does not have an absolute zero, and can only be defined as a difference. The zero-potential point in any system is arbitrary. Whenever we say voltage or potential, we really mean voltage difference or potential difference. If the electric potential of a power line is 1 megavolt (MV) higher than that of the earth, we could say that the earth is at 0 V and the power line at +1 MV, or we could say that the power line is at 0 V and the earth at −1 MV. Or we could arbitrarily choose the zero-potential point to be somewhere in the middle. Going back to the gravitional-mass analogy of electric charge, electric potential (voltage) is highly analogous to gravitational potential, which is approximately proportional to elevation near the surface of the earth. When hiking, for example, the energy required to climb from one elevation to another is equal to ∆E = m∆Vg = mg∆h, where m is your mass, ∆Vg is the change in gravitational potential, g ≈ 9.80 m/s2 is the gravitational acceleration, and ∆h is the change in elevation from base to peak. Similarly, the energy required to move an electric charge Q from a low voltage to a high voltage is ∆E = Q∆V . A battery or other power supply is like a pump that uses pressure to move a positive electric charge uphill on the voltage landscape, and thereby increases the electric potential energy of the system. When this positive charge is released, it will roll downhill again towards regions of lower voltage, converting its potential energy into other forms of energy, such as kinetic or heat energy, along the way. Electrical Ground: For safety reasons, it is common to use a wire to connect some reference point in a circuit to the earth, and refer to this reference point as electrical ground, assigning it a zero voltage. Even for circuits that are not electrically connected to the earth, we typically choose a reference point to call ground anyway. It doesn’t matter which point we call ground, so long as we all agree on the choice. Having an agreed-upon reference point allows us to discuss the voltage at any point in the circuit without using the cumbersome language of differences. For example, when we say that the voltage is +10 V at some point in the circuit, we really mean that it is 10 V higher than the agreed-upon ground point. In circuit diagrams, we use the symbol to indicate ground. AC vs DC circuits: Our course will focus primarily on circuits in which the currents and 6 Notes for Lab 1, Voltage and Current voltages are constant in time, which are commonly known as direct current or "DC" circuits. Circuits with sinusoidally-varying currents and voltages, on the other hand, are known as alternating current or "AC" circuits. Most complicated electronic devices use DC circuits, whereas most electric power is distributed via AC circuits. Ohm’s Law states that the voltage V across a circuit element is proportional to the electric current I flowing through that circuit element, where the constant of proportionality is the electrical resistance R of the element, so that we have V = IR. Thus, at fixed voltage, a larger resistance to flow results in a smaller current. Despite the fact that Ohm’s law is a simple linear relationship, it tends to be the subject of considerable confusion and angst amongst beginning electronics students. The challenge lies in the fact that Ohm’s law can either be applied to an individual circuit element or to a network of circuit elements, and that it can be tempting to try to relate the current through one portion of the network to the voltage across another portion of the network. You’ll generally be safe if use Ohm’s law to relate the voltage difference between two points in a circuit to the current flowing through the network between those same two points, via the resistance of the network between those same two points. Electric power: A battery or generator must do work to push electric current through a resistor. The work is expended in lifting electric charge uphill to the positive-voltage side of the resistor, which energy is then dissipated as heat as the charge flows downhill inside the resistor. The physical mechanism of energy dissipation is the collisions of conduction electrons with the thermal vibrations of the atomic lattice (imagine driving bumper cars through a forest of dancing trees). The rate of energy loss per unit time in the resistor (i.e. dissipated power) is calculated as P = IV = I 2 R = V2 . R These three expressions are equivalent, and can all be used to calculate power. Which one we use in a given situation is a matter of convenience, and depends on which quantities we know at the time that we perform the calculation. Kirchhoff’s Laws of Circuit Analysis: The goal of a circuit analysis is to determine the voltage and current at every point in the circuit. Before we state the basic principles used to perform such an analysis, we need to define some elementary circuit structures: junctions, loops, and branches. A circuit junction is a point where three or more wires come together, so that current can flow into or out of the junction along multiple paths. Current doesn’t normally just flow out the end of a wire and into empty space. Rather, it circulates around a closed conducting path called a loop. An electric circuit is always comprised of one or more loops. Each conducting pathway that connects two adjacent junctions is called a branch of the circuit. A single-loop circuit has one branch and no junctions. A double-loop circuit can have either two branches and one four-way junction (if the two loops connect at only one point), or three branches and two three-way junctions. Kirchhoff’s Current Law states that the sum of the currents flowing into a junction equals the sum of the currents flowing out of a junction. In other words, no electric charge is created or destroyed at a junction – what goes in must come out. Notes for Lab 1, Voltage and Current 7 Kirchhoff’s Voltage Law states that the sum of the voltage changes encountered around any closed loop is zero. In a circuit, batteries and generators act like pumps that push the flow of electric charge uphill on the voltage landscape, whereas the current in a resistor is like a river running dowhill. When traversing a circuit loop in the direction of the current, an electric charge experiences a positive (uphill) voltage change while passing through a battery, and a negative (downhill) voltage change when passing through a resistor. On a closed-loop hike, the sum of the uphill and downhill elevation changes add up to zero, so that starting and ending elevations are the same. And in a closed-loop circuit, the sum of the positive and negative voltage changes add up to zero, so that the starting and ending voltages are the same. This is not a complicated principle. Wires as Equipotential Objects: In simple eletronic circuits, the electrical resistance of a highly-conducting metallic wire is often so small as to be neglected. Ohm’s law then tells us that the flow of current through such a wire is also negligible. In our circuit analyses, we will accept this simplification, and effectively assume that voltage is the same at every point on a wire or a network of directly-connected wires, no matter their length, shape, or configuration. When we want the voltage to be the same at two points in a circuit, we connect them with a wire. In the gravitational-potential analogy, a metallic conductor is like a lake; the elevation is constant across the lake because any attempt to change elevation on one side would be immediately counteracted by an an internal flow from one side to the other. Ditto for the voltage landscape of a metallic conductor; an internal flow of charge immediately counteracts any attempt to create a voltage gradient. Resistance of a Network: When a voltage is applied between two points of a network of connected resistors, the current must split across the various branches of the network, so that some resistors carry more current than others. In such cases, it normally takes more than mental algebraic manipulation to determine the current through and voltage across each individual resistor. The first step in the analysis of a complicated resistor network is the reduction to a single effective or equivalent resistance Reff that relates the overall voltage across the network to the total current through the network. One then attempts to sequentially divide the network into smaller and smaller branches until the current and voltage of each circuit element is known. When such a step-by-step reduction is not possible, one can always turn to the more involved matrix method. But we will concern ourselves primarily with simple networks that are easy to reduce by hand in just a few steps. Resistors connected between points A and B, such that an electric charge flows first through one and then through the next are said to be connected in series, and are equivalent to a single resistor whose resistance is obtained by a simple sum of the consituent resistances. We often call this series addition. A corollary of Ohm’s law is that resistors in series must pass the same current, but may experience different voltages. = R1 R2 R = R1 + R2 Resistors connected between points A and B, such that an electric charge can travel from A to B through any one of the resistors, are said to be connected in parallel, are equivalent 8 Notes for Lab 1, Voltage and Current to a single resistor whose resistance is obtained by inverting the sum of the inverses of the constituent resistors. We often call this parallel addition. A corollary of Ohm’s law is that parallel resistors experience the same voltage difference, but may pass different currents. R1 R2 = 1 1 1 = + R1 R2 R To obtain the effective resistance of a multi-loop circuit between two points, A and B, first perform series addition on any network branches that contain resistors in series. Then combine parallel branches via parallel addition. Iterate this process until a single branch with a single resistor is obtained. Take care not to attempt to treat a pathway that passes through point A or point B as a branch. Name In-Class Exercises for Lab 1: CID Voltage and Current 1. The top circuit shows a single light bulb (shown as a resistor) connected to a battery. Predict the brightness of both bulbs in the bottom circuit (labeled B and C) compared to the original bulb (labeled A). Assume all the bulbs are identical. (a) Both B and C are brighter than A. (b) Both B and C are the same as A. 12 V A (c) Both B and C are dimmer than A. (d) B is the same as A. C is dimmer. (e) B is the same as A. C is brighter. 12 V B C (f) C is the same as A. B is dimmer. (g) C is the same as A. B is brighter. 2. The circuit below shows two identical light bulbs in series. How does their brightness compare with A in exercise 1? (a) Both B and C are brighter than A. (b) Both B and C are the same as A. B (c) Both B and C are dimmer than A. (d) B is the same as A. C is dimmer. 12 V (e) B is the same as A. C is brighter. C (f) C is the same as A. B is dimmer. (g) C is the same as A. B is brighter. 3. For the circuit diagram below, assume that A is 660 Ω, and that both B and C are 120 Ω. Determine the equivalent resistance of the resistor network, the total current delivered by the voltage source, and the voltage at the junction connecting the three resistors (relative to ground, which is the low voltage side of the source). A 12 V B C Additional exercises on the next page 9 In-Class Exercises for Lab 1, Voltage and Current 11 4. Consider the circuit below, where all resistances are measured in Ω. Assume that no external voltage is applied to point B, or in other words, that the resistor is not connected to anything at point B. Find the voltages at the points A and B. 10 V 200 A 100 0V B 100 Lab 1 Exercises: Voltage and Current For these exercises, you will need a 5-V DC power supply, a hand-held multimeter, a breadboard, and several 1/4-W 100-Ω resistors. You will also need Internet access to the Circuit Construction Kit (an interactive Java applet) available from the Physics Education Technology (PhET) web site located at http://phet.colorado.edu/en/simulation/circuitconstruction-kit-dc. Before you begin, read the “Breadboard Layout” section in this lab manual. Resistors are labeled with bands of color that are coded as described in the “Resistor Color Code” section in this lab manual. Consider the following four circuits below. Each one has a DC voltage source (i.e., a battery or a DC power supply), and several resistors. #1: V #2: R V #3: R V #4: R R V R R 1. In the circuit diagrams above, assume that the voltage source delivers V=5 V, that ground (0 V) is defined to be the low-voltage side of the source, and that all resistors have the same value of 10 Ω. Then use Ohm’s law to answer the following questions. (a) On each of the circuit diagrams above, record the voltage expected at each point indicated by a black dot, and also record the current expected in each circuit element that connects two dots. Use correct units. (b) Why is the voltage the same on both sides of the resistor in circuit #1, but not in circuit #2? (c) Observe that the voltage differences across the two resistors in circuit #3 are the same as that of the resistor in circuit #2. How can the current through the source in circuit #3 then be different from that of circuit #2? (d) Why is the current through the source in circuit #4 half that in circuit #2? Additional exercises on the next page 13 3 Exercises for Lab 1, Voltage and Current 15 2. Using the interactive PhET applet, build each of the four circuits described above within the same workspace. Measure all of the same voltages and currents examined in the previous exercise, and verify that they agree with the values calculated in the previous exercise. Don’t forget to adjust the voltage of your source to be 5 V, and the resistors to 10 Ω each. Use the voltmeter tool for the voltages, always connecting the black lead of the voltmeter to ground. Use the non-contact ammeter for the current measurements, and observe that the electron-flow animations visually reinforce the measured results. You must also use the contact ammeter for at least one current measurement, and show it to your instructor. Just for fun, try replacing the resistors in circuits #3 and #4 with light bulbs, and turn the source voltages up to 10 V in order to make the bulbs glow more brightly. The current differences should now be readily apparent. #1: V #2: R V #3: R V 3 #4: R R V R R 3. Explain to your TA in detail that in voltage-measurement mode, the multimeter is like an infinite resistance (actually more like 10 MΩ), and therefore has no effect on current in the circuit when attached in parallel to the circuit element to be probed. But if attached in series to the element, the current would be shut down. Also explain that in current-measurement mode, the multimeter is like a wire with zero resistance, which would completely bypass a circuit element if attached to it in parallel; a current meter must be connected in series with the circuit element to be probed, so that the current remains unaffected. 4. Build each of the four circuits shown above one at a time on your breadboard. Use your 5-V DC power supply output as the source, and use 100 Ω for each resistor. For each circuit, use your hand-held digital multimeter to measure the same voltages examined in the previous exercises, and record them on the circuit diagrams above. 5. Use your multimeter to measure the current in circuit #2, treating it just like the contact ammeter from the PhET simulation. CAUTION: the ammeter must be placed in series with the element for which the current is being measured. That means that replace one of the wires with the ammeter. Attach the red multimeter lead to Amp input rather than the Volt input of the meter. Because this measurement can easily DAMAGE the multimeter if not performed correctly, show your setup to your instructor BEFORE turning on the power supply! Aside from the fact that the currents are 10 times lower, describe any differences that you see compared to the previous exercises. 4 Lab 2 Input and Output Impedance Notes for Lab 2: Input and Output Impedance Let’s begin by defining some new terms: Impedance: In electronics, a circuit element that resists or impedes the flow of current is said to have impedance. In the context of DC voltages and currents, impedance and resistance are the same thing. But when we start dealing with AC voltages and currents, there will be a subtle difference. Signal: A signal is any voltage that is being generated, transmitted, or used by an electric circuit (or part of a circuit). A signal can be used to transmit information, power, or both. Thévenin Equivalent Circuits: Any two-terminal network of linear resistances and voltage sources is equivalent to a single ideal voltage source VT in series with a single effective resistance RT . This equivalent circuit is called the Thévenin equivalent circuit. As an example, the big, complicated circuit below on the left is equivalent, at the terminals, to the simple circuit below on the right. RT terminal 1 VT terminal 2 terminal 1 terminal 2 Sometimes all we are told about a network is its Thévenin equivalent circuit. And in many cases, that’s all that we need to know. Notice that a network consisting only of resistors will have a Thévenin equivalent circuit as well with VT = 0. Input and output devices: An output device (also called a source) produces an electric voltage or signal. Examples include electrical wall outlets, power supplies, batteries, mp3 players, and cell-phone chargers. An input device (also called a load) receives an electrical signal from an output device, either to consume power, accept information, make a measurement, or for some other purpose. Examples of input devices include light bulbs, speakers/headphones, motors, multimeters, and oscilloscopes. Signal-modifier devices: A signal-modifier device can be viewed as a combination of an input device and an output device. It receives a signal on one end, modifies it, and 19 20 Notes for Lab 2, Input and Output Impedance produces a new signal at the other end. Amplifiers are great examples of signal-modifier devices. Perhaps the simplest signal-modifier device is the voltage divider, which we’ll talk about soon. Input and output impedance: To a DC output device (source), an simple input device (load) looks like a Thévenin equivalent resistance that we refer to as the input impedance. An ideal input impedance would be infinite, so as not to burden the source by drawing current or energy. To an input device (load), an output device looks like a Thévenin equivalent pure-voltage source and resistance in series; we refer to resistance as the output impedance. The ideal output impedance would be zero, so as not so dissipate energy or cause an internal voltage drop that would reduce the voltage output. Of course, real input impedances are not infinite, and real output impedances are never zero. This lab intends to teach you how to match real impedance and output impedances. If mismatched, the two won’t work well together. Voltage Dividers Recall that in Lab 1, we built a circuit powered at 5 V with two resistors in series and found that the voltage between the two 100 Ω resistors was 2.5 V. We call this a voltage divider; we effectively divided our input voltage by two and measured it. Voltage dividers can be drawn using an alternate form of circuit diagrams like this: Vin Vout R1 R2 The new symbol that you see at the bottom of the diagram represents ground, the point defined as being at zero voltage. This circuit is very similar to circuit #4 in the Lab 1 exercises. Vin was just the voltage of the power source, and Vout was the voltage at the point between the two resistors. Let us assume that all of the current which flows through R1 also flows through R2 (That is, no current is drawn at Vout . If we design our circuits carefully, this assumption is valid). From Ohm’s law, the current is given by I= Vin , R1 + R2 where R1 + R2 is the total resistance between Vin and ground. Vout is the voltage across just R2 and is given by Vout = IR2 . Using the value of the current found above, we obtain R2 Vout = . Vin R1 + R2 With an appropriate choice for resistor values, we can obtain a value for Vout anywhere in the range between 0 and Vin . Notes for Lab 2, Input and Output Impedance 21 Impedance Matching The figure below represents an arbitrary output element connected to an arbitrary input element, both of which are represented by their simple Thévenin equivalent circuits. V0 represents the ideal source voltage of the output device, while Vt represents the terminal voltage that is passed between the output and input device. Here, Rout is the output resistance of the output device, and Rin is the input resistance of the input device. Rout V0 Vt Rin Observe that this circuit is essentially a voltage divider, where voltage Vt is related to V0 according to Vt Rin = . V0 Rout + Rin This tells us what fraction of the ideal source voltage actually made it to the input device (e.g., motor, speaker, oscilloscope). If we don’t want to lose useful voltage inside the output device, then we need to have Rin >> Rout , which sets the value of this fraction close to one. For example, a 100 W light bulb designed for use on a 100 V source has a 1 Ω input resistance and draws 1 A of current. If you try to illuminate such a bulb with a 100 V source that happens to sport a hefty 2 Ω output resistance, the output voltage that actually reaches the light bulb will only be 33 V, and the bulb probably won’t light up at all. This is one of the most important lessons that you will learn in Physics 140! Please reread the preceding paragraphs until you understand what went wrong. What would be a more appropriate output resistance for this scenario? Let’s take a moment (or a single paragraph) to tangentially explore a completely different application. If you have a fixed source voltage and a fixed output resistance, and your goal is to transmit the maximum amount of power possible to the input device, the choice of input resistance is very different from before. Recalling that the power is given by V 2 /R, you can write an expression for the power delivered to Rin as a function of Rout and Rin . Then, setting the derivative with respect to Rin equal to zero to find the maximum, you find that Rin = Rout . If your output device is a power plant, this condition is the relevant one. But if you are just trying to power a load in the lab without overburdening the source (i.e. causing the output voltage to drop too low), then the previous paragraph is the one to pay attention to. 22 Notes for Lab 2, Input and Output Impedance Calculating Equivalent Circuits When the internal details of a complex circuit are known, one can apply straightforward rules to calculate the Thévenin-equivalent circuit. Here is a very simple example that involves the output resistance of a circuit containing 1-Ω and 7-Ω resistors in series. 1Ω 7Ω 8Ω 1V 1V Because the resistors in the circuit below are not in series, the problem is more challenging. A short-cut method for calculating the output resistance is to simply replace all ideal voltage sources with wires and then calculate the resistance across the two output terminals. 1Ω 1V 1Ω 5Ω 5Ω This yields a 1 Ω and a 5 Ω resistor in parallel, so that the output resistance is Rout = 1 1 + 1Ω 5Ω −1 = 5 6 Ω. Alternatively, we can separately calculate the closed-circuit terminal voltage VL across an arbitrary load resistor RL , and the open-circuit terminal voltage VOC in the absence of a load resistor. 1Ω 1V 5Ω 5Ω Without the load resistor, the two internal resistors function as a voltage divider, so that the open circuit (unloaded) voltage is V0 = 5Ω 1V = 1Ω + 5Ω 5 6 V. Notes for Lab 2, Input and Output Impedance 23 When a 5-Ω load resistor is attached, the two parallel 5-Ω resistors are equivalent to a single 5 2 -Ω resistor. The output of the equivalent voltage divider is then VL = 5 2 Ω 1V = 1 Ω + 52 Ω 5 7 V. The ratio of the open and closed-circuit voltages can then be used to determine the equivalent output resistance Rout = V0 − 1 RL = VL 5 6 5 7 ! V − 1 5Ω = V 5 6 Ω, which is the same result obtained above using the short-cut approach. 24 Notes for Lab 2, Input and Output Impedance Measuring Input and Output Resistance When the output resistance and voltage of an output device are not known, they can be determined via the following two-step procedure: 1. Because the Thévenin equivalent voltage V0 is the same as the open-circuit voltage in the absence of a load, measure V0 with a high-quality voltmeter or an oscilloscope. Such a measurement (input) device has a very large input resistance, and draws such a small current that it is usually like not having any load at all. Note: if the output device you are measuring has a very large output resistance, i.e., the output resistance may be comparable to the input resistance of the measuring device, this measurement will be incorrect. Rout V VOC 2. Then use the same measurement device to determine the closed-circuit voltage across a known load resistor RL Rout V RL VOC The voltage divider equation yields RL VL = V0 Rout + RL and Rout = V0 − 1 RL . VL To measure the input resistance (or load resistance) of an unknown input element, only one measurement is required. Connect the load RL to a characterized output device (i.e., one where V0 and Rout are already known), and measure VL . Then solve the equation above for RL . Rout VOC VL RL Name In-Class Exercises for Lab 2: CID Input and Output Impedance 1. For the input and output devices connected in the diagram below, we have V0 = 5 V and Rin = 150 Ω. If want to make sure that most of the source voltage is delivered to the load, what would be an appropriate value of Rout ? Rout Vt V0 Rin 2. To characterize an input device with unknown input resistance RL , you use a calibrated output device with V0 = 5 V and Rout = 1 Ω. When the input and output device are connected, you find that the voltage across the load is VL = 2.5 V. Calculate the value of RL . 3. To characterize an output device with unknown Rout , you use a calibrated input device with RL = 100 Ω. You first make an open-circuit measurement of the output voltage to discover that V0 = 10 V. Then, with the input and output device connected, you find that the voltage across the load is VL = 1 V. Calculate the value of Rout . 4. We want to get the most light possible out of a light bulb and four 1.5 V batteries that each have 1 Ω of internal resistance. If the bulb has a resistance of 8 Ω, which battery configuration, series or parallel, will result in the most current, and therefore, the most light? Recall that light output is roughly proportional to the power dissipated. (a) If the three batteries are connected in series, what output voltage will actually reach the bulb, and what current will flow through the bulb? Hint: Draw the Thévenin equivalent circuit. (b) If the three batteries are connected in parallel, what output voltage will actually reach the bulb, and what current will flow through the bulb? Hint: Draw the Thévenin equivalent circuit. 25 Lab 2 Exercises: Input and Output Impedance 1. Design and construct a voltage divider using Vin = 5 V from the power supply. The output voltage should be 1.0 ± 0.1 V. Use only two resistors, one of which should be at least 1 k. 2 2. Construct the following voltage divider. Use the 15-V output from the DC power supply. Measure Vout with a multimeter in the absence of a load and compare it to the value that you calculate using the voltage divider equation. 15 V 10 k Vout 4.7 k Calculate the Thévenin equivalent output voltage and resistance of this output device, and use these values to calculate the value of Vout when a 33 kΩ load resistor is added to the circuit. Then add the load resistor to your physical circuit and measure the value of Vout to see how it compares to your calculation. 2 3. Use the voltmeter and the resistor board to measure the output resistance, Rout , of one of the following voltage sources: (a) D-cell, (b) 9-volt battery, or (c) solar cell. If you choose the solar cell, make sure it is under constant illumination. We will compile these measurements on the board in the lab so we can compare the different sources. 3 4. Use the potentiometer (“pot”) in your lab kit. It has three wires connected to it. Your TAs will instruct you on how to connect it. If connected incorrectly, it is very easy to break. Determine with an ohmmeter which of the three wires is connected to the “wiper”. (a) Construct the following voltage divider using this pot. 15 V 10 k Vout (wiper) View the output on the voltmeter, which should vary continuously from 0 to 15 V as you turn the knob. (b) Now design a circuit using the 10-k pot so that the output varies between −1 V and +1 V when you turn the knob of the pot from one extreme to the other. You will need to use both the +15 V and −15 V power supplies, and you will need to use some resistors besides the pot. Additional exercises on the next page 27 3 Exercises for Lab 2, Input and Output Impedance 29 5. Optional: At your lab station, there should be a variable lab power supply and a set of Christmas light bulbs. The power supply has two knobs, a current limit and a voltage limit. If the power supply is not attached to anything, it will output the set voltage and no current. If a load resistor is attached to the power supply, then it will continue to output that same voltage as long as the current is less than the current limit (constant voltage mode). If the load resistance is low enough that the current would exceed the current limit, then the output voltage drops until the current is equal to the current limit (constant current mode). Set the variable lab power supply voltage to 8 V and the current limit to 0.2 A. Don’t trust the meters! To set the maximum voltage, disconnect everything from the power supply, connect a voltmeter, and adjust the voltage limit knob until the reading gives 8 V. To set the maximum current, turn the current limit knob down to 0, connect an ammeter on the 10-A scale across the output of the power supply, and adjust the current limit knob until the current reads 0.2 A. We use the 10-A input of the ammeter for two reasons. First, it has a smaller input resistance than the milliamp input. Second, some of the meters we use have a 200 mA fuse on the milliamp input and setting the current to the specified value will result in blowing the fuse. The key to these methods are the very high and low resistances of the voltmeters and ammeters respectively. Make sure you understand what you just did and why it works. Measure the current and voltage output of the power supply when 1, 2, 3, 4, and 8 bulbs in series are connected to it. Use one multimeter to measure the voltage and a second multimeter to measure the current (remember that the ammeter must be in series with the bulbs). Plot the measured power supply current versus voltage in the space below. Explain to the TA what the plot means. 10 voltage (V) 8 6 4 2 0 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 current (A) How many bulbs should be connected in series to the power supply to draw the most power from the supply? How much is the power in this case? Lab 3 AC Measurements Notes for Lab 3: AC Measurements Up to this point, we’ve only dealt with constant, steady voltage sources like batteries or power supplies. However, you probably know already that it’s common for signals to vary with time for various reasons. Examples of this include mains current, the electricity delivered to your home and accessed through wall plugs; digital signals such as those used in computers and other digital devices; and analog signals like audio or old video signals. Generally, we refer to any of these non-constant voltage signals as “AC” signals. As you may know, AC stands for alternating current. In the case of mains current, this is because the voltage changes sinusoidally (like a sine wave). Since the voltage periodically changes sign, the current sometimes flows from the “live” lead to ground (also known as the “neutral” lead), and sometimes in the opposite direction—hence the “alternating current.” This allows for the use of electrical transformers that can convert electricity to very high voltages (for long-distance power transmission) or to lower voltages (this is how you can charge a phone, which requires 5 V, with a charger plugged into a 120 VAC outlet). However, sometimes there is no neutral lead, and both leads have voltages that oscillate 180◦ out of phase (that is, they are opposites). In addition, other signals can be all positive—oscillating between 0 V and some peak voltage, like most digital signals. These are still referred to as AC signals in the context of this lab, but that’s not universal. Properties of Sinusoidal Signals The essential characteristics of any sinusoidal signal are its frequency (or period), and amplitude. When dealing with multiple sine waves with the same frequencies, we also are interested in their relative phase—whether one wave precedes or lags behind another. You’ll see this in the next lab. An AC signal can also have a nonzero DC offset, which means that the signal is more positive than negative, or vise versa. Frequency and Period: Frequency, f , which is also known as cyclic frequency, is the number of times that a wave is repeated in a second. A wave that goes through a full positive and negative cycle 1,000 times each second is said to have a frequency of 1 kHz. “Hz” is the abbreviation of Hertz, named after Heinrich Rudolf Hertz, who built the first radio transmitter, thus proving the existence of electromagnetic waves and confirming Maxwell’s equations. Ironically, his opinion of the non-scientific applications of his discovery was, “It’s of no use whatevsoever.” While the frequency characterizes a wave’s cycles per second, the period, T , relates the actual duration (in seconds) of each cycle. They are inversely related: f = T1 . In the following lab, we will also discuss and use the angular frequency: ω = 2πf . The AC electric power distributed in the United States has a cyclic frequency of 60 Hz. Other parts of the world use 50 Hz. Typical electrical signals for consumer level audio have a maximum frequency of about 22 kHz. Signals for sending and receiving radio waves can have a wide range of frequencies. Familiar examples include the AM radio band (1610 kHz 33 34 Notes for Lab 3, AC Measurements to 1700 kHz), the FM radio band (87.9 MHz to 107 MHz), cellular frequencies (various bands between 700 MHz and 2690 MHz), and WiFi (2.4 GHz and 5 GHz). Voltage: There are several non-equivalent but useful ways to indicate the voltage amplitude of an AC signal, including the peak voltage (also called amplitude), Vpeak , which is the maximum deviation from the center of the wave; the peak-to-peak voltage, Vpp = 2Vpeak ; and the root-mean-squared (RMS) voltage, VRMS . These three quantities are illustrated in the diagram below. V V rms Vpeak Vpp t It’s worth nothing that the peak-to-peak voltage isn’t a physical voltage that could be measured between V and ground; it is a voltage “difference” that only exists in time. However, there are circuits that can take advantage of this and “double” the voltage. We will build something close to this in Lab 5 (Diodes and Rectification). The RMS voltage is the square-root of the average of the voltage squared, which is a measure of the average deviation from the center of the wave; but it is not strictly the average voltage, which would be zero for a wave centered at zero. Like all function averages, the RMS voltage is computed as an integral: s Z 1 T VRMS = V (t)2 dt . T 0 √ For a sinuoidal signal, this expression reduces to VRMS = Vpeak / 2 ≈ 0.7Vpeak . When we say that the voltage of a common wall outlet is 120 VAC, we mean that VRMS = 120 AC Volts, and we almost never mention that the peak voltage is about 170 V. Note that Vpeak and Vpp are independent of the DC offset, or mean, of the signal. That is, a signal oscillating between −5 V and +5 V has the same Vpeak and Vpp as a signal that oscillates between 0 V and +10 V. This is not true of the RMS voltage, but we don’t usually calculate that for a sine wave with a DC offset, so the previous derivation is OK for sinusoidal signals with a mean of 0 V. Power: In Lab 1 (Voltage and Current), we learned that the power dissipated by a resistor is calculated as P = V 2 /R. But for an AC voltage, which varies with time, the power also varies with time. In most cases, any reference to the power dissipated by a resistive load in an AC circuit is actually a reference to the average power, which is calculated as Pavg = 1 T Z T P (t)dt = 0 1 1 RT Z T 0 V 2 dt = 2 2 VRMS 1 Vpeak = . R 2 R Notes for Lab 3, AC Measurements 35 The convenience of this relationship between Pavg and VRMS is one of the main reasons that we use the RMS voltage when referring to an AC voltage becuase we can use the same formula for calculating power dissipated as we do for DC voltages. However, this is only valid when we can use Ohm’s law to change P = IV to P = V 2 /R for any instant in time. However, as we’ll see in the next section, there is sometimes a phase difference between the voltage and the current, which affects how much power is actually delivered. In general, the average power consumed by a circuit with a phase delay like this can be calculated using a more general formula: Z 1 T V2 Pavg = P (t)dt = RMS cos φ . T 0 R Other Types of Signals Aside from sinusoidal signals, there are other common periodic signals used in electronics. Square waves oscillate between their high and low voltage extremes almost instantaneously and are used in digital circuitry, as we’ll see in Lab 10 (Digital Gates). Triangle waves look almost like sine waves, but the voltage rises and falls with a constant slope. They are used in generating and measuring AC signals. Sawtooth waves have voltages that rise with a constant slope and then drop very quickly to their minumum value and rise again. They are mostly used in the implementation of old CRT televisions and oscilloscopes, but they can also be used to measure signals or in the creation or amplification of other signals. All of these waveforms are also used in electronic music, and they have very distinct sounds. Square waves also have an additional important parameter: duty cycle. A square wave’s duty cycle is the percentage of time that the voltage is at the maximum (or high) value. A symmetric square wave has a duty cycle of 50%, while a square wave with a duty cycle of 0% or 100% would just be a DC voltage. Duty cycle can be varied continuously, allowing digital circuits to make signals with different average voltages. This is called Pulse-width modulation. It is used in power conversion (all modern device chargers work this way), changing the average power going to lights or motors, and rough digital-to-analog conversion. Another important property of electric signals that has been mentioned but not clearly defined is DC offset, also known as DC bias. The DC offset of a signal is its mean voltage, and can be thought of as the signal’s baseline, or voltage about which the signal oscillates. For example, a signal that oscillates between −5 V and +5 V has zero DC offset, while a signal that oscillates between 0 V and +10 V has a DC offset of +5 V. It’s the same AC signal, but “shifted up.” These signals are often considered to be the superposition of an AC signal and a DC voltage—hence the term. In some cases where the DC offset of a signal is such that the voltage is always positive, it can be regarded as a DC signal that changes in time. This is especially the case for digital signals, since they oscillate between 0 V and some positive voltage, but their current never changes direction. Equipment In this lab, we’ll be using a few new pieces of equipment. A function generator (also called a signal generator) is a bench-top AC voltage source that allows the output amplitude and frequency to be adjusted. It usually also has the ability to generate different waveforms (sine wave, square wave, triangle wave, etc.) and to add a DC offset. An oscilloscope is 36 Notes for Lab 3, AC Measurements a powerful tool for measuring AC voltage signals over a very wide range of frequencies. It allows you to actually “see” the voltage in the signal as a function of time. You will learn more about the capabilities of an oscilloscope by reading the “Introduction to the Oscilloscope” section in Appendix I of this manual. Name In-Class Exercises for Lab 3: CID AC Measurements 1. Given a sinusoidal 1 kHz signal that oscillates between −5 V and +15 V, what are the peak-to-peak voltage, the RMS voltage, the amplitude, and the DC offset of the signal? Voltage (V) 2. Let a 5 V peak-to-peak signal with a frequency of 1 kHz and no DC offset be the input to a voltage divider constructed from two 1 kΩ resistors. Sketch two periods of the input and expected output signals on the same graph, being careful to get the relative amplitudes right. 3 2 1 0 -1 -2 -3 0 0.5 1.0 Time (ms) 1.5 2.0 3. A signal generator is set up to generate a 1 V peak-to-peak sine wave. A 4 Ω speaker is connected to the 50 Ω output of the signal generator. What peak-to-peak voltage is actually applied to the speaker? How much power is dissipated by the speaker? 37 Lab 3 Exercises: AC Measurements 1. Read the “Introduction to the Oscilloscope” section in Appendix I in this lab manual. You should experiment with adjusting the knobs and choosing menu options so you understand what each one does. You should have the output of the signal generator connected to channel 1 to provide an input signal as you go through the exercises. After you have gone through the “Introduction to the Oscilloscope” complete the following exercises. (a) Connect the high-level output (HI) of the signal generator to the channel 1 input of the oscilloscope. Take care that grounds on both instruments are connected together (if you’re using a BNC cable, this is done for you, but it’s something that you should be aware of). Look at the three types of waveforms (square, triangle, and sine). (b) Demonstrate that you know how to set and interpret the horizontal (time) and vertical (amplitude) scales as well as the vertical offset knob. (c) Set the frequency of the signal generator to 1 kHz and the peak-to-peak amplitude to 5 V. Measure the amplitude and period with the oscilloscope, which is far more accurate than the dials on the signal generator. Quantify any frequency error that you observe. (d) Turn on the DC offset switch on the signal generator and check the effect of the offset knob with oscilloscope channel 1. Select “DC” input coupling from the Channel 1 menu, observe the behavior of varying the DC offset, then select “AC” coupling and observe the signal. Explain what you see. (e) Use this sine wave as input to a voltage divider constructed on your breadboard from two 10 kΩ resistors. Simultaneously display the input and output of the voltage divider on the oscilloscope using the channel 1 and channel 2 inputs. Is the output as you would expect? 7 2. Use the function generator to obtain a 1 kHz sine wave with 5 V peak-to-peak amplitude. Connect a 470 Ω resistor between its output and ground. What has happened to the output of the function generator? Why? Use this information to calculate the output resistance of the function generator. 3 39 Lab 4 RC Circuits and Filters Notes for Lab 4: RC Circuits and Filters Capacitors were briefly introduced in Lab 3 (AC Measurements). In this lab we will look more closely at how a capacitor behaves in a circuit. Much of the time a capacitor will be used in conjunction with a resistor, creating what is known as an “RC Circuit.” Whenever a current, I, flows into one lead of a capacitor, the same amount of current flows out of the other lead. Thus, for the purpose of understanding circuits, we can consider the current to flow through the capacitor, into one lead and out of the other. The main difference is how the voltage across the capacitor changes as the current flows through it. For a resistor the voltage is always just V = IR. But for a capacitor the voltage will change as charge is deposited in or removed from the capacitor by the flow of current. You should recall the equation dV I=C dt from Lab 3. Just as with resistors, we can replace combinations of capacitors with an equivalent capacitor. But the combination rules are different. Two capacitors in series are equivalent to a single capacitor: = C1 C2 1 1 1 = + C C1 C2 Similarly, two capacitors in parallel are also equivalent to a single capacitor: C1 = C = C1 + C2 C2 The circuit below contains both a resistor and a capacitor in series. We will treat the voltage coming from the left as an input, and the voltage going out to the right as an output. Vin Vout R C 43 44 Notes for Lab 4, RC Circuits and Filters If we assume that all of the current which flows through R must also flow through C, then we can write Vin − Vout dVout =C . R dt The expression on the left-hand side of the equation is the current through R (the voltage across the resistor is the difference of the voltages at the two ends), and the expression on the right-hand side is the current through C. This is a differential equation for Vout . Let us look at solutions of this equation for various limiting cases. First, suppose that Vin is equal to a constant and we wait a long enough time so that Vout is also constant. Then dVout /dt = 0, and, from the above equation, Vout = Vin . No current flows through R, so there is no voltage drop across R, and the capacitor is simply storing a charge Q = CVout . Now suppose that we suddenly change Vin . The voltage across C cannot suddenly change. That would require an infinite amount of current through R which would require either an infinite voltage at Vin or R = 0. Instead the current is limited by the finite voltage difference across R, resulting is a finite rate of change in Vout (the voltage across C). We can see from the above differential equation that as Vout approaches the new value of Vin , the difference in voltage across R decreases, the current through R decreases, and the rate at which Vout approaches its final value decreases. In fact, Vout approaches its final value exponentially. If we solve the above differential equation for this situation, we obtain Vout = Vin(final) + (Vin(initial) − Vin(final) )e−t/RC , where the values of Vin before and after the sudden change at t = 0 are given by Vin(initial) and Vin(final) , respectively. The product RC is called the “time constant” of the exponential decay. Below we sketch the waveforms of Vin and Vout . Vin Vout t t If Vin is a square wave, then the capacitor simply rounds off each of the sharp corners, as shown in the sketch below: Vout Vin t t Notes for Lab 4, RC Circuits and Filters 45 The time constant, RC, can be determined from any of these exponential Vout decay curves. Just remember that an exponential decays by a factor 1/e during one time constant RC, as illustrated below: −t/RC e V V/e RC The curved lines are exponentials of the form e−t/RC . When the time changes by one time constant (i.e., t = RC), the exponential drops to 1/e (0.368) of its original value, as shown in the above figure. Instead of an abrupt change of voltage, we will now consider a smooth sine-wave input V = V0 sin(ωt) (recall that ω = 2πf where f is the frequency of the signal in Hz). Because this is a more difficult case to analyze, we will start with only a capacitor C (no resistor). The current through C is given by I=C dV = ωCV0 cos(ωt) = I0 cos(ωt) . dt We note here that (1) the current is 90◦ out of phase with the voltage, and (2) the amplitude of the current I0 = ωCV0 is proportional to the amplitude of the voltage V0 . This is Ohm’s law for a capacitor: V0 = I0 Z , where Z is called the impedance and is given by Z= 1 . ωC The impedance of a capacitor is measured in units of Ohms (Ω) and depends on the frequency of the sinusoidal voltage across it: large for low frequencies and small for high frequencies. Despite the fact that impedance has units of Ohms, like a resistor, a capacitor cannot dissipate power. Power is computed as P = IV . But for a capacitor, the current and voltage are 90◦ out of phase, so that the power averages to zero. Now let us return to the circuit we have been considering: Vin Vout R C 46 Notes for Lab 4, RC Circuits and Filters If we view the capacitor to be like a resistor, except that the impedance depends on the frequency, then this circuit looks very much like a voltage divider. But now Vout depends on the frequency. At low frequencies, where the impedance of C is much greater than R, we have Vout ≈ Vin . At high frequencies, where the impedance of C is much less than R, we have Vout Vin . This circuit allows signals with low frequencies to pass through, but blocks signals with high frequencies. We call this a low-pass filter. Of course, a capacitor does not behave exactly like a resistor. Its current is 90◦ out of phase with its voltage. (A resistor’s current and voltage are in phase with each other.) Thus, the above circuit only approximately behaves like a true voltage divider. The correct expression for Vout in the case of the above circuit is given by 1 Vout = p Vin . (ωRC)2 + 1 Below, we display this expression graphically: 1 0.7 Vout/Vin 0 0.01 0.1 1 ωRC 10 100 Note that when the angular frequency ω is equal to 1/RC, we have Vout /Vin = This is called the cutoff frequency: ωcutoff = p 1/2 ≈ 0.7. 1 . RC Now consider a similar circuit: Vin Vout C R This circuit also looks much like a voltage divider. At low frequencies, where the impedance of C is much greater than R, we have Vout Vin . At high frequencies, where the impedance of C is much less than R, we have Vout ≈ Vin . This circuit allows signals with high frequencies Notes for Lab 4, RC Circuits and Filters 47 to pass through, but blocks signals with low frequencies. We call this a high-pass filter. The correct expression for Vout in the case of this circuit is given by ωRC Vout = p Vin . (ωRC)2 + 1 Below, we display this expression graphically: 1 0.7 Vout/Vin 0 0.01 0.1 1 ωRC 10 100 Observe that for the same R p and C values, the low and high-pass filters have the same cutoff frequencies (Vout /Vin = 1/2), but opposite trends. Name In-Class Exercises for Lab 4: CID RC Circuits and Filters 1. What resistance in series with a 100 µF capacitor will yield a 1 second time constant? 2. Suppose that we send a 10 V peak-to-peak 250 Hz square wave with zero offset into the input of the circuit below. Calculate the RC time constant and use the expression for exponential decay to determine the expected maximum peak-to-peak voltage at the output. Sketch several periods of the input signal together with the expected output signal on the same graph, taking care to get the relative amplitudes right. Vin Vout 1 kΩ 1 µF 3. You have an audio amplifier, and you wish to amplify signals with frequencies of 2000 Hz or greater. Unfortunately, there is a lot of unwanted 60-Hz noise on your microphone input. Design a filter circuit that will attenuate the 60-Hz pickup without affecting the desired frequencies too much. Note that filter circuits usually use capacitors of less than about 1 µF and resistors of at least a few kΩ. (a) Draw your circuit and label the values of all components. (b) Determine the ratio Vout /Vin for both 60 Hz and 2000 Hz for your design. (c) How would you modify this circuit to achieve a low-pass filter with the same cutoff frequency? 49 Lab 4 Exercises: RC Circuits and Filters 1. Design and construct a low pass filter for which Vout /Vin = 0.7 at 100 ± 20 Hz. (Since the output resistance of the signal generator is about 500 Ω, you should use R ≥ 10 kΩ.) It is best to choose the capacitor first and then adjust the resistors to give the desired frequency, since you have a lot more options available with resistors than with capacitors. Again, display your input and output simultaneously on the oscilloscope. Measure the frequency at which Vout /Vin = 0.7 by measuring the period on the oscilloscope. 3 2. Design and construct a high pass filter for which Vout /Vin = 0.7 at 10 ± 2 kHz. Use a 0.001-µF capacitor. 2 3. The object of this exercise is to practice setting up the oscilloscope to observe a signal and to measure some of the characteristics of that signal. The signal we are going to use is a square wave that is modified by passing it through the following RC circuit: Vin Vout 10 k 0.01 µF The combination of a resistor and a capacitor in this manner will modify the input square wave because the voltage on the capacitor cannot change immediately. In fact, the output voltage, Vout , will undergo an exponential decay from the previous value to the new value according to the equation on page 44 of the lab notes. (a) Feed a 500-Hz square wave from the signal generator into the circuit above (amplitude does not matter). Simultaneously view both the input and the output on the oscilloscope. (b) In the Trigger menu set the trigger type to Edge and the source to whichever channel is connected to the output of the above circuit. Set the trigger mode to Auto. Now adjust the trigger level control up and down. Pay particular attention to what happens when the trigger level is set too high or too low. Now alternate the trigger Slope between positive and negative and note how it changes the oscilloscope display. (c) Now set the trigger mode to Norm (normal). Adjust the trigger level control up and down, noting what happens when the trigger level is set too high or too low. Explain to your TA what is happening in parts (b) and (c). Additional exercises on the next page 51 Exercises for Lab 4, RC Circuits and Filters 53 (d) Do the same thing as in parts (b) and (c) with the trigger source set to whichever channel is connected to the input of the above circuit. Explain why things are different. (e) In order to obtain the most accurate measurements of time and voltage, you should expand a single RC decay signal so that it fills the screen as much as possible, both horizontally and vertically. (f) Now on to business. Measure the RC time constant from the exponential decay that you observe on the oscilloscope. Also use your multimeter to independently measure R and C and calculate the time constant (the components must be removed from the circuit before attempting to measure their values). Record the calculated and measured time constants in the margin of your notebook. 3 4. Use the signal generator to obtain a 1-kHz square wave. Connect a 100 kΩ resistor from the output of the signal generator to the input of the oscilloscope and view the result. (Connect the ground of the signal generator directly to the ground of the oscilloscope.) You should see exponential decay at the edges of the square wave, similar to what you saw in the previous exercise. This is evidence of capacitance to ground. Use the oscilloscope display to determine the amount of capacitance. Part of that capacitance is due to the input capacitance of the oscilloscope (13 pF, printed on the oscilloscope near the input connector), and part of it is due to capacitance between the inner wire and the outer grounded shield of the coaxial cable. How much capacitance is in the cable? 2 5. Optional: The circuit below is a notch filter. It greatly attenuates signals with frequencies near f = 1/(2πRC). Construct this circuit using R = 10 k and C = 0.1 µF. You can obtain R/2 by putting two 10 k resistors in parallel and 2C by putting two 0.1µF capacitors in parallel. Test this circuit. Does the “notch” occur at the frequency you calculate using the known values of R and C? R R 2C Vin Vout C C R/2 Additional exercises on the next page Exercises for Lab 4, RC Circuits and Filters 55 6. Optional: Capacitors always have some internal resistance between the two leads. If you charge up the capacitor and then disconnect the power supply, the capacitor will discharge itself through its own internal resistance R with a time constant RC. If you measure the time constant of the discharge, you can use the known value of C to measure R. Try this with a 100 µF capacitor. Note that this capacitor has polarity and must be charged up with the positive voltage applied to the end marked with a plus sign. Charge the capacitor to 15 V. Remove the power supply leads and let the capacitor sit undisturbed for about a minute. Then measure its voltage with the digital voltmeter. The voltage decays exponentially with time: V = V0 e−t/RC , where V0 is the initial voltage (15 V). From the measured values of V and t, calculate R. Be careful not to touch the leads of the capacitor while it is discharging. Your body also has resistance and can cause an extra discharge of the capacitor, resulting in false data. Lab 5 Diodes and Rectification Notes for Lab 5: Diodes and Rectification A diode is a two-lead device which allows current to flow in only one direction. Below is its symbol: V1 V2 When V1 < V2 , the diode has infinite resistance and allows no current to flow. When V1 > V2 , the diode has very small resistance and current flows freely in the direction of the arrow in the symbol: from V1 to V2 . The diode actually requires a small amount of voltage (usually about 0.6 V) to be turned on. Thus, when current is flowing from V1 to V2 , there will be about 0.6 V across the diode. This voltage drop increases slightly as the current through the diode is increased. We will ignore this voltage drop in the following discussion, but we must keep in mind that it is present and will affect the actual performance of the circuits. A light-emitting diode (LED) gives off light when current is flowing through it. In the following circuit, the diode will light up when Vin > 0. (You may see either of the two symbols to indicate an LED.) Vin Vin LED Like other diodes, the LED requires a certain amount of voltage to turn it on. For the LED, this minimum voltage is usually about 1.5 V. The LED lights up quite brightly if we put about 20 mA through it. However, even 2 mA is sufficient to produce a visible amount of light. The resistor in the above circuit controls how much current flows through the LED. Quite often the resistor and the LED are contained in the same package and are referred to as an RLED. The LEDs in your kit may have resistors built into their package. It is hard to tell if your LED does have an integral resistor. It is usually best to use a 150-Ω (or larger but not too large) resistor in series with the LED if you are going to connect it to 5 V unless the exercises instruct you otherwise. The following circuit is called a half-wave rectifier, and is like a voltage divider. When Vin > 0, the diode is turned on and behaves like a small resistor, resulting in Vout ≈ Vin . When Vin < 0, the diode is turned off and has infinite resistance, resulting in Vout = 0. We show the resulting waveform when the input is a sine wave. Vin Vout 59 60 Notes for Lab 5, Diodes and Rectification Vin Vout t t The objective of this lab is to use diode rectification to convert an AC voltage source into a DC power supply capable of delivering 100 mA of current. Whereas your signal generator has too large of an output impedance (600 Ω) for such a large current, we will instead employ a transformer that converts 110 Vrms ac wall power into a smaller (Vrms ≈ 15 V) AC signal. A transformer consists of two coils of wire wound around opposite sides of a solid ring of magnetic material (e.g., iron), and is represented by the symbol below. Through a phenomenon called electromagnetic inductance, which we will not explain in detail here, an AC voltage, Vp , in the primary (input) coil creates an AC voltage, Vs , in the secondary (output) coil. The number of coil windings on the primary (Np ) and secondary (Ns ) sides then dictate the transformer voltage and current ratios according to the transformer equation: Vs Ns Ip = = . Vp Np Is This equation assumes that the power delivered on the primary side is all transferred to the secondary side, based on the realistic assumption that most transformers are nearly 100% efficient. A simple rearrangement of the equation yields Ps = Is V s = Ip V p = Pp . There are actually three wires in a modern wall socket. The two “slots” are the “hot” and “neutral” wires, while the round hole is the safety ground, which is connected to a rod that has been driven down into the dirt below the building – hence the name ”ground”). The neutral wire is also connected to ground at some nearby location, usually at the main electrical service entrance. But unlike the safety ground, the neutral wire is intended to carry the return current that flows out from the hot wire. One should never purposely cause current to flow through the ground wire. A safe high-power circuit will be enclosed in a grounded metal case, so that if the hot wire accidentally makes contact with the case, the current can safely travel through the ground wire and thereby cause a fuse to blow or a circuit breaker to trip, rather than flowing through you. Any time power is brought from a wall socket into an important circuit, a fuse should be inserted into the hot wire in series with the circuit in order to limit the amount of current Notes for Lab 5, Diodes and Rectification 61 and power that can be dumped into it in the not entirely unlikely event of a short circuit. The wall socket itself is often fused at 20 A. But this still allows over 2000 W of power dissipation at 110 VAC, enough power to melt components and even start a fire. Thus, we will use a much smaller fuse in order to further limit the maximum current allowed to pass through our power supply. Remember that it is much easier to replace a burnt-out fuse than to replace an entire circuit. We first determine the current requirements of the load, which lies on the secondary side of the transformer, and then use the transformer equation to compute the corresponding primary current that dictates the size of the fuse located on the primary side. Building a DC Power Supply There are a variety of ways to rectify the AC output of a transformer. Shown below is a simple half-wave diode rectifier. Vout 110 VAC Vout RL t If the secondary coil of the transformer has a “center tap” (a connection to the center of the secondary coil), we can construct a full-wave rectifier as shown below. Note that the secondary coil has no direct connection to the primary coil. We can ground the secondary coil anywhere we want. When we ground the center tap, we obtain two sine waves from the two ends of the secondary coil, 180◦ out of phase with each other and each with half the amplitude of the sine wave from the secondary coil in the previous circuit where one end of the coil was grounded. When the voltage on the top of the secondary coil is positive, the top diode conducts. When the voltage on the bottom of the secondary coil is positive, the bottom diode conducts. This circuit is actually two half-wave rectifiers connected together. Vout 110 VAC Vout RL t The most efficient way to rectify voltage from the secondary coil is shown below. Here, neither end of the transformer is grounded. When the top of the secondary coil is positive with respect to the bottom, diodes 1 and 3 are turned on. The load is connected to the top of the coil, and ground is connected to the bottom. When the bottom of the coil is positive with respect to the top, diodes 2 and 4 are turned on. The load is connected to the bottom 62 Notes for Lab 5, Diodes and Rectification of the coil, and ground is connected to the top. This results in full-wave rectification with twice the voltage obtained in the previous case. The four diodes in the above circuit are call a “diode bridge”. Diode bridges for power supplies are available in a single package with four leads. V 110 VAC out 4 1 3 2 Vout RL t Now let us connect a capacitor between the output of the above circuit and ground, as shown below. 110 VAC Vout 4 1 3 2 Vout C RL t Each time the rectified voltage reaches its peak, the capacitor is charged up. In between peaks, the capacitor discharges through the load. This results in a DC voltage with some “ripple” on it. The time constant of the capacitor discharge is RL C, so the amplitude of the ripple can be reduced by using a larger capacitor. The last stage of the power supply is the voltage regulator. This is a miniature integrated circuit (IC) which contains some zener diodes, resistors, and transistors. For example, the 78L05 is a 5-volt regulator. It has three leads: input, output, and ground. If we put any voltage between 7 and 30 V on the input, we get 5 V from the output. In the power supply, we connect the input of the regulator to the unregulated voltage with ripple on it, and we connect the output to the load, as shown below. We now have a regulated power-supply. 110 VAC Voltage Regulator 4 1 3 2 IN Vout OUT GND RL The 78L05 has self-protection built into it. If it gets too hot, it automatically turns itself off. Similarly, if we try to draw too much current from the output, it also turns itself off. The 78L05 will provide up to 100 mA. Name In-Class Exercises for Lab 5: CID Diodes and Rectification 1. For the diode circuit below, Vin = (2 V) sin(ωt). Sketch Vout as a function of t. You may ignore the diode’s threshold voltage. Vin Vout 2. The circuit below shows a configuration of diodes called a diode bridge. Consider the path of current through the bridge circuit when point A is at a higher voltage than point B. Draw arrows in the direction that current flows through the diodes and label them with a “1”. Now consider what happens when point B is at a higher voltage than point A. Label these currents with a “2”. What is the sign of the voltage Vout in both of these cases? Draw a qualitative sketch of the output voltage as a function of t if the voltage on the output of the transformer is as shown (VAB = VB − VA ). A 110 VAC Vout B RL VAB t Additional exercises on the next page 63 In-Class Exercises for Lab 5, Diodes and Rectification 65 3. Make an estimate (an upper bound, actually) for the amount of ripple on a 100 µF capacitor in a power supply that has 10 mA of current drawn from it. Remember that 1 the time between peaks is 120 second. Lab 5 Exercises: Diodes and Rectification 1. At your lab station you have a transformer with three outputs. The two red terminals are connected to each end of the secondary coil of the internal transformer. The one black terminal is connected to the center tap of the internal transformer. Plug in your lab transformer and turn it on. Use your oscilloscope to view the voltage amplitude (not peak-to-peak voltage) of either one of the red outputs relative to the center tap and record it here in your lab manual. Then measure the voltage amplitude of the signal between the two red outputs and record it (this should be twice the value obtained from the center-tapped configuration; be sure you understand why that is the case). 1 2. (a) Using your transformer, construct the half-wave rectifier shown below. View the voltage between the two red outputs of the transformer on channel 1 of the oscilloscope, while simultaneously viewing the rectifier output relative to ground on channel 2. Graph these signals in your lab manual, and indicate the amplitude of each signal. Vout 110 VAC 1 kΩ (b) Using your transformer, construct the full-wave rectifier shown below. View the input voltage (the voltage across the secondary of the transformer) and the output voltage with the oscilloscope after reading the entire caution below. Graph these signals in your lab manual and indicate the amplitude of each signal. How do the results compare to those of the half-wave rectifier? Vout 110 VAC 1 kΩ 3 CAUTION: You must be careful how you make this measurement. If you simultaneously connect one channel of the scope to the output of the transformer (a red clip lead on one of the red transformer terminal and a black clip lead on the other of the red transformer terminal) and the second channel of the scope to the output of the diode bridge (a red clip lead on Vout and a black clip lead on ground), you will NOT get what you expect. The reason is that the two black leads on the scope cables are connected together (and to ground) at the scope. Caution is continued on the next page... Additional exercises on the next page 67 Exercises for Lab 5, Diodes and Rectification 69 This means that you will have connected a wire between the center tap (since it is grounded) and one end of the transformer windings, shorting out one half of the transformer. You can, however, use the advanced features of the scope to view both signals simultaneously. Turn on channel 1 of the scope and attach the leads to the output of the transformer. Adjust the trigger level to be at about 2 to 3 V (be sure it is set to a positive value). Adjust the vertical and horizontal scales to get a good picture of the transformer output – get at least one complete cycle on the screen. Now press the Ref button to save that trace as a reference by pressing the “Save” button (be sure the source is set to channel 1). Now remove the leads from the transformer output and attach them to the output of the rectifier circuit (Vout to ground). You will be able to simultaneously view the transformer signal that was saved as a reference with the output of the rectifier. 3. (a) A full-wave rectifier can also be constructed using the W04G diode bridge (or other equivalent component), which actually contains four diodes connected in the bridge configuration (see p. 62 in the lab notes). Study the pin diagram of your chip, and then construct the circuit shown below. Do not connect the center-tap of the transformer output to anything! Graph the transformer output voltage and Vout on the accompanying graph. Be sure that you get the relative amplitudes correct. 110 VAC W04G ~ + - ~ Vout 10 k How do these results compare to the half-wave and full-wave rectifiers in the previous exercise? NOTE: You will need to use the same technique as in the previous exercise to simultaneously view the input and output voltages on the diode bridge circuit. If you try to connect the scope to both the input and output simultaneously you will effectively connect a wire across either diode 3 or diode 4 (see the diagram on p. 62) depending on how you attach the scope leads. You will probably want to turn off the reference waveform before proceeding to the next exercise. Additional exercises on the next page Exercises for Lab 5, Diodes and Rectification 71 (b) Filter the output by connecting a 1 µF capacitor between Vout and ground. Be aware that the 1 µF capacitor has polarity – connect the “minus” side as indicated by the symbols on the case to ground. Repeat for 10 µF and 100 µF and explain what happens to the peak-to-peak magnitude of the “ripple” as the capacitance increases. You can magnify the ripple on the oscilloscope by switching the coupling on the scope channel to “AC”. 3 4. Construct the circuit shown below. The 78L05 is a positive output 5-volt regulator. The identification of the pins on the 78L05 are shown on the pinouts sheet in your packet. The 0.01 µF capacitor on the output of the voltage regulator is required for stability. 110 VAC W04G ~ + - ~ 78L05 100 µF IN Vout OUT GND 0.01 µF You now have a complete power supply. Measure Vout with the digital voltmeter. How accurate is the 5-volt regulator? Connect a 1-k load resistor between Vout and ground. Does this affect Vout ? Replace the 1-k resistor with 50 Ω. (You can obtain 50 Ω by putting two 100-Ω resistors in parallel.) Calculate the current through the 50-Ω resistor and explain what causes the output to droop under such a heavy load. Simultaneously view Vout and the voltage on the 100 µF capacitor on channels 1 and 2 of the oscilloscope. Set the vertical position of both channels to be at the same place when the inputs are grounded, and view the signals with “DC” input coupling, making sure that both channels are at the same volts/div setting. What problem do you see and how could you solve it? Additional exercises on the next page 3 Exercises for Lab 5, Diodes and Rectification 73 5. Optional: Now construct the diode-bridge circuit shown below. Use the diodes in your kit, not the packaged diode bridge. Pay attention to the directions of the diodes! Do not connect the center-tap of the transformer output to anything! The 1-k resistors are in the circuit to protect the diodes until you are sure they are in the circuit correctly and operating properly. If you get one of the diodes in backwards it will get very hot and you will likely let the smoke out. Once the circuit is working, remove the 1-k resistors and replace them with wires. 1k 110 VAC Vout 1k 10 k You want to compare the transformer output with the bridge output. You should look at the instructions for exercise 3 to properly view the two waveforms. Graph these signals in your lab manual and indicate the amplitude of each signal. How do the results compare to those of the half-wave and full-wave rectifiers? 6. Optional: Connect an LED between the output of the signal generator and ground. Drive it with a square wave. The output resistance of the signal generator is large enough so that the current through the LED will be properly limited. Adjust the frequency of the signal generator so that the LED blinks once per second. Now connect an additional LED so that one LED is on while the other is off, i.e., the LEDs blink 180 degrees out of phase with each other. Lab 6 Transistors and MOSFETs Notes for Lab 6: Transistors and MOSFETs A bipolar junction transistor (BJT) has three leads labeled as emitter, base, and collector. There are two different types of BJTs, NPN and PNP, as shown below. NPN collector PNP emitter base base emitter collector The base-emitter junction is like a diode with the orientation indicated by the arrow in the symbol. The transistor is “turned on” by applying a forward-biased voltage across the diode junction so that a small current, IB , flows between the base and the emitter in the forward diode direction. This small current then causes a much larger current, IC , to flow between the collector and the emitter (also in the forward diode direction). IC and IB are roughly proportional so that IC = βIB , where the value of β is typically at least 100, though this value can vary widely from one transistor to the next. Thus, the BJT is essentially a current amplifier. We put a little current through the base, and get a lot of current through the collector. Two simple rules govern the behavior of a transistor. For NPN BJTs, these are: 1. VC ' VE + 0.2 V when the transistor is fully on (but not when turned off). 2. When the transistor is on, VB ≈ VE + 0.6 V. The 0.6 V here is the expected diode voltage drop across the base-emitter junction. The transistors that we are using experience IB ' 1 mA and IC ' 100 mA when fully on. For PNP BJTs, the corresponding rules are: 1. VE ' VC + 0.2 V when the transistor is fully on (but not when turned off). 2. When the transistor is on, VE ≈ VB + 0.6 V. The 0.6 V here is the expected diode voltage drop across the emitter-base junction. The transistors that we are using experience IB ' 1 mA and IC ' 100 mA when fully on. Note that IC , IB , and |VC − VE | must not exceed maximum (safe) values or smoke will result. More advanced transistor analysis requires the use of transistor curves, but this is beyond what we need here. 77 78 Notes for Lab 6, Transistors and MOSFETs In the circuit below, an NPN transistor is being used as a switch. +VCC RL Vin The purpose of this switch is to turn on the current through the load RL . When the transistor is turned on, it draws current from the power supply (+VCC ) through the load and into the collector. This current causes a voltage drop across the load. When the current reaches the value IC = VCC /RL , the voltage drop across the load is equal to VCC and the voltage at the collector is near 0 V. The base current required to do this is IB = IC /β. If we put more current into the base than this amount, IC will not increase any further because the collector voltage cannot drop below the emitter voltage. We say that the transistor is “saturated” and fully turned on. Thus, turning on the switch requires that IB > IC /β. For example, if we have a load which requires 100 mA, we can turn on this current with only a few milliamps into the base. Here is the analogous switch made with a PNP transistor. +VCC Vin RL The following NPN transistor circuit is called an emitter follower. +VCC Vin Vout RL The input voltage turns on the transistor. Current flows from the power supply (+VCC ) into the collector, out of the emitter, and through the load RL into ground. This current Notes for Lab 6, Transistors and MOSFETs 79 causes a voltage drop across the load. As the current increases, the voltage at the emitter increases until it becomes about 0.6 V below the voltage at the base. It cannot increase any further because the base-emitter junction requires 0.6 V to be turned on. Therefore Vout “follows” Vin . If Vin increases, so does Vout . If Vin decreases, so does Vout . Vout stays 0.6 V below Vin . A current IC through the load only requires an amount of current IB = IC /β into the base. Thus, the input resistance of the base is βRL , much larger than the resistance of the load itself. Note that the circuit above can only drive the load with positive voltage. If Vin goes negative, the transistor is turned off. If we want to drive the load with a negative voltage, we can do so by employing a PNP transistor in our emitter follower. Vout Vin RL -VCC A metal-oxide-semiconductor field-effect transistor (MOSFET) also has three leads. They are labeled source, gate, and drain, as shown below: drain gate source drain gate source The symbol on the right is the “correct” symbol for the MOSFET we will be using since it is an n-channel enhancement mode MOSFET (i.e., the conduction region is made of n-type semiconductor and the conductivity is enhanced, or the resistivity is reduced, by applying a voltage to the gate). The symbol on the left, either with or without the arrow in the center, is a more generic symbol for a MOSFET transistor. Current flows into the drain and out of the source in an n-channel device. This MOSFET is turned on by applying a few volts to the gate (measured with respect to the source). Unlike a BJT, no current flows through the gate of an ideal MOSFET because it is well insulated from both the drain and source. In practice, there is a little bit of capacitance between the gate and the other two leads, so that a tiny current flows each time the voltage on the gate is changed. But we will ignore this effect for now. 80 Notes for Lab 6, Transistors and MOSFETs In the figure below, we illustrate a switch circuit based on a MOSFET. Because no gate current is required, such a switch is generally superior to the corresponding transistor circuit. With this MOSFET, we can switch a large current on and off merely by changing the gate voltage at zero gate current. +VCC RL Vin Name In-Class Exercises for Lab 6: CID Transistors and MOSFETs 1. In the transistor switching circuit below, assume that R is 100 kΩ. How much current goes through the resistor when the switch is turned on, and what will the light bulb do? Reconsider these questions for R = 10 kΩ and R = 1 kΩ. Ignore the transistor’s forward-voltage bias (i.e. assume a perfect transistor with β = 100). +10 V 100 Ω when lit b R c e 2. The following circuit is an emitter follower. Vin = (3 V) + (1 V) sin(ωt). Sketch Vout as a function of t. What happens to Vout if a 500 Ω load is attached to the follower output? +10 V Vin Vout 1k 3. When an output device is used to directly drive a load resistor RL , the input resistance of the load is simply equal to RL . However, when the load is incorporated into a FET switch as shown below, the input resistance is increased. Estimate the effective input resistance of this new configuration. +VCC RL Vin 81 Lab 6 Exercises: Transistors and MOSFETs 1. Briefly test the incandescent lamp (#47) in your lab kit by connecting the two leads between 5 V and ground. It should light up brightly. Next, obtain a 1-Hz square wave from the signal generator that switches between 0 V and 5 V as shown below. This will require that you adjust the DC offset while observing the output with your oscilloscope. Once this is working, connect the two leads of the lamp between the signal generator output and ground. Does the lamp blink brightly? Why or why not? 5V 0V Next, construct the following two transistor switches and connect the signal generator output to the Vin of both circuits. The identifications of the pins on the 2N3904 and 2N3906 transistors are given in the “Pinouts” section in this lab manual. Because you only have one incandescent lamp, you will only be able to test one circuit at a time. 5V 5V #47 Lamp Vin Vin 2N3906 #47 Lamp 2N3904 In either circuit, the lamp should blink brightly. Explain why. Observe the signal generator output with your oscilloscope while watching the lamp blink. For the NPN circuit, does the lamp turn on when the Vin is high or low? Why? How is the PNP circuit different? Why? Additional exercises on the next page 83 4 Exercises for Lab 6, Transistors and MOSFETs 85 2. Construct the following transistor switch using a power MOSFET. Use the same input from the signal generator as in exercise 1 above. The identification of the pins on the IRF3704 MOSFET is given on the pinouts sheet in your packet. 5V #47 Lamp Vin IRF3704 The lamp should blink brightly as before. Now disconnect the signal generator from Vin . Connect the ground of the power supply to the ground of the circuit. Connect a wire to Vin and hold the end of it between two fingers of one hand. With the other hand, touch the end of the wire connected to the 5 V power supply. The lamp should turn on. Touch the ground. The lamp should turn off. Explain why this happens. You may also find it interesting to hold the wire connected to Vin with one hand and then move your other hand around, but without touching anything, and observe what happens. Additional exercises on the next page 3 Exercises for Lab 6, Transistors and MOSFETs 87 3. This next exercise illustrates the uses and limitations of a voltage follower circuit. Obtain a 1-kHz sine wave from the signal generator. Adjust its amplitude to be 5 V peak to peak. Adjust its offset to be about 5 V above ground. Now connect a 100-Ω resistor between the output of the signal generator and ground. View the result on the oscilloscope. What happened to the signal? Why? Next disconnect the 100Ω resistor from the signal generator and use the sine wave as input for the emitter follower shown below. The capacitor is necessary for stability. Note that there is no connection between the capacitor and Vout . +15 V 2N3904 Vin 100 0.1 µF Vout View Vin and Vout simultaneously on the oscilloscope. Adjust the oscilloscope channel 1 and channel 2 vertical offsets to zero with the inputs grounded so that you can measure both the DC and AC components of these signals accurately. What does the follower do to the signal? What happens when the DC offset switch on the signal generator is turned off? Why? Qualitatively, how large is the AC output impedance of the follower compared to 100 Ω. How is a follower useful? 4. Optional: Devise a method to measure the current gain β = IC /IB of the 2N3904 transistor in your lab kit. Be sure that the voltage between the collector and emitter is at least 2 V when you make this measurement. 3 Lab 7 Operational Amplifiers Notes for Lab 7: Operational Amplifiers An operational amplifier (also called an op-amp) has two inputs: the noninverting input (Vin+ ) and the inverting input (Vin− ), as well as one output (Vout ). It has the following symbol: Vin- − Vin+ + Vout Like a transistor, an op-amp is an active device that requires power to operate. Two of its pins, usually labeled V + and V − on a pin diagram, must be connected to positive and negative power supplies, respectively. These positive and negative power supply voltages are often called +VCC and −VCC , respectively, though the power-supply connections are not usually shown explicitly on circuit diagrams. An op-amp is essentially a differential amplifier, which means that its output voltage is proportional to the difference of the two input voltages: Vout = A(Vin+ − Vin− ) . The proportionality constant A is called the open-loop gain and is usually greater than 105 at low frequencies. Thus, a small difference in input voltages is amplified to become a large voltage at the output. If we ground Vin+ , the amplifier output will be Vout = −A Vin− , so that the input and output have opposite signs. We call this an inverting amplifier. If we instead ground Vin− , the amplifier output will be Vout = A Vin+ which yields a non-inverting amplifier. The following circuit includes negative feedback and is called an inverting amplifier. R2 R1 Vin − + Vout Because the resistor R2 allows the voltage at the output to influence the voltage at the input, it is called a feedback resistor. For the inverting amplifier above, first observe that when Vin is 0 V, Vin+ , Vin− and Vout will also be zero. Then consider that raising Vin to a small positive voltage will raise Vin− to a small positive voltage, which causes Vout to swing to a large negative voltage, which 91 92 Notes for Lab 7, Operational Amplifiers then pulls a current to the right through R2 and thereby pulls Vin− back down towards zero. Similarly, lowering Vin− to a small negative voltage causes Vout to swing to a large positive voltage, which will then pushes a current to the left through R2 and thereby pushes Vin− back up towards zero. Because the reaction of the output always opposes the original change at the input, we refer to the feedback as “negative”. Negative feedback always opposes fluctuations at the input and thereby stabilizes the output at an equilibrium value somewhere between +VCC and −VCC . Positive feedback (achieved by attaching a feedback resistor from Vout to Vin+ ), on the other hand, reinforces input fluctuations and thereby destabilizes the output, causing Vout to swing towards infinity until it saturates at either +VCC and −VCC . When a negative feedback resistor is present, the large open-loop gain, A, guarantees that the op-amp will do everything it can to force the two inputs to be equal. And the large input resistance of the op-amp guarantees that this happens without drawing a substantial current through either of the inputs. Even if you don’t fully appreciate how remarkable this op-amp magic is, remember the following two rules for working with a negative feedback op-amp circuit. 1. Vin− = Vin+ (as long as the configuration allows the amplifier to achieve this). 2. Iin− = Iin+ = 0. With these two rules in mind, We can now determine the stable value of Vout that results from a given value of Vin . Because Vin+ is connected to ground, the first rule requires that Vin− also be zero. The second rule requires that all of the current that passes through R1 must pass through R2 . The application of Ohm’s law to each resistor then yields (Vin − Vin− ) (Vin− − Vout ) = , R1 R2 which can be reduced to R2 Vout =− . Vin R1 The gain (amplification factor) is equal to the ratio of the two resistances, and can be set by selecting appropriate values for R1 and R2 . The minus sign reminds us that the input and output of an inverting amplifier have opposite polarities. You should also notice that the input impedance of an inverting amplifier is fairly easy to approximate. Since the op-amp will do everything it can to hold Vin− at 0 V, the input impedance appears to be just R1 to ground. This is fairly accurate for low frequency signals. As the frequency of the input signal increases, the input impedance will vary from this value due to the non-ideal characteristics of a real op-amp. By exchanging the Vin and ground connections we can make a noninverting amplifier. Notes for Lab 7, Operational Amplifiers R1 93 R2 − + Vin Vout We can clearly see that Vin = Vin+ . And the first op-amp rule further requires that Vin+ = Vin− , so that Vin = Vin− . Because the second op-amp rule allows no current to flow into the inverting input, the R1 and R2 resistors form a simple voltage divider where Vin R1 = , Vout R1 + R2 which can be arranged as Vout R2 = +1. Vin R1 The input impedance of a non-inverting amplifier is also simple to estimate. If you look at the data sheet for your amplifier, it will usually list the differential input resistance or the input resistance of the amplifier. For an op-amp that uses BJT input stages, this is typically 100 to 200 MΩ. If you find a higher-quality op-amp that uses FET input stages, this value will be more like 1013 Ω. A special case of this circuit, shown below, is a voltage follower. − Vin + Vout Here, R2 = 0 and R1 = ∞, so that Vout = Vin . The follower has a very large input resistance and a very small output resistance. It easily outperforms a follower constructed from a single transistor. Internally, the op-amp is actually a rather complicated circuit containing many transistors. Op-amps have limitations which are important to understand. 1. The output current of an op-amp is limited. If we try to draw too much current from an op-amp, its output voltage will rise until its output current maxes out and then go no further. This condition can, for example, be achieved by shorting the output to ground, and does not harm the op-amp. 2. Regardless of the resistor values that you use, the gain of an amplifier circuit can’t be greater than the open loop gain of the op-amp, which is very large, but not infinite. 94 Notes for Lab 7, Operational Amplifiers 3. The open loop gain of an op-amp decreases at high signal frequencies. The frequency at which the open loop gain drops to 1 (i.e., no gain at all) is called the bandwidth of the op-amp, and can vary from about 1 MHz up to 10 GHz depending on the quality (and cost). This means that an amplifier made from an op-amp will only be good up to a certain frequency, beyond which its output voltage will drop. Note that high-gain op-amps tend to have small bandwidths. You should refer to the data sheet for the TL3472 in Appendix II. This is the specific op-amp that we will be using for the exercises in this lab. The data sheet lists the limitations on the operating parameters of the op-amp as well as typical parameters and some performance graphs. The data sheet also includes a representative schematic of the internal circuitry of the op amp on p. 2. Some of the specifications are given in units of dB (decibels). If you have not encountered these units before, you will find a short discussion in Lab 13(Audio Amplifier). dB is a logarithmic unit that is commonly used in electronics. We can modify the inverting amplifier to create a summing amplifier. Vin1 Vin2 R R1 R2 − + Vout Since Vin+ is grounded, the op-amp adjusts its output so that Vin− = 0. The total current into Vin− must be zero, so we have Vin1 Vin2 Vout + + =0. R1 R2 R Rearranging terms, we obtain Vout = − R R Vin1 − Vin2 . R1 R2 If R1 = R2 = R, this becomes Vout = −(Vin1 + Vin2 ) . The output is equal to the sum of the two inputs (with a minus sign). For other choices of resistors, we can obtain a “weighted” sum of the two inputs. With a little more rearranging we arrive at a difference amplifier. Notes for Lab 7, Operational Amplifiers R Vin1 R − R Vin2 95 Vout + R The voltage at Vin+ is 12 Vin2 . The op-amp adjusts its output so that Vin− is also equal to 1 2 Vin2 . Since the total current into Vin− must be zero, we have Vin1 − 12 Vin2 Vout − 12 Vin2 + =0. R R Rearranging terms, we obtain Vout = Vin2 − Vin1 . The output is equal to the difference of the two inputs. If we choose values of resistors which are different from each other, we can also obtain various “weighted” differences from this kind of circuit. The following circuit is a constant current source. +VCC R +VCC R1 − + R2 RL We are very acquainted with voltage sources. A power supply is usually a voltage source. It puts out a certain voltage no matter what the load is (within limits). The current it puts out depends on the load. The smaller the load resistance, the larger the current. A current source is just the opposite. It puts out a certain current no matter what the load is (within limits). The voltage it puts out depends on the load. The larger the load resistance, the larger the voltage. In the above circuit, the resistors, R1 and R2 , form a voltage divider and determine the voltage at Vin+ . The op-amp adjusts its output so that Vin− = Vin+ . Thus, the emitter of the transistor will be at Vin+ and its base 0.6 V lower than Vin+ . Note that in this case, the negative feedback does not come directly from the output of the op-amp. The negative 96 Notes for Lab 7, Operational Amplifiers feedback can come from any point in the circuit as long as the op-amp can somehow control the voltage at that point. In this case, the op-amp controls the voltage on the emitter of the transistor via the voltage on the base. The output of the op-amp will automatically adjust its value so that the emitter is exactly at Vin+ . Since the voltage across R is fixed, +VCC on one end and Vin+ on the other end, the current through R is also fixed. More than 99% of this current comes out of the collector of the transistor into the load RL . A small amount comes out of the base into the output of the op-amp. IC (the collector current) is what is provided to RL . This current can be related to I, the current through R: I = IC + IB = IC + IC /β = IC (1 + 1/β) I β IC = =I . 1 + 1/β β+1 Recall that β ' 100, and doesn’t vary significantly for a given transistor. Thus the current through the load is fixed. It depends only on the choice of the other resistors in the circuit. This circuit is called a clamp. +VCC R1 R Vin Vout − + R2 The resistors, R1 and R2 , form a voltage divider and determine the voltage at Vin+ . The op-amp tries to adjusts its output so that Vin− = Vin+ . When Vin is less than Vin+ , The output of the op-amp increases, trying to bring Vin− up to Vin+ . But the diode does not conduct current in that direction, and no matter how high the output of the op-amp goes, it cannot affect Vin− . In this case, the op-amp does not succeed in forcing Vin− = Vin+ . The highest voltage that the output of the op-amp can go to is +VCC , and it just stays there, frustrated in its attempt at negative feedback. Since no current flows through the diode, Vout and Vin are simply connected by a resistor, R, and we have Vout = Vin . When Vin is greater than Vin+ , the output of the op-amp decreases. Now current is flowing through the diode in the correct direction, and the op-amp is able to pull Vin− down to the value of Vin+ . Thus, we have Vout = Vin+ . The circuit “clamps” the voltage at Vin+ . Vin+ is called the clamp voltage and is determined by the two resistors, R1 and R2 . This circuit allows signals which are less than the clamp voltage to pass through it. If a signal greater than the clamp voltage tries to pass through it, the circuit holds the output at the clamp voltage. The purpose of resistor R is to limit the current through the diode when the circuit is clamping the voltage. Notes for Lab 7, Operational Amplifiers 97 Replacing one of the resistors in the input/feedback circuit on an inverting amplifier results in some very useful circuits. If you replace the feedback resistor with the capacitor you have an integrator. C Vin R − Vout + Since Vin+ is grounded, the op-amp adjusts its output so that Vin− = 0. The total current into that point must be zero, so we have Vin dVout +C =0. R dt Solving for Vout , we obtain 1 Vin dt . RC The output is proportional to the integral of the input. If the input is some constant voltage, then the output is a “straight line,” i.e., the voltage ramps linearly, either up or down, depending on the sign of the input. A square wave on the input produces ramps alternating between upward and downward directions, i.e., a triangle wave. This circuit could also be used to obtain the area of a voltage pulse. Z Vout = − The integrator circuit shown above has a problem. If the input is not exactly balanced between positive and negative voltages, its integral will tend to drift, and eventually, the output will saturate at either +VCC or −VCC . Drift can also be caused by a small bias current from the (non-ideal) op-amp inputs. This can be remedied by connecting a large resistor, R0 , in parallel to C, as shown below. R′ C Vin R − + Vout 98 Notes for Lab 7, Operational Amplifiers If, instead of replacing the feedback resistor, you replace the input resistor with a capacitor the resulting circuit is a differentiator. R C − Vin + Vout Since Vin+ is grounded, the op-amp adjusts its output so that Vin− = 0. The total current into Vin− must be zero, so we have C dVin Vout + =0. dt R Solving for Vout , we obtain dVin . dt The output is proportional to the derivative of the input. Vout = −RC Name In-Class Exercises for Lab 7: CID Operational Amplifiers 1. Calculate the gain Vout /Vin for the circuit shown below. 10 kΩ Vin 1 kΩ − Vout + 2. Calculate the gain Vout /Vin for the circuit shown below. 1 kΩ 10 kΩ − + Vin Vout 3. Calculate the gain Vout /Vin for the circuit shown below. − Vin + Vout Additional exercises on the next page 99 In-Class Exercises for Lab 7, Operational Amplifiers 101 4. Calculate the output of the circuit below when V1 = 5 V, V2 = 2 V, R1 = R2 = 1 kΩ and R = 2 kΩ. R R1 V1 R2 V2 − Vout + 5. Assuming that the load resistance RL is appropriate to the application below, determine the current delivered to the load when VCC = 15 V, R1 = 10 kΩ, R2 = 5 kΩ and R = 1 kΩ. +VCC R +VCC − R1 + RL R2 6. Let the input voltage be a 10 V peak-to-peak sine wave. Sketch several periods of the output voltage when VCC = 15 V, R1 = 10 kΩ, R2 = 5 kΩ and R = 1 kΩ. +VCC R1 R Vin Vout − + R2 Lab 7 Exercises: Operational Amplifiers 1. (a) Using the op-amp chip in your kit (either the LM741 or the TL3472), design and construct an inverting amplifier with a gain of −10±1. The input resistor should be at least 10 kΩ to avoid loading down the signal generator too much. Use a 2 V peak-to-peak sine wave with no DC bias and a frequency of about 1 kHz as input. View both the input (channel 1) and output (channel 2) simultaneously on the oscilloscope. Trigger the oscilloscope externally using the TTL output of the signal generator. Set the V/div and the vertical offset of each channel, and also Invert channel 2 (on the Channel 2 menu), so that the input and output overlay each other on the oscilloscope. CAUTION: Don’t forget to connect the V + and V − pins of the op-amp to the +15-V and −15-V power supplies respectively. Have you ever wondered why your computer isn’t working, only to discover that you forgot to plug it in? Also take care not to insert the op amp chip upside down. If you connect +15 V and −15 V to the wrong pins, you can destroy the chip. (b) Test the voltage limit of your op-amp by increasing the input voltage to 5 V peak-to-peak. Explain the difference between what you saw before and what you see now. (c) Adjust the input voltage to 1 V peak-to-peak, and test the current-driving ability of your op-amp by adding a 100-Ω resistor between the output and ground. If your output appears fuzzy, add a 0.1 µF capacitor between the output and ground. Use the result to determine the maximum output current of your opamp. (d) Now use another op-amp to construct a second inverting amplifier with the same gain (-10) and send the output of the first amplifier into the input of the second amplifier. Note that the TL3472 contains two amplifiers in the same package - you do not need a second chip if you are using this amplifier. Check the pinout drawings at the front of the manual to see how to wire the second amplifier. View the input of the first op-amp (channel 1) and the output of the second op-amp (channel 2) simultaneously on the oscilloscope (you will want to turn off the Invert on channel 2). Use a 0.1 V peak-to-peak sine wave as input. The resulting gain should be +100. 4 2. Design and construct a noninverting amplifier with a gain of 5.0 ± 0.5. As in the previous exercise, verify the amplification factor by overlaying the input and output signals on the oscilloscope. 3 Additional exercises on the next page 103 Exercises for Lab 7, Operational Amplifiers 105 3. (a) Set your signal generator amplitude knob about 1/4 of full amplitude, set the frequency to about 2000 Hz, and view the output on the oscilloscope. Attach a speaker to the signal generator output and again measure the output signal and record its amplitude. What happens to the amplitude of the signal when you attach the speaker? (b) Now build an op-amp voltage follower and insert it between the signal generator and the speaker. Measure the voltage amplitude across the speaker. Since the opamp destabilizes when it reaches its current limit, it may help to connect a 1-µF capacitor between the terminals of the speaker (in parallel with the speaker). What do these measurements tell you about the relative output resistances of the signal generator and the follower? 4. Optional: Construct a summing amplifier, as shown in the notes for this lab. Use R1 = R2 = R = 10 k. The output voltage of this circuit should be Vout = −(Vin1 + Vin2 ). Test this, using 5 V and −15 V as the two inputs. Also try adding together 5 V from the power supply and a sine wave from the signal generator. How would you change this circuit if you wanted the output to be Vout = −(Vin1 + 2Vin2 )? Make the change and try it. Use the +5-V power supply for the input with gain = 1 and a sine wave for the input with gain = 2. 5. Optional: Construct a clamp circuit, as shown in the notes for this lab. Choose R1 and R2 so that the clamp voltage is 1 V. For Vin , use a 1-kHz sine wave from the signal generator. Turn the DC offset off and set the amplitude to its maximum value. Demonstrate that you obtain the desired clamping effect. 6. Optional: Construct a current source, as shown in the notes for this lab. Choose R1 and R2 so that the noninverting input of the op amp is 10 V. The op-amp will adjust its output so that its inverting input is also 10 V. Thus the resistor R will have 15 V at one end and 10 V at the other end. Choose R so that the current through it is 1 mA. Since more than 99% of this current comes out of the collector of the transistor, the current through the load will also be 1 mA. Adjust the resistors, if necessary, so that the current through the load is 1.0 ± 0.1 mA. Test this circuit for various values of RL . Does this circuit put out 1 mA no matter how large RL is? What is the limit on RL ? 7. Optional: Design and construct a noninverting amplifier with variable gain. Use a 10k pot to control the gain. When the knob on the pot is fully turned counterclockwise, the gain should be 1. When the knob on the pot is fully turned clockwise, the gain should be 10. 8. Optional: Construct an integrator circuit, as shown in the notes for this lab. Put a 1-MΩ resistor in parallel with the capacitor. (This is the resistor R0 shown in the figure on p. 97 of the notes for this lab.) If the input is a square wave, the output should be a triangle wave. You should choose RC to be larger than the period of the input signal. Additional exercises on the next page 3 Exercises for Lab 7, Operational Amplifiers 107 9. Optional: Construct a differentiator circuit, as shown in the notes for this lab. If the input is a triangle wave, the output should be a square wave. If the input is a square wave, the output should be a series of positive and negative “delta functions” (spikes). You should choose RC to be smaller than the period of the input signal. Lab 8 Comparators Notes for Lab 8: Comparators Consider the following circuit: − Vin Vout + The first thing to notice about this circuit is that there is no feedback from the output to the inputs. The output cannot influence the input. The output is simply given by Vout = A(Vin+ − Vin− ) = AVin . This circuit amplifies Vin with a gain equal to A, the open loop gain of the op-amp. The value of A is typically greater than 105 . What happens when Vin = 1 V? We do not get an output of 100 kV! The highest voltage anywhere in the circuit inside the op-amp is VCC . Therefore its output cannot exceed VCC . When we try to require the op-amp to put more than VCC on the output, it just puts out VCC . We say that the op-amp is “saturated.” The output of the op-amp in the above circuit will be saturated at +VCC whenever Vin is greater than VCC /A, which is a very small voltage, typically much less than a millivolt. Similarly, its output will be saturated at −VCC whenever the Vin is less than −VCC /A, also a very small voltage. Thus, except for a very narrow range of input voltages, Vout will be either +15 or −15 V. We usually neglect that small range of voltages and write, as a good approximation, ( +VCC , Vin > 0; Vout = −VCC , Vin < 0. The output tells us whether or not the input is greater than 0 V. It does not tell us how much greater (or less). It just tells us yes or no. This kind of circuit is called a comparator. It compares Vin with the voltage at Vin− . The voltage that Vin is compared to is called the threshold voltage. In this case, the threshold voltage is 0 V. In the circuit below, we connect the output of a voltage divider to Vin− . +VCC R1 − + Vin R2 111 Vout 112 Notes for Lab 8, Comparators Depending on the values of R1 and R2 , the threshold voltage at Vin− can be anything between +VCC and ground. This circuit compares Vin with the voltage at Vin− . We obtain ( Vout = +VCC , −VCC , Vin > Vin− ; Vin < Vin− . We can reverse the polarity of the output by interchanging the two inputs: +VCC R1 − Vin Vout + R2 We are now comparing Vin with the threshold voltage at Vin+ , and we have ( Vout = +VCC , −VCC , Vin < Vin+ ; Vin > Vin+ . There is always some “noise” on a signal. Sometimes this noise can cause a very fast comparator to switch back and forth several times as Vin moves across the threshold voltage. We can solve this problem by adding a little positive feedback to the circuit. +VCC R1 − Vin Vout + R2 R -VCC Suppose that Vin is below the threshold voltage. The output is at +VCC . As Vin crosses the threshold voltage, Vout switches to −VCC . Since Vout is connected to Vin+ through the resistor R, this decrease in Vout causes a decrease in Vin+ . The threshold voltage jumps to a lower value, and Vin is now suddenly above the threshold voltage. As long as the jump in Notes for Lab 8, Comparators 113 the threshold voltage is greater than the amplitude of the noise on Vin , the output will only switch once. Similarly, when Vin crosses the threshold voltage coming down, Vout switches from −VCC to +VCC . This increase in Vout now causes the threshold voltage to jump to a higher value, and Vin is now suddenly below the threshold voltage. The amount that the threshold voltage jumps as the output switches depends on the size of R. Lower values of R result in larger jumps. A comparator with positive feedback is called a Schmitt trigger. Note that the feedback must be to Vin+ , not Vin− . In some applications, the speed with which a comparator switches its output from +VCC to −VCC and back again is important. ICs are available which are made especially for this purpose and have very fast switching speeds. We will use the LM311 (sometimes referred to as just the 311) comparator for some of our exercises. You should note that the LM311 has a ground connection indicated on the pinouts, unlike the typical op amp. This is because the LM311 has what is often referred to as an “open collector” output. Below is the schematic for the output stage of the LM311. (to the rest of the LM311) Output (pin 7) 4Ω GND (pin 1) This is just the schematic for the transistor switches we encountered in Lab 6 (Transistors and MOSFETs). It is called “open collector” because the output is an NPN transistor with no internal connection to the collector. This is advantageous because it allows the LM311 to switch up to 50 V and and 50 mA loads. It is a disadvantage because there is no voltage source present on the output. In order for the LM311 to work properly you will have to connect a resistor between some positive voltage source (typically 5 V in our case) and the output (pin 7). This resistor usually needs to be large with respect to the resistor between the emitter of the internal transistor and ground – 4 Ω in the case of the LM311. In our exercises we usually use 100 Ω to 5 V. Those values can be changed depending on the application. Name In-Class Exercises for Lab 8: CID Comparators 1. Sketch the output Vout for the op-amp circuit below when the input is a sine wave of amplitude VCC . Note the limits on the voltage divider. +VCC 1k − Vin Vout + 2k -VCC 2. (a) When no feedback resistor is present in the circuit shown below, what nominal reference voltage Vref is produced by the voltage divider on the left? (b) When the feedback resistor is present, Vout alters the value of Vref . When the Vin rises above Vref , the output swings to ground causing Vref to change to what value? (c) Because this op-amp has an open collector output, it requires a 100-Ω pull-up resistor on the output. When Vin drops below Vref , the output swings up to 5 V causing Vref to change to what value (ignore the small contribution of the pull-up resistance)? +15 V +5 V 2k Vin Vref 1k − + 100 Vout 10 k 115 Lab 8 Exercises: Comparators 1. Construct the following comparator circuit using an op-amp. For Vin , use a 5-kHz square wave from the signal generator. Adjust the amplitude to the highest possible setting. Vin − Vout + View Vout on the oscilloscope. Determine the time required for the op-amp to switch its output between −15 V and +15 V. Show your result to the lab instructor. Now replace the op-amp with an LM311 comparator. This is an IC made especially for this kind of circuit. Be careful: the pin assignments for the LM311 are not the same as for your op-amp. Also note that there is a ground connection in addition to the usual connections to +15 V and −15 V . Connect a 100-Ω resistor between the output and +5 V from the power supply. View Vout on the oscilloscope. Determine the time required for the LM311 comparator to switch its output between 0 and 5 V. Save this circuit for the next exercise. 3 2. Use the LM311 comparator circuit from exercise 1. For Vin use a 100-Hz sine wave from the signal generator. Adjust the amplitude to be 1 V peak to peak. View Vout on the oscilloscope. Look carefully at the transitions between 0 and 5 V. What do you see? Show it to the lab instructor. Now add some positive feedback, as shown below. +5 V Vin − + 1k 100 Vout 22 k View Vout on the oscilloscope. How is Vout now different from before? Additional exercises on the next page 117 4 Exercises for Lab 8, Comparators 119 3. Design and construct a comparator circuit, using the LM311, such that ( Vout = 5 V, 0 V, Vin > 2.0 ± 0.2 V; otherwise. For input use a 1-kHz sine wave from the signal generator. Adjust its amplitude to be 6 V peak to peak. It is not necessary to include the 22k positive feedback resistor in this circuit. The 100-Ω pull-up resistor is still necessary. View Vin and Vout simultaneously on the oscilloscope. Trigger the oscilloscope externally, using the TTL output of the signal generator. Turn on the DC offset on the signal generator and observe what happens to the output as the offset is moved up and down. 4. Optional: Design and construct a comparator circuit, such that ( Vout = 5 V, 0 V, Vin < −5 V; otherwise. 3 Lab 9 555 Timer Notes for Lab 9: 555 Timer The 555 timer is an IC with eight pins. Their functions are as follows. (The input/output in parentheses indicates whether the pin is an input to the IC or an output from the IC.) GROUND V+ Connect to ground. Connect to the power supply, VCC . It can be any voltage between 5 and 15 V. (output) This is the output of the timer. It has only two states, called high and low. The output is high when it is at VCC and low when it is at ground. Note that the output of the 555 timer can source or sink 200 mA. OUTPUT TRIGGER (input) When the voltage at the trigger input goes below VCC /3, the output goes high. The output is not affected when the trigger input goes above VCC /3. It remains high. THRESHOLD (input) When the voltage at the threshold input goes above 2VCC /3, the output goes low. The output is not affected when the threshold input goes below 2VCC /3. It remains low. (output) The discharge pin is grounded by the IC whenever the output is low. It is an open circuit whenever the output is high. DISCHARGE RESET (input) When the voltage at the reset input is zero, the output is low, no matter what the voltages at the trigger and threshold inputs are. Normally we connect the reset input to VCC to allow the IC to function. CONTROL VOLTAGE (input) The control voltage input can be used to change the voltages at which the trigger and threshold inputs affect the output. The trigger input causes the output to go low when its voltage goes below one-half the voltage at the control voltage input. The threshold input causes the output to go high when its voltage goes above the voltage at the control voltage input. When the control voltage input is not connected to anything, its voltage is set internally by the IC to be 2VCC /3. For uses of the 555 timer, study the data sheet in Appendix II. 123 124 Notes for Lab 9, 555 Timer Below is an oscillator circuit using a 555 timer. VCC VCC VCC V+ R1 DISCHARGE RESET 555 R2 TRIGGER OUTPUT Vout THRESHOLD C GND When the trigger input goes below 13 VCC , the output goes high. The capacitor charges up through R1 + R2 , gradually raising the voltage on the threshold input. When the threshold input goes above 32 VCC , the output goes low and the discharge pin is grounded. This discharges the capacitor through R2 alone, gradually lowering the voltage on the trigger input. When the trigger input goes below 13 VCC , the cycle repeats itself again. The amount of time the output spends in the high state depends on R1 + R2 . The amount of time the output spends in the low state depends on R2 alone. Since R1 cannot be zero (the IC would not be able to ground the discharge pin if it were connected directly to VCC ), the output will spend more time in the high state than in the low state, resulting in an asymmetrical square wave. The period, T , of oscillation (sum of time in low state and time in high state) is given by T = (ln 2)(R1 + 2R2 )C ≈ (0.7)(R1 + 2R2 )C . If we control the reset input, instead of just connecting it to VCC , we can turn this oscillator on and off. The oscillator will be off (Vout = 0) when the reset input is at 0 V. Notes for Lab 9, 555 Timer 125 Below is a pulse generator (also called a monostable multivibrator) using a 555 timer. VCC VCC VCC V+ Vin TRIGGER RESET 555 R DISCHARGE OUTPUT Vout THRESHOLD C GND When Vin is high (above 13 VCC ), the output just stays low. The discharge pin also stays at ground, keeping the capacitor discharged. When Vin goes low, the output goes high, and the capacitor charges up through R, gradually raising the voltage on the threshold input. When the threshold input goes above 23 VCC , the output goes low again, and the capacitor is quickly discharged. Nothing else happens as long as Vin has gone high again in the meantime. This circuit puts out a single pulse of length T , given by T = (ln 3)RC ≈ (1.1)RC . Name In-Class Exercises for Lab 9: CID 555 Timer 1. Design a circuit using a 555 timer that will oscillate at a frequency of 5 kHz. Give the values of all resistors and capacitors. 2. Design a circuit using a 555 timer that will give a pulse 25 ms long when it is triggered. Give the values of all resistors and capacitors. 127 Lab 9 Exercises: 555 Timer You should connect a 1 µF capacitor between 5 V and ground on your breadboard and leave it there for each of the exercises in this lab. 1. (a) Design and construct an oscillator with a frequency of 1.0 ± 0.1 kHz using a 555 timer. Use 5 V for VCC . Display the output signal on your oscilloscope to verify the frequency. (b) Connect the output of your oscillator through a 1-k current-limiting resistor to a speaker with the second terminal on the speaker connected to ground. This will produce a soft 1-kHz tone. Use the oscilloscope to measure the peak output voltage to an accuracy of 0.05 V and divide this voltage by the load resistance (i.e., 1 k + speaker resistance) to determine the amount of current drawn by the speaker. Record the output voltage and current here in your lab notebook. Then refer to the room-temperature curve in the figure in the bottom left-hand corner of page 5 of the 555 data sheet in Appendix II of your lab manual and verify that the current-voltage point that you measured lies on or close to this curve (i.e., the chip is performing as designed). Note that the vertical axis in the figure is actually VCC − Vout . Save this oscillator circuit for use in the exercises that follow, some of which will require two 555 timers. You should have an extra 555 timer in your lab kit. 3 2. Use a 555 timer to construct a pulse generator that produces a 4 ± 1 s 5 V pulse. Connect the trigger input of the 555 timer to a switch that connects to ground when pressed and 5 V when released. Connect the output of the pulse generator to the Reset input of the oscillator you built previously (first disconnect the Reset pin from 5 V). Each time you press the button, the 1-kHz tone from the speaker will sound for 4 s. 3 Additional exercises on the next page 129 Exercises for Lab 9, 555 Timer 131 3. Use a single 555 timer to construct a metronome. The output of your circuit should have the following waveform. The short pulses should be about 0.8 s apart. The width of each short pulse should be as small as possible. If you connect this to a speaker, you will hear a click, click, click. . . Recommendations: Use a large capacitor in series with the speaker rather than a 1-k resistor to eliminate DC bias current, and make R2 as small as possible (even zero) in order to keep the pulses short. 4. Optional: Design and construct an “alarm” circuit that produces the following waveform. To accomplish this, disassemble the pulse generator from the previous exercise and reuse its 555 timer to build a 2-Hz oscillator. Then connect its output to the Reset input of your previously constructed 1-kHz oscillator. ≈0.5 s ≈1 ms This figure is not drawn to scale. There should be about 250 cycles in each “burst”. When the speaker is attached to the output of the 1-kHz oscillator (don’t forget the 1k series resistor), you should hear beep, beep, beep. . . Next, add a 311 comparator to your circuit (like the one from exercise 2 of the comparator lab). Choose the resistor values so that the inverting input is fixed at 2.5 V, while using a potentiometer to deliver a variable voltage between 0 and 5 V to the non-inverting input. Once you connect the output from the comparator to the Reset input of the 2-Hz oscillator, the alarm should beep continuously whenever the variable comparator input is greater than 2.5 V. Additional exercises on the next page 4 Exercises for Lab 9, 555 Timer 133 5. Optional: Design and construct a dimmer switch. It should include a 10k pot. When the knob on the pot is turned fully counterclockwise, the output should look like the following. ≈100 ms ≈8 ms When the knob on the pot is turned fully clockwise, the output should look like the following. ≈100 ms ≈80 ms In other words, the pot controls the length of each pulse, which varies from 8 ms to 80 ms as the knob on the pot is turned. The pulses are about 100 ms apart. Connect this output to an NPN transistor switch and use it to turn a #47 incandescent lamp on and off. (You will not be able to visually detect the flicker, though. Why not?) Turning the knob on the pot should cause the brightness of the lamp to change. Hint: Build a 100-Hz oscillator with very short negative-going pulses, like the metronome circuit. Use the output of this oscillator to trigger a pulse generator. Use the pot in series with a resistor in this pulse generator to produce pulses with widths that vary from 8 ms to 80 ms. Lab 10 Digital Gates Notes for Lab 10: Digital Gates The voltage in a digital signal has only two states. One state is 0 V, called the “low” state or logical “0”. The other state is 5 V, called the “high” state or logical “1”. A digital gate is a circuit with one or more digital inputs and a digital output. The output is some logical function of the inputs. Below, we list the most common digital gates found on ICs. Inverter. If the input is 0, the output is 1. If the input is 1, the output is 0. The symbol for the inverter is shown below. The little circle on the output indicates the NOT operation. Also shown below is the “truth table” for the inverter. In a truth table, the output is shown for every possible combinations of inputs. A Q 0 1 A Q 1 0 AND gate. The output is 1 if all inputs are 1. The output A 0 A 0 Q B 1 1 is 0 B 0 1 0 1 if any of the inputs is 0. Q 0 0 0 1 OR gate. The output is 1 if any of the inputs is 1. The output A B 0 0 A 0 1 Q B 1 0 1 1 is 0 if all inputs are 0. Q 0 1 1 1 NAND gate. This is an AND gate with an inverter on the the symbol indicating the NOT operation. A 0 A 0 Q B 1 1 Q 1 1 1 0 output. Note the small circle in B 0 1 0 1 NOR gate. This is an OR gate with an inverter on the output. A B 0 0 A 0 1 Q B 1 0 1 1 137 Q 1 0 0 0 138 Notes for Lab 10, Digital Gates XOR gate. This is an exclusive OR gate. The output is both inputs are 1. A 0 A 0 Q B 1 1 1 if either input is 1, but not if B 0 1 0 1 Q 0 1 1 0 Now let us consider some simple combinations of digital gates. First, suppose we tie together the two inputs of a NAND. This is simply an inverter. Similarly, we can also make an inverter from a NOR. = = Next, suppose we invert each input of a NAND. This example is straightforward if we don’t try to do too much in our head. First, we label the outputs of the inverters to be C and D. Then we construct a truth table showing A, B, C, D, and Q. We write down all possible combinations of A and B. Then we write down the results of the inverters at C and D. Then we write down Q by performing a NAND function on C and D. The result is shown below. We recognize that Q is simply A OR B. A NAND with both inputs inverted is simply an OR. Similarly, a NOR with both inputs inverted is simply an AND. A B C D Q C 0 0 1 1 0 A Q 0 1 1 0 1 D 1 0 0 1 1 B 1 1 0 0 1 We can do an even more complicated example (see below). As in the last example, we label all intermediate steps, in this case, the outputs of the two inverters, C and D, and the outputs of the two ANDs, E and F . We then work through the truth table, as shown below. When we are done, we recognize that Q is simply A XOR B. We have built an exclusive OR. A F D Q C B A 0 0 1 1 B 0 1 0 1 C 1 1 0 0 D 1 0 1 0 E 0 1 0 0 F 0 0 1 0 Q 0 1 1 0 E The two most common families of digital ICs are TTL (transistor-transistor logic) and CMOS (complementary MOSFET). The TTL ICs are made of BJTs. Each input is connected to the base of a BJT in the IC. If an input is not connected to anything, it usually “floats” up to 2 or 3 V and is interpreted by the IC to be a logical 1. The CMOS ICs are made of MOSFETs. The inputs have very high input resistance and must be protected against static charge. They require much less current than TTL. Notes for Lab 10, Digital Gates 139 Digital ICs are labeled with an alphanumeric code. This code indicates the function of the IC as well as its family. For example, the 7400 is standard TTL using BJT technology and contains four NAND gates. The 74LS00 also contains four NANDs in the same configuration, but the LS indicates that the circuit is low-power Schottky TTL. This is a popular type of TTL IC. It requires less power than the 7400. The 74HCT00 uses CMOS technology and also contains four NANDs in the same configuration. All of these ICs have the same pinouts and are usually interchangeable in a circuit. The 74xx families of digital gates usually define a “0” to be an input voltage between 0 V and 0.8 V. A “1” is an input voltage between 2 V and 5 V. For the outputs a “0” is 0 V to 0.5 V and a “1” is 2.7 V to 5 V. There are several combinations of letters that may be present after the “74” in the number. You have already been introduced to “LS” and “HCT.” You may also find “L” (low-power), “H” (high-speed), “S” (Schottky), “F” (fast), “ALS” (Advanced low-power Schottky), and “AS” (Advanced-Schottky). Each of these variants has particular characteristics with respect to power consumption and switching speeds but they are usually interchangeable for general use. Name In-Class Exercises for Lab 10: CID Digital Gates 1. In the space below, design transistor circuits (with NPN transistors) that perform each of the following three logic operations: NOT, AND, OR. 2. The truth table below includes each of the 16 possible two-input (A,B) binary logic functions. In the space below each column (you may need to write sideways), assign a name to the function in terms of NOT, AND and OR operations. Q0 is FALSE and Q15 is TRUE. A 0 0 1 1 B 0 1 0 1 Q0 0 0 0 0 Q1 1 0 0 0 Q2 0 1 0 0 Q3 1 1 0 0 Q4 0 0 1 0 Q5 1 0 1 0 Q6 0 1 1 0 Q7 1 1 1 0 Q8 0 0 0 1 Q9 1 0 0 1 Q10 0 1 0 1 Q11 1 1 0 1 Q12 0 0 1 1 Q13 1 0 1 1 Q14 0 1 1 1 Q15 1 1 1 1 3. Complete the truth table for the circuit shown below. The circuit is called a full adder because it adds two binary digits A and B (from two different binary numbers) as well as a carry bit Ci−1 from the addition of the previous two digits and produces their sum and a carry bit (Ci ) to be applied to the next two digits. intermediate values Ai Bi Ci-1 Si Ci 141 Ai 0 0 1 1 0 0 1 1 Bi 0 1 0 1 0 1 0 1 Ci−1 0 0 0 0 1 1 1 1 Si Ci Lab 10 Exercises: Digital Gates 1. Find the 7414 IC in your lab kit. This IC contains six inverters. The connections from these inverters to the pins is shown on the pinouts sheet in your manual. Connect the input of one of the inverters in this IC to a push-button switch as shown below. The switch should connect the inverter input to 5 V when pressed and to ground when released. You should use an ohmmeter to determine which leads of the switch perform these functions before you connect the switch to the circuit. (The black wire on the switch does not mean ground.) Write on the circuit diagram the colors of the three wires you determined. Ask a TA to check your result before you connect the switch to the circuit. Connect the output of the inverter to an LED as shown below. The LED should go on when the output of the inverter is logical 1. Don’t forget to connect the appropriate pins of your IC to 5 V and ground to power it. 5V 1k LED When the switch is released, the LED should be on. When you press the switch, the LED should go off. 1 2. Repeat exercise 1 for an AND gate. There are two push-button switches in your lab kit. Connect each of them to an input of an AND gate. Now the LED should not go on unless both switches are pressed. 1 3. Construct an XOR gate using the circuit shown in the notes for this lab. Connect a push-button switch to each input, and connect an LED to the output, as in exercise 1. 2 Additional exercises on the next page 143 Exercises for Lab 10, Digital Gates 145 4. Design and construct a circuit with two inputs, A and B, and four outputs, Q0 , Q1 , Q2 , Q3 . The circuit should obey the following truth table. This circuit is called a decoder and allows you to turn on a separate output based on what binary number is encoded in the two digits A and B. Hint: The logical statement to produce line Q1 is [A AND (NOT B)]. One way of building this circuit involves 4 AND gates and 2 inverters, although there are other ways to do it as well. B A Q0 Q1 Q2 Q3 0 0 1 0 0 0 0 1 0 1 0 0 1 0 0 0 1 0 1 1 0 0 0 1 Connect A and B to push button switches, and connect the four outputs Q0 , Q1 , Q2 , Q3 to LEDs as in exercise 1 so that the truth table can be easily verified. 3 5. (a) We want to investigate the effect of propagation delay in a digital circuit. Use a 7414 IC and wire the output of each inverter on the IC to the input of the next inverter until you have six inverters in series, as in Fig. (A) below. Put a 10-kHz signal from the TTL output of the signal generator into the first of the inverters. Display on the oscilloscope simultaneously the signal into the first inverter and the signal from the last inverter. Trigger on the input signal and look very closely at the first transition you see on the scope. Measure and record the propagation delay (the delay between a change in the input and the response in the output) per TTL inverter. (A) signal from signal generator signal out to scope (b) Now disconnect the signal generator from the first inverter and connect the output of the fifth inverter in the chain to the input of the first inverter, as in Fig. (B) below. Display on the oscilloscope the signal from the sixth inverter and explain what you observe. How is the period of oscillation related to the propagation delay of a single inverter? Now feed the output of the sixth inverter rather than the fifth inverter back into the first inverter. How is the output of the sixth inverter different than before? Why? signal out to scope (B) 3 Additional exercises on the next page Exercises for Lab 10, Digital Gates 147 6. Optional: Use AND, OR and NOT gates to design and build a data-selector with two binary data inputs, A and B, a logical selector input S, and a logical output Q. The circuit should behave so that setting S = 0 causes Q = A, and setting S = 1 causes Q = B. Hint: The circuit may have some similarities to the XOR gate in the previous exercise. Lab 11 Flip Flops Notes for Lab 11: Flip Flops The symbol for a type-D flip-flop is shown below. S Q D >CLK Q R The flip-flop has two outputs, Q and Q. The Q output is simply Q inverted. If Q = 1, then Q = 0. If Q = 0, then Q = 1. The flip-flop is positive-edge triggered, i.e., when the clock input makes a transition from 0 to 1. D is the data input. Whenever the flip-flop is clocked, whatever is at D is transferred to the Q output. D only affects the output at the instant when the clock goes from 0 to 1. The output then “stores” the value of D until the next time the clock triggers the flip-flop. S is the set (or preset) input. Whenever S = 0, we have Q = 1, no matter what D is or what the CLK input is doing. R is the reset (or clear) input. Whenever R = 0, we have Q = 0, no matter what D is or what the CLK input is doing. In order for the CLK input to be enabled, both S and R must be 1. Often, we just connect the S and R inputs to 5 V. The little circles on the S and R inputs indicate a logical NOT function. The circle indicates that we set or reset the flip-flop with a 0. If the circle were not present in the symbol, we would know that we set or reset the flip-flop with a 1. The symbol tells us how to set or reset the flip-flop without having to read a description of the IC. A flip-flop can be used to capture the state of a data line at a given instant. When the flip-flop is clocked, the value at D is captured and sent to Q. It is held there, no matter what D does next, as long as we don’t clock the flip-flop again. This function is called a latch. If we connect several flip-flops together, as shown below, we have a shift register. data in D >CLK Q D Q D >CLK >CLK Q D Q data out >CLK clock Note that the S and R inputs are not shown. We assume that they are connected to 5 V. All clock inputs are tied together so that all of the flip-flops are clocked at the same time. 151 152 Notes for Lab 11, Flip Flops When clocked, the first flip-flop sends the data input to its Q output. Note that the Q output of the first flip-flop is connected to the D input of the second flip-flop. When the second flip-flop is clocked, it captures the Q output of the first flip-flop before it has a chance to send its D to its Q. There is a delay between the time of the clock transition and the time that D is finally sent to Q. By the time that the first flip-flop has sent its D to its Q, the second flip-flop has already captured its D. The same is true of each flip-flop in the chain. Each flip-flop captures the output of the previous flip-flop, and then each flip-flop sends that value to its own output. The shift register can be used to store a binary number. For example, suppose we want to store 1010. We send a 0 to the data input and then clock the flip-flops. The 0 is now at the output of the first flip-flop. We then send a 1 to the data input and clock the flip-flops again. The 0 is now at the output of the second flip-flop, and the 1 is at the output of the first flip-flop. We repeat this procedure, sending another 0 and then another 1, each followed by a clock, so that finally 1,0,1,0 are at the outputs of the first, second, third, and fourth flip-flops, respectively. We can retrieve the number we have stored by clocking the flip-flops some more times. Each time we clock the flip-flops, the next digit appears at the data output. The following is a divide-by-two counter. D >CLK Q Q Suppose that initially Q = 1 and Q = 0. Then D = 0, and when the flip-flop is clocked, this value will be sent to the output, and now Q = 0 and Q = D = 1. Note that the sequence of events is important here. The value at D is captured by the flip-flop before it is sent to the output. By the time Q changes, D has already been captured, and the new value of Q will not be captured until the next time the flip-flop is clocked. The next clock sends the new value of D to the output, and we have Q = 1 and Q = 0 again. If the input is a square wave, the output will also be a square wave, but with half the frequency, as shown below. Note that the output toggles only on the positive-going edge of the input. input output We can connect N flip-flops together and obtain a divide-by-2N counter. With four flipflops, as shown below, we have a divide-by-16 counter. Notes for Lab 11, Flip Flops D input >CLK Q Q Q D >CLK Q D >CLK Q Q 153 D >CLK Q output Q 1 th If the input is a square wave, the output will be a square wave, but with 16 the frequency. Suppose we monitor the Q output of each flip-flop in the chain. We will call the output of the first flip-flop Q0 , the output of the the second flip-flop Q1 , etc. input Q0 Q1 Q2 Q3 The signal that clocks a counter can either be generated by another digital circuit element, or by a manual switch. Manual switches (e.g., buttons, dials, flip switches) tend to deliver lousy clock signals due to a phenomenon called “bounce”. When the switch is thrown from ground to 5 V, the moment of signal lead must first break contact with ground and then make contact with 5 V. This transition is anything but clean, and often produces a confused intermediate state that effectively oscillates back and forth between 0 and 5 V many times. The same can also happen when the switch is thrown back to ground. When this happens, a single flip of the switch can advance the clock through many (possibly hundreds) of cycles. 5V >CLK There are a variety of “debouncing” strategies available, though we will discuss only one: the SR latch. This device can either be constructed from two NAND gates (the circuit below on the left) or from the S and R inputs of a flip-flop (the circuit on the right), and never requires you to leave a friend stranded in the forest. 154 Notes for Lab 11, Flip Flops 5V 1k 5V 1k A Q S 5V Q 5V Q >CLK 1k 1k B R C In the NAND-gate circuit on the left, intermediate points are labeled as A, B, and C for convenience. With the switch in the position shown in the figure, A is connected to 5 V through a 1-k resistor and is therefore 1, and B is grounded through the switch and is therefore 0. If B = 0, then C = 1, no matter what Q is. Since both inputs of the upper NAND are 1, we have Q = 0. Now suppose we throw the switch. As the switch is traveling, neither A nor B are grounded by the switch and are therefore both 1. Since Q = 0, C is still 1, even though B is now 1. And since both inputs to the upper NAND are still 1, Q is still 0. In other words, nothing happens. When the switch first touches the upper contact, A goes to 0. This causes Q to go to 1. Since both inputs of the lower NAND are 1, we have C = 0. If the switch bounces, A will go back and forth between 0 and 1. But this has no effect. Now that C = 0, one of the inputs of the upper NAND is 0, and Q will stay at 1, no matter what A does. Q cannot change back to 0 until the switch is thrown again and touches the lower contact. Using similar arguments, we can show that bounce on the lower contact also has no effect on Q. This latch completely removes the bounce from the switch. When we throw the switch, Q makes a single transition from 0 to 1 or from 1 to 0. In the SR latch on the right, the clock is grounded. Pulling the switch upward causes Q = 1 the instant that S first becomes grounded. The state won’t change again, regardless of the subsequent behavior of S until the switch is pulled downward, which causes Q = 0 the instant that R first becomes grounded. In practice, either circuit does an adequate job of switch debouncing. Name In-Class Exercises for Lab 11: CID Flip Flops 1. Use the figures in the lab notes to make a chart of the values of each of the four flip-flop outputs during each of the 16 clock cycles of a divide-by-16 counter. Start with all-zero outputs. Why do you think we call this circuit a “counter”? 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Q0 0 Q1 0 Q2 0 Q3 0 2. Design and draw a four-bit shift register that recycles its data rather than bringing it in and out. Include an LED on each Q output and a push-button switch for injecting the bit pattern into the register. Make sure that your switch doesn’t do battle with any of the flip-flop outputs. 3. The following circuit is an RS switch debouncer. Start in the state shown, with the switch connected to the top terminal, and consider what happens at points A, B, Q and Q as the switch first touches the bottom contact and then briefly bounces (i.e., breaks and makes contact many times). Similarly, follow the switch back up to the top terminal and let it bounce again. Fill in the table below. 5V 1k A A Q 5V 1k Switch Switch Switch Switch Switch up moved down bounces moved up bounces Q B Additional exercises on the next page 155 B Q Q In-Class Exercises for Lab 11, Flip Flops 157 4. Use logic gates and four flip-flops to make a shift register that can be parallel-loaded. The circuit will have the normal D and CLK inputs as well as a parallel-load input PL and four inputs L0 -L3 , When PL is low, the shift register should function normally. When PL is high, either the S or R inputs on each flip-flop should go low depending on the value of their respective L input, “loading” that value to the flip-flop. The best implementation of this uses one inverter, four OR gates and four NAND gates, but there are many other working implementations as well. Lab 11 Exercises: Flip Flops In this lab, whenever we tell you to connect an input to a switch, we mean to wire the switch so that when it is released, the input is connected to ground, and when it is pressed, the input is connected to 5 V. 1. Find the 7474 IC in your lab kit. This IC contains two type-D flip-flops. The connections from these flip-flops to the pins is shown on the pinouts sheet in your packet. Connect 5 V and ground to this IC. Connect the S and R inputs of one of the flip-flops to 5 V. Connect the CLK and D inputs to switches. Connect the Q and Q outputs to LEDs. Press the switch connected to CLK. The LED connected to Q should go off, and the LED connected to Q should go on. Now press the switch connected to CLK again, this time while holding down the switch connected to D. The LED connected to Q should go on, and the LED connected to Q should go off. 2 2. (a) Using four flip-flops (two 7474 ICs), make a 4-bit shift register as shown in the notes for this lab. Use a 1-Hz TTL signal from the signal generator as the clock signal, and use a push-button switch (5 V when pressed, ground otherwise) to set the input values. Use LEDs to display the values of each of the Q outputs of the shift register. 2 (b) Optional: Connect the Q output of the last flip-flop to the input of the first flip-flop so that the shift-register can recycle its data. Find a way to use the switch to continue injecting data values into the register without doing battle with any of the flip-flop outputs (i.e., do NOT connect the switch directly to an output). Demonstrate that your circuit works as expected. Hint: remember the S and R pins. 3. Construct a divide-by-16 counter, using four flip-flops, as shown in the notes. There are two 7474s in your lab kit, each of which contains two flip-flops. Connect a 16-kHz square wave to the input. The signal emerging from the last flip-flop should be a 1-kHz square wave. Use the oscilloscope to simultaneously view both signals. Then use an LED to display each of the Q outputs and verify the the counter is counting from 0 to 15 in binary. 3 4. Replace the TTL input signal to your divide-by-16 counter with a push-button switch (5 V when pressed, ground otherwise), and attempt to increment the counter manually. Does the result appear random? If so, you have switch bounce problems. Use two NAND gates to convert your switch into a bounceless switch. Verify that your counter can now be incremented from 0 to 15 in a controlled way. 3 159 Lab 12 Counters and Displays Notes for Lab 12: Counters and Displays The symbol below represents a divide-by-16 counter. The four logic outputs (Q0 , Q1 , Q2 , Q3 ) form a four-bit binary number that runs from 0 (binary 0000, hex 0) to 15 (binary 1111, hex F). Q0 Q1 Q2 >CLK Q3 R The 4-bit output advances by 1 each time the clock (CLK) input is triggered. After reaching the maximum value (binary 1111, hex F), the outputs all start over at zero on the next clock cycle. Typically, the counter is triggered when the CLK input passes from LOW to HIGH. Some ICs, however, are specifically engineered to trigger on a HIGH to LOW transition. Counters can be “chained” in series to provide a larger counting range. This can be accomplished by connecting the Q3 output of one 4-bit-counter to the clock input of the next 4-bit counter as shown below. More sophisticated ICs have a “carry” input and output that allow one counter to advance the next counter each time it passes from its maximum value back to zero. Chaining two 4-bit (divide-by-16) counters together yields an 8-bit (divide-by-256) counter that starts at 0 (binary 00000000, hex 00) and ends at 255 (binary 11111111, hex FF). Q0 Q1 Q2 Q3 clock Q4 Q5 Q6 Q7 Q0 Q1 Q2 Q0 Q1 Q2 >CLK Q3 >CLK Q3 R is the reset input of the counter. When R = 0, the counter functions normally. When R = 1 (no circle on this input), the counter resets to Q0 = Q1 = Q2 = Q3 = 0 and stays there until R = 0 again. While R is usually connected to ground, some applications require it to be used for control purposes. For example, consider the following circuit. Q0 Q1 clock >CLK R 163 Q0 Q1 164 Notes for Lab 12, Counters and Displays The instant that the output advances to Q0 = Q1 = 1, the AND gate sends a 1 to the reset input, which causes the counter to be immediately reset. Thus, the output never reaches 3 (binary 11), but instead counts as . . . 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2 . . . This is a divide-by-3 counter. Similarly, we could divide by any other integer by wiring an appropriate logic combination to the reset input. Some 4-bit counter ICs come internally wired for division. Divide-by-10 (“decade”) and divide-by-12 counters, for example, are quite common. Just as divide-by-16 counters can be chained together, two decade (divide-by-ten) counters can also be chained to build a divide-by-100 counter. Such a circuit requires special consideration. Because the four-bit output of each decade counter has a maximum value of 9 (binary 1001), the maximum value of a divide-by-100 counter is 99, which is then represented as 10011001. But wait. 100110012 is 15310 and not 9910 . Because this interpretation of an 8-bit output is inconsistent with the binary number system, we give it a special name, “binary-coded-decimal” (BCD). For BCD displays, each set of four bits represents one decimal digit. In many electronic devices, binary numbers are displayed as hexadecimal digits with a device known as a “7-segment display.” In the figure below, the seven segments of the display are LEDs. In practice, most devices (e.g., watches and calculators) now use liquid crystal display (LCD) elements, which draw far less current than LEDs. The 4-bit binary input D0 , D1 , D2 , D3 goes into a “decoder” chip, whose job is to determine the corresponding hexadecimal digit and to selectively illuminate the display segments that best represent it. The number “4”, for example, is displayed by illuminating segments B, C, F and G. Study the figure and observe that each of the hexadecimal digits [0-F] can be displayed. We typically use a lower-case “b” and “d” to distinguish them from “8” and “0”, respectively. Decoder D0 D0 D0 D0 A B C D E F G Display A B C D E F A F B G E G C D GND The 7-segment display is only one of many devices for displaying a number. In the lab exercises below, you will use a 10-element LED bar graph for which the nth of 10 LEDs indicates the number n. Each type of display device needs a corresponding decoder that knows how to convert binary numbers into the format required by the display. Name In-Class Exercises for Lab 12: CID Counters and Displays 1. Use a 4-bit counter and logic gates to design a divide-by-6 counter. Draw your circuit in the space below. 2. Use a 4-bit counter and logic gates to design a divide-by-10 counter. Draw your circuit in the space below. 3. Fill in the table below. Digits 00010001 00000011 10010110 01011101 11111111 Binary-Decimal interpretation 17 BCD-Decimal interpretation 11 4. Fill in the table below. Decimal 17 3 150 93 255 8-bit binary 00010001 165 8-bit BCD 00010111 Hex 11 Lab 12 Exercises: Counters and Displays Do not take your counter circuit apart after building it! It will be used as part of the future audio-amplifier lab. If you follow these instructions carefully, you will be able to build your audio amplifier entirely on one breadboard. This will leave your second breadboard for the final exam in case you don’t want to disassemble the amplifier after you complete lab 13. 1. (a) First, we need to set up the power supply rails. Orient your board vertical with the text on the board right-side up and the row labeled “1” at the top. You should attach 5 V to the two red (“+”) supply rails. Attach ground to the two blue (“-”) supply rails. You should have a jumper connecting the two red rails and another connecting the two blue rails. Don’t turn on the power supply yet. (b) Locate the following parts in your kit and arrange them carefully onto your breadboard. First place the 74193 (4-bit binary up/down counter) with pin 1 in the upper left-hand corner and located in row 28. Below the 74193 place the 74154 (4-bit decoder) with pin 1 in the lower right-hand corner and located in row 50. This should leave three blank rows between the 74193 and the 74154 (rows 36, 37, and 38). The placement of the 74154 is quite critical for later exercises. Below the 74154 place the 7474 (D-type flip flop) with pin 1 in the upper left-hand corner. Above the 74193 place a 7408 (AND gate) with pin 1 in the upper left-hand corner and the LED bar graph with the notched corner in the upper left-hand corner. (c) Connect the proper pins on each IC to power and to ground. Connect the cathodes (i.e., negative sides) of the first four (closest to the 74193) bar graph LEDs together and then connect them all to ground with a single wire – if the notch is in the upper-left-hand corner, then the cathodes are on the right-hand side of the IC. Don’t connect any power to the LED bar graph. Have your TA check your board before turning the power on! Upon powering up, immediately check each IC for signs of overheating. If you detect a problem, quickly power down and reexamine your connections. Additional exercises on the next page 167 1 Exercises for Lab 12, Counters and Displays 169 2. Connect the binary outputs of the counter to the first four LED inputs on the bar graph. You probably want to put them in order according to Q0 , Q1 , Q2 , and Q3 . Use a 1-Hz signal from the TTL output of your signal generator to trigger the Count-Up (CPU) clock input of the counter. Each of the Master Reset (MR), Parallel Load (PL), and Count-Down (CPD) pins must either be connected to 5 V or to ground. Study pages 5 and 6 of the 74193 data sheet to learn how to configure these inputs for count-up operation. Verify that the display is counting from 0 to 15 in binary. 3. (a) Remove the wires connecting the Q0 -Q3 outputs of the counter to the LED bar graph, and use them instead to connect the Q0 -Q3 outputs of the counter to the A0 -A3 inputs of the decoder. We are going to use an unusual way to attach the LED bar to the 74154, but it will save you a lot of wiring. Remove the bar graph from your board. Rotate it so the notch is in the lower right corner and move it down to the right of the 74154. You want to place it so that pins 1-10 (the anodes) plug into the 5/,V bus on the right (the red one). Pin 1 should line up with row 49 on the board – the same row where pin 2 of the 74154 is located. In this position the LEDs will attach to pins 2-11 (Y 1 through Y 11) on the 74154. You will notice that there is not a hole in the breadboard for pin 6 on the bar graph. We cure this by carefully bending pin 6 so that it lays next to, and in contact with, pin 5. Try not to bend the pin where it exits from the plastic case. If you leave a little space you will get a gentler curve in the wire and avoid breaking it off. This orientation is chosen because the decoder outputs are active low rather than active high, and this will allow the current to flow from the 5 V rail to the 74154 outputs to illuminate the LEDs on those outputs that are active. (b) Study the 74154 data sheet in order to correctly wire the enable pins (E1 and E2) of the decoder to either 5 V or ground. Use a 1-Hz TTL signal to clock the Count-Up input of the counter. The 10 bar graph LEDs should now repeatedly light up in sequence from bottom to top. Why are the LEDs all off for a time before the cycle repeats itself? (c) Use AND gates (7408) in conjunction with the MR input of the counter IC to convert your divide-by-16 counter into a divide-by-11 counter. Again using the 1-Hz TTL signal to clock the counter, verify that the counter resets to 0 instead of advancing beyond 10. Note: Due to the vagaries of gate delays you have to order the AND gates properly to get this to work. The most rapidly varying output, Q0 in this case, must be connected to one of the inputs on the AND gate whose output is actually connected to the MR input of the counter IC. Additional exercises on the next page 2 Exercises for Lab 12, Counters and Displays 171 (d) There’s a more elegant way to prevent the counter from resetting when it advances beyond 10. First, remove the AND gate and associated wires from the breadboard. Replace this IC with a 7414 (hex inverter). Then connect the Y11 output of the decoder to the MR input of the counter through an inverter. The inverter is necessary because the decoder outputs are active low, whereas the MR input is active high. Verify that the counter operates as before. Note: If you want to save space on your board you can replace the one gate of the 7414 that we are using with a 2N3904 transistor. This transistor will fit nicely in the three rows between the 74193 and the 74154. You will need to consider carefully how a single NPN transistor can be used to invert a signal. It will require a 1 kΩ resistor in series with the base of the transistor to limit the base current and a 1 kΩ pull-up resistor between the collector of the transistor and 5 V. 3 4. (a) Instead of using a TTL signal, wire a button switch to the Count-Up input of the counter so that the switch output is LOW when pressed and HIGH when released. Locate the switch at the bottom of the board below the 7474 flip-flops. Press the button a couple of times and watch the output of the LED bar jump randomly due to switch bounce problems. Then build an SR latch to debounce the switch and verify that releasing the button advances the counter by 1 in a controlled way. (b) Add a second debounced switch to clock the Count-Down input. You should now be able to increment the counter with one button and decrement it with the other. Additional exercises on the next page 2 Exercises for Lab 12, Counters and Displays 173 5. Instead of allowing the counter to cycle around when it reaches an endpoint (from 10 to 0 or from 0 back to 15), we now want it to simply stop at the endpoint. Imagine being magically confined to your bedroom (by an angry parent, roommate or spouse) so that every time you set foot outside, you immediately find yourself just inside the door again. That’s the idea. On the low end, detach the Y11 decoder output from the inverter (or the base of the 2N3904 transistor) and replace it with the Y15 output. On the high end, we will use the parallel-load (P L) feature of the counter to reload the value 10 whenever it attempts to advance to 11. Connect the counter’s parallel (D0 -D3 ) inputs to 5 V and ground in such a way as to represent the decimal value 10 in binary. Then connect the Y11 decoder output directly to the P L input. The completed circuit will appear as shown below. Verify that the counter is now confined to the range from 0 to 10 and unable to cycle around at the endpoints. Explain the operation of the new features to your TA. Do not disassemble this circuit. It will serve as the digital volume control for your audio amplifier in Lab 13. 74193 D0 D1 D2 D3 Q0 Q1 Q2 Q3 switch CPU switch CPD PL MR 74154 A0 A1 A2 A3 E1 E2 Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7 Y8 Y9 Y10 Y11 Y12 Y13 Y14 Y15 DC10EWA VCC 2 Lab 13 Audio Amplifier Notes for Lab 13: Audio Amplifier In this lab, you will take a relatively weak signal from a high-impedance output device (portable music player) and use it to drive a low-impedance input device (loudspeaker). In the past, you have connected small speaker drivers to a variety of output devices including a signal generator, a transistor voltage follower and an op-amp voltage follower. In each case, the output device was less than equal to the task, either because of high output impedance or intrinsic current limitations. Most good loudspeaker drivers have very low input impedances (4 Ω or 8 Ω) and therefore require a source that has an exceptionally low output impedance as well as the ability to deliver a lot of current (and power). The output impedance of a line-level audio source from a DVD player or computer is often as large as 100 Ω (very bad). Even the output impedance of a source designed for headphones will be about 5 Ω, which is still comparable to the impedance of a loudspeaker. In order to match such a weak source to a heavy loudspeaker load, we will need an impressive power amplifier between them. For this lab, you will use an audio amplifier with an input impedance of 20 kΩ and an output impedance less than 0.5 Ω. You may opt to try stereo sound at the end of the lab, but will first be required to work with a single channel (i.e., mono). Some care must be taken in summing the two channels of a stereo signal into a mono signal. They cannot simply be connected together, which would cause one channel to fight against the other. In general, never directly connect two device outputs together which can cause a large current to flow out of one input and into the other. This not only causes substantial signal loss, but can also permanently damage (i.e., melt) your output device. One way to sum two signals is to use an op-amp summing amplifier. A simpler approach, however, is also effective and less prone to instability. Simply connect the stereo channels together through separate but equal resistors, and then pass the mono signal arising at the junction between these resistors on to the audio amplifier. Just make sure that resistor used on each output is far smaller than the 20 kΩ input impedance of the audio amplifier. The “dB” unit You have probably noticed that some of the operating characteristics of amplifiers are expressed in dB. The decibel (dB) is a logarithmic unit that expresses the relative magnitude (i.e., ratio) of two quantities. Because the response of the human ear to sound waves is approximately logarithmic rather than linear, the decibel is a natural and intuitive unit for describing sound wave amplitude (A) and intensity or power (I ∝ A2 ). It is also used in specifying electronic signals because it is easier to handle a large dynamic range with a logarithmic unit. 177 178 Notes for Lab 13, Audio Amplifier A decibel is 1/10 of a bel (note the deci- prefix), where a bel is the base-10 logarithm of the ratio of two signal intensities. If the gain of signal-transmission device is described as an output-over-input ratio of voltage amplitudes, the decibel gain can be computed as: Iout Iin ! A2out = 10 log10 A2in Aout . = 20 log10 Ain Gdb = 10 log10 When the denominator is a standard reference magnitude rather than an input, absolute measurements can be also be described in decibel units. In the case of sound intensity, the reference magnitude is the quietest sound that a typical human can hear. Because log10 (1) = 0, the decibel measure of the reference signal itself is defined to be 0 dB. Each successive 10-fold increase in the intensity of a signal increases its logarithmic value by 10 decibels. Thus, a 100-fold amplitude increase (a 10000-fold intensity increase) is also described as a 40 decibel increase. Though the fractional amplitude gain, Aout /Ain , and the fractional intensity gain, Iout /Iin , are not equivalent, we see that they both yield the same decibel gain. A Digital-to-Analog Converter for Volume Control The audio amplifier IC in your kit is unusual in that it has a volume-control pin that takes an analog input voltage. We plan to use this feature to adjust the volume of music delivered to a loudspeaker. The control voltage, however, comes from the digital 4-bit counter constructed in the previous lab. This will require us to construct a specialized circuit that accepts a digitally-encoded value (usually binary) as input and returns an analog voltage. We call such a device a digital-to-analog (D/A) converter, or simply a DAC. DACs can be found in many devices, particularly in any digital device that outputs analog audio, such as an mp3 player. DACs are available as single ICs that have N digital inputs and one analog output. The number of input bits determines how finely the output voltage can be specified. The DAC can specify 2N distinct voltages. These voltage levels are generally evenly distributed between the minimum and maximum output voltages. Notes for Lab 13, Audio Amplifier 179 The technique for building a DAC is reasonably simple. One of the simplest DAC circuits is the binary-weighted summing amplifier. R0 D0 R0/2 D1 R0/4 Rf D2 R0/8 D3 − Vout + Each of the four logical inputs, D0 , D1 , D2 , D3 , have two possible values: 0 or 5 V. We analyze this circuit by summing the current entering the point at Vin− and setting that sum to zero: D0 D1 D2 D3 Vout + 1 + 1 + 1 + =0. R0 Rf 2 R0 4 R0 8 R0 Solving for Vout , we obtain Vout = − Rf (D0 + 2D1 + 4D2 + 8D3 ) . R0 The minus sign reminds that this configuration is actually an inverting amplifier. Assuming that R0 = 5k and Rf = 1k, we calculate the analog output voltage below for every possible combination of digital inputs. D3 0V 0V 0V 0V 0V 0V 0V 0V D2 0V 0V 0V 0V 5V 5V 5V 5V D1 0V 0V 5V 5V 0V 0V 5V 5V D0 0V 5V 0V 5V 0V 5V 0V 5V Vo ut −0 V −1 V −2 V −3 V −4 V −5 V −6 V −7 V D3 5V 5V 5V 5V 5V 5V 5V 5V D2 0V 0V 0V 0V 5V 5V 5V 5V D1 0V 0V 5V 5V 0V 0V 5V 5V D0 0V 5V 0V 5V 0V 5V 0V 5V Vo ut −8 V −9 V −10 V −11 V −12 V −13 V −14 V −15 V Note that the value of Vout is numerically equal to the binary number represented by the four digits D3 D2 D1 D0 (except for the minus sign). For example, the binary number 1101 is equal to 13. Thus, when D0 , D2 , D3 are logical 1 (5 V) and D1 is logical 0, the output is −13 V. The circuit in the example above is a 4-bit DAC, and therefore has an output resolution of 1 part in 16. Similarly, an N -bit DAC would have an output resolution of 1 part in 2N . 180 Notes for Lab 13, Audio Amplifier By changing the values of the resistors above, we can easily change the output voltage range. For example, if we increase R0 to = 75 kΩ, then Vout would only get as large as −1 V. In general, we see that the output voltage is proportional to rather than equal to the binary number represented by the digital input. Consider the non-inverting summing amplifier circuit below, which also serves as a DAC. This circuit has the advantage that it can be powered with a positive voltage, and still produces a positive output voltage. Because the negative feedback loop has zero resistance, we could just as well call this type of DAC a non-inverting summing follower. R0 D0 R0/2 − D1 Vout + R0/4 D2 R0/8 D3 No current flows into the non-inverting input. The network of digital inputs and input resistors can be treated as a multi-resistor voltage divider that produces the desired output voltage. If you apply Kirchoff’s current law to the node attached to the non-inverting input of the op-amp, and rearrange the equations sufficiently, you arrive at the equation for the output voltage (D0 + 2D1 + 4D2 + 8D3 ) Vout = . 15 The result is, once again, a sequence of 16 uniform voltage steps from 0 to 5 V. The analog output of the DAC above swings between Vmin = 0 V and Vmax = 5 V. Your audio amplifier, however, has an analog volume-control input that requires a smaller voltage 0 0 ) than what the DAC provides. The three-resistor network below is a range (Vmin to Vmax relatively straightforward means of shrinking the output range on both top and bottom. VCC R0 D0 R0/2 D1 R0/4 D2 R3 − + Vout R1 V′out R2 R0/8 D3 To determine the resistor values required, use Ohm’s law to determine the current though each resistor, and recall that the total current flowing into a circuit node must equal the Notes for Lab 13, Audio Amplifier 181 total current flowing out of the node (Kirchhoff’s current law). With a DAC voltage of Vmax 0 coming in from the left and a modified voltage of Vmax going out on the right, we have 0 ) 0 ) 0 ) (VCC − Vmax (0 − Vmax (Vmax − Vmax + + =0. R1 R2 R3 0 Similarly, with Vmin coming in from the left and Vmin going out on the right, we have 0 ) 0 ) 0 ) (VCC − Vmin (0 − Vmin (Vmin − Vmin + + =0. R1 R2 R3 The first thing to notice about these equations is that there are three unknowns (R1 , R2 , and R3 ) but only two equations. We will only be able to find a solution involving ratios of the resistances because the system is underdetermined. The solution of these equations is tedious but can be done by hand with some effort. First, solve both equations for 1/R2 and set them equal. With some rearranging you arrive at 0 0 ) R1 (Vmax − Vmin = VCC . 0 0 V R3 (Vmax Vmin − Vmax min ) Next, you can select either of the original equations that have been solved for 1/R2 and 0 multiply that equation by R1 . If we choose the second equation involving Vmin and Vmin we get R1 VCC Vmin R1 = 0 + −1 −1. 0 R2 Vmin Vmin R3 Use the first expression to compute R1 /R3 , and then substitute the result into the second expression to obtain R1 /R2 . Though the overall scale of these resistor values is not fixed, their relative values are. The scale will be a compromise between three competing needs. First, the Thévenin-equivalent impedance of the modified output Rout = R1 ||R2 ||R3 , which will be somewhat smaller than the smallest of the three resistors, must be much smaller than the impedance of the amplifier’s volume-control input. Secondly, each resistor must be large enough to prevent excessive V 2 /R power consumption. Thirdly, you have to choose available values for the three resistors, understanding that you may have to use series or parallel resistors to arrive at the desired values. Name In-Class Exercises for Lab 13: CID Audio Amplifier 1. An amplifier receives a sinusoidal input signal whose rms amplitude is 0.1 V and produces a sinusoidal output signal whose rms amplitude is 10 V. What is the fractional gain? What is the decibel gain? 2. (a) Choose resistor values for a 4-bit inverting summing amplifier that will yield an output range 0 to −5 V as the digital inputs vary from 0000 to 1111. Assume that digital High and Low are 5 V and ground, respectively. (b) What voltage range is realized if the digital inputs can only go up to 1010? Additional exercises on the next page 183 In-Class Exercises for Lab 13, Audio Amplifier 185 3. (a) Suppose that we have a 4-bit DAC based on the non-inverting summing follower in the notes. What voltage would you expect to see at the output when the digital inputs are 1010? (b) Assume that digital High and Low are 5 V and ground, respectively. Draw the corresponding four-resistor voltage divider between 5 V and ground, and demonstrate that it produces the expected voltage. 4. Given a DAC output that swings between Vmin = 0 V and Vmax = VCC , we want to 0 0 < Vmax instead. Study modify that output to swing between Vmin > Vmin and Vmax the datasheet for the TDA7056B audio amplifier, and figure out what range of voltages should be applied to the volume-control (VC) pin in order to utilize the entire linear0 output range. Choose a minimum voltage Vmin that is about 0.05 V below the cutoff voltage so that the volume can be turned completely off, and choose a maximum 0 , voltage Vmax that is about 0.05 V beyond the top of the linear range. At VC = Vmax what does the figure predict for the fractional amplitude gain? Record your result here in the lab manual. 0 0 5. Let Vmin and Vmax be the range from 0 V to 3.3 V (digital 1010). Let Vmin and Vmax be the modified values obtained from exercise 4. Using the equations in the notes, determine the seven numerical resistor values that should be used for the DAC and the output modifier. Are any of the values arbitrary (i.e., not fixed by the problem)? If so, what practical constraints might we apply? Lab 13 Exercises: Audio Amplifier The counter and display breadboard from lab 12 should still be assembled for use in this lab. 1. Power up your counter circuit from the previous lab and make sure that it still works (be careful not to get VCC and ground mixed up). Position the breadboard vertically with the text right side up again. The 74154 and the LED bar graph should be in the lower half of the breadboard. Find the regulated 9-VDC “wall-wart” power supply in your kit, and use a multimeter to determine which of two leads (striped or plain) is 9 V and which is ground. Use tape to label the two leads (manufacturers are not consistent in choosing which lead to stripe). 2 2. (a) Using the circuit diagram in the notes, build a non-inverting summing amplifier (DAC) just above the 74193 and use it to convert the 4-bit digital output of the counter into an analog output that increments from 0 to 5 V in 24 = 16 uniform steps. Place the TL3472 op-amp just above the 74193 on the board. If you are VERY careful in how you lay out your resistors for the summing amplifier you will only need two rows between the 74193 and the TL3472. Do NOT place the amplifier in any of rows 1-10. Based on your rather limited collection of resistors, we recommend the following resistor combinations: 4 kΩ = 3.9 kΩ + 100 Ω, 8 kΩ = 6.8 kΩ + 1.2 kΩ, 16 kΩ = 15 kΩ+1 kΩ, and 32 kΩ = 22 kΩ+10 kΩ. All four resistor paths should connect to the same row on the breadboard. Use wires to connect each resistor combination (D0 , D1 , D2 , and D3 of the DAC) to the corresponding counter output (Q0 , Q1 , Q2 , and Q3 ). Power the TL3472 op amp with VCC+ = 9 V and VCC− = 0 V. At this point you will just connect the 9 V output from the “wall-wart” power supply directly to the appropriate pin on the TL3472. (b) In order to allow the counter to cycle through the natural range from 0 to 15, temporarily move either of the E1 and E2 enable pins of the decoder from ground to 5 V (i.e., disable the decoder), and temporarily disconnect the CPU clock input of the counter from its debounced switch, clocking the counter with the signal generator (TTL output) instead. (c) Using a 1-kHz clock signal, view the analog output of the DAC with the oscilloscope. You should see a voltage staircase that runs from 0 to 5 V. If the voltage increments are not uniform, you may need to further fine-tune your resistor combinations. If the staircase is fuzzy, add a 0.1 µF capacitor between VCC (9 V) and ground. Show the output to your TA. Additional exercises on the next page 187 4 Exercises for Lab 13, Audio Amplifier 189 3. (a) Reverse the changes made in step (b) of the previous exercise, which will restore the counter to its normal mode of operation. Verify that the button switches now allow you to manually step the analog output between 0 and (10/15) ∗ 5 = 3.3 V. (b) This analog output will eventually be used to control an audio amplifier (TDA7056B) that accepts a volume-control input voltage. Refer to Fig. 3 on page 6 of the audio amplifier datasheet in order to identify the range of control voltages that produce a linear response. Record these voltages here in your lab manual. Choose a minimum voltage Vmin that is about 0.05 V below the cutoff voltage so that the volume can be turned completely off, and choose a maximum voltage Vmax that is about 0.05 V beyond the top of the linear range. At Vmax , convert the decibel gain into a fractional amplitude gain and record the result here. (c) Using a network of three resistors as illustrated in the notes, convert the summing amplifier output (0 to 3.3 V) into a voltage that varies from Vmin to Vmax . As you determine the resistance values (R1 , R2 , R3 ), try to keep all of the values in the range between 100 Ω and 5 kΩ. Verify that the modified output now has approximately the desired range. 4. (a) Caution: Read the following instructions before you begin. You don’t want to destroy your most expensive IC. Power down the breadboard and insert your audio amplifier IC (TDA7056B). Ground the power ground (PGND) and signal ground (SGND) leads close together with short wires. Connect power (VP) to 9 V (i.e., connect a jumper from the 9 V supply attached to the TL3472 to the correct pin on the TDA7056B). For improved stability, connect a small 0.1 µF capacitor and a large capacitor (use 100 µF rather than 220 µF) between VP and ground as shown in Fig. 13 of the amplifier datasheet (be sure to read the footnote). Connect the modified DAC output from the previous exercise to the volume control (VCTRL) pin. Also connect a 1 µF capacitor between VCTRL and ground (as shown in Fig. 14). Note that Fig. 14 illustrates a far simpler method of volume control. Unbias (i.e., remove any DC voltage components) the signal input (VIN) by attaching a capacitor (use 0.1 µF rather than 0.47 µF) in series and a resistor (use 10 kΩ rather than 5 kΩ) to ground as shown in Fig. 13. In subsequent exercises, we will always send the input signal into this anti-bias capacitor rather than directly to the VIN pin. The signal generator has a HI-voltage output (0 to 10 V) and a LO-voltage output (0 to 100 mV). Connect the LO output of the signal-generator to the unbiased audio input of the amplifier – don’t bypass the capacitor. Be very careful NOT to accidentally send a high voltage (> 1 V) into the audio input, which could damage the amplifier. Show your TA before powering up again. Additional exercises on the next page 4 Exercises for Lab 13, Audio Amplifier 191 (b) Simultaneously view the audio input (VIN) and output (OUT+) signals relative to ground on channels 1 and 2 of the oscilloscope. Adjust the 1-kHz input signal to be 100 mV peak-to-peak. Use the counter to step the amplifier gain up and down between its limits and observe the gain variation with the oscilloscope. Do NOT attach the ground lead of the oscilloscope to OUT−. This lead really is ground; and forcing OUT− to ground triggers an MCL sensor (see page 2 of the datasheet) that temporarily disables the IC. Just be content to observe only half the output signal. (c) Use the counter to set the amplifier gain (VCTRL) to its maximum value (Vmax ). Measure the fractional amplitude gain (Vout /Vin ) and then double it to account for the fact that you are only looking at half the signal. Compute the corresponding decibel gain and compare your result to what you should expect based on Fig. 3 of the amplifier datasheet. 4 5. Construct a 5 V power source on the breadboard using the 5 V regulator chip (78L05) in your kit. Connect IN to 9 V, GND to ground, and OUT to an unused row of the breadboard. Measure the 5 V output of the regulator with a multimeter to ensure that it is working properly. If so, completely disconnect the breadboard from its large external 5 V power supply, and connect the 5 V rails to the OUT pin of the regulator instead. Hint: if you place the 78L05 along the left side of the board and consider the pin connections you should be able to build the power supply using a single row of the board and the OUT pin will be in the 5 V rail of the breadboard. You may want to test the 78L05 using 3 rows of the board and then transfer it to a single-row configuration after you are sure it is working correctly to prevent applying the wrong voltage to your digital ICs. Now you are powering the entire audio amplifier circuit with the wall-wart. The regulator is necessary because the digital ICs would be damaged if you attempted to power them with 9 V. Verify that your circuit still functions as before. Then disconnect the signal generator from the circuit. Additional exercises on the next page 3 Exercises for Lab 13, Audio Amplifier 193 6. (a) Insert a 1/8-inch stereo-input jack close to your audio amplifier. Ground its ground lead (improve stability by connecting it directly to the SGND pin of the amplifier), and use separate 1-kΩ resistors to connect each of its channels to the unbiased audio input of the amplifier. Use a 1/8-inch stereo cable to connect a portable music player to your amplifier. Set the player volume to a reasonable listening level and simultaneously view the amplifier input (VIN) and output (OUT+) on the oscilloscope. Estimate the average peak-to-peak input voltage. (b) Turn the the audio amplifier gain all the way down and disconnect the oscilloscope from the circuit. Then connect an 8-Ω loudspeaker across the OUT+ and OUT− pins of the amplifier. Slowly turn the gain back up again. If you have good taste in music, you should now find yourself in a transcendental state of aural bliss. Feel free to try this at home, but make sure that you have 8-Ω loudspeakers. 4-Ω speakers are also common and could draw enough current to damage the amplifier IC. 7. Optional: Borrow a second audio amplifier and set it up on a second breadboard. You can connect the second breadboard to the first by using the tabs and slots on the sides to hold them together. If you are very careful, you may be able to fit the second amplifier on the first breadboard. As before, power down first and make sure that everything is connected correctly. Connect the volume control pins of both amplifiers to the same analog control voltage. Connect each amplifier to a different loudspeaker. Connect one channel of the stereo jack to the audio-input of one amplifier and the other channel to the audio-input of the other amplifier. Use a separate anti-bias circuit for each audio input, but remove the 1-kΩ resistors that were originally used to sum the two channels. Power up again. How does stereo compare to mono? 3