ECE 323: Project 1, Fall 2007 1 University of Massachusetts Department of Electrical and Computer Engineering ECE 323 Electronics I Fall 2007 Project 1: Design of a Peak Detector Employing Diodes and OPAMPs In this project you will design a peak detector that responds to the peak voltage value of an AC waveform and has an output which is a DC voltage equal to that peak value. Peak detectors can be designed using only pn-junction diodes, but then would have an output which is less than the peak value of the AC voltage by the ‘diode drop’ voltage (about 0.7 V). In order to design a more accurate peak detector, you will use two different circuits that combine diodes and operational amplifiers (‘OPAMPs’). Your design should meet the specification for the amount of "ripple" allowed. You will do a hand calculation design and then check these calculations with PSPICE simulations. In the laboratory you will build the peak detectors you designed, and measure the output voltage and the ripple, as well as do some other experiments to evaluate your circuits. You will compare your results to the specifications, as well as to the values you got from your design. ECE 323: Project 1, Fall 2007 2 1.0 Design Specifications You should assume two different circuits with the topologies shown below in Figure 1: Figure 1A: CIRCUIT A Figure 1B: CIRCUIT B ECE 323: Project 1, Fall 2007 3 Diodes D1 and D2 should be pn-junction diodes of type 1N914. A spec sheet is posted on the ECE 323 web site. C1 should be an electrolytic capacitor and you will have to be careful about inserting it in the circuit with the correct polarity. The OPAMPs available will be uA741, or just ‘741’. A spec sheet for these 741 OPAMP is posted on the ECE 323 web site. Use the model for the uA741 available in the PSPICE libraries for your simulations. Pins 1 and 5 are not used. The OPAMPs should be powered by your breadboard with +/- 5 V. The load resistance, RL, is 4.7 k. Resistor and capacitor values should be those available in the laboratory, which have standard values that are given in a list available on the ECE 323 web site. Use only single components for each part in your circuit (such as R1, C1, etc.) i.e. do NOT try to obtain intermediate values by connecting parts in series or parallel. VIN is a sinusoidal source obtained by setting your function generator such that the peak voltage is +1.0 V. The frequency is set to 400 Hz. In the laboratory you will also set it to output triangle waves. 1) You should first design peak detector CIRCUIT A by determining the value of the capacitor C1 such that the circuit meets the following specifications: Ripple on the output voltage less than 50 mV peak-to-peak (p-p). Average output voltage 1.0 V +/- 0.02V (average means the time average, i.e. the ripple is allowed to average out). C1 should be no larger than necessary to meet the above spec’s. 2) There are no spec’s to meet for circuit B. Use the same capacitor value for C1 that you found for circuit A. 2.0 Discussion of Design and Simulation 2.1. Introduction The text book by Sedra and Smith discusses the “super diode” in Sec. 3.5.5. Applications of this basic type of circuit are discussed in Sec. 13.9. You should also study the properties of OPAMPs in the first part of Chap. 2 of the text. What is inside an OPAMP is not covered in ECE 323, but you will learn this in ECE 324. The basic super diode consists of diode D1 and the OPAMP in Figure 1A. It has a transfer characteristic shown in Figure 3.31 in the text. A discussion of how the super-diode circuit works follows (some of this material will also be covered in the discussion section): Initially, we assume that the output voltage is zero. Therefore, the voltage at the negative input to the OPAMP is also zero. ECE 323: Project 1, Fall 2007 4 As the input voltage (V3) goes positive, it will be amplified by the OPAMP and the output voltage then very quickly becomes greater than the turn–on voltage for the diode, D1 (the voltage increases quickly because of the enormous open loop gain of the OPAMP). This allows the output voltage to feed back to the negative input terminal (V2) of the OPAMP. The differential voltage at the OPAMP input then decreases, which also tends to decrease the output voltage (this effect is called “negative feedback” and will be discussed in detail in ECE 324). If we freeze the input voltage from the source VIN, then the feedback will quickly accomplish a steady state condition for which V3 and V2 are very nearly equal. This is the “virtual short circuit” condition that the text discusses in Chapter 2, for example see page 69. Note that because of the feedback, we have now also equalized the input voltage (V3) and the output voltage, i.e. we have “detected” the value of the input voltage at the output. What about the diode when you have reached steady state? In the lectures and discussion sections you have learned to make an assumption about the state of the diode for any given circuit: The diode can either be ON or OFF. After making your assumption, you check if the circuit is consistent with the assumption. In this case, we assume that the diode is still ON (we argued above that the diode would be turned ON initially ). You should inspect the circuit and see if this assumption is consistent with (linear) circuit theory, for example KCL! If this is true then the assumption was justified. What happens when the input voltage on V3 is instead negative? There is no longer any negative feedback from the OPAMP output to its input since the diode is OFF; the OPAMP is in the “open-loop condition”. The differential input voltage to the OPAMP (= V3 – V2) becomes negative and can be quite large. It does not take much of a negative differential input voltage for the OPAMP output to reach its maximum negative output voltage (because the OPAMP open loop gain is so large!). After that the OPAMP output voltage does not change, it has “saturated” or “hit the negative rail”. This voltage level is determined by the negative power supply voltage (V-) that we feed to the OPAMP, -5 V in our case (actually the magnitude of the negative rail output voltage is slightly less than the magnitude of V-). “Hitting the rail” is actually OK, i.e. it does not damage the OPAMP, since it has built-in protection. The main undesirable consequence is that if the input voltage again goes positive, it takes some time for the OPAMP to recover from saturation. When the above happens, the diode voltage will go below 0.7 V and the diode turns OFF. We conclude that with the simple super-diode circuit shown in Figure 3.31 (a), the output voltage across the load (RL) will follow the input voltage, as long as it is positive (the input voltage is assumed to vary slowly). If the input voltage is negative, the output voltage over the load will always be zero. Hence the transfer characteristic in Figure 3.31 (b). In this project you are designing a detector that has at its output voltage the peak value of an AC waveform at the input. The input waveform can be an arbitrary periodic function of time, but we will now assume that it is sinusoidal. In order for the peak value of this waveform to remain at the output, we will add a capacitor across the load resistance. If the peak amplitude of the input voltage is constant, we will then obtain a DC voltage at the output, equal to the peak value of the AC input voltage. There will be a ECE 323: Project 1, Fall 2007 5 small “ripple” added to the output DC value, as well, as the capacitor discharges every period once the diode has turned OFF. This ripple can be made smaller by increasing the time constant of the RC-circuit (RL and C1 in Figure 1A). You can study ripple in the context of half-wave rectifiers, see Sec. 3.5.4. in the text. You have a specification for the maximum value of this ripple (50 mV p-p), when the input peak value is 1 V and the frequency 400 Hz. The above discussion describes the basic operation of the super diode used as a peak detector. We could use the circuit as a “peak voltage voltmeter”, that would actually work for any other number of waveforms as well. Variations in the peak voltage may be detected as long as the RC time constant is short enough to allow the output voltage to vary. CIRCUIT B represents an improvement of CIRCUIT A: It provides a way of preventing the OPAMP A1 output from ever saturating. Study Sec. 13.9. in the text to see how this occurs. Resistor R1 sends a current from the output that keeps diode D2 constantly ON. OPAMP A1 effectively becomes a “voltage follower”, a circuit described in Sec. 2.3.4 in the text and in the discussion sections. This circuit has the property that the output voltage is equal to the input voltage (V3 in our case), hence the name. Therefore the two input terminals of OPAMP A1 will “track” each other and this OPAMP will never saturate because V3-V2 will always be VERY small. Diode D2 is called a “catching diode”. OPAMP A2 is in the standard voltage follower configuration with a wire directly connecting the output to the negative input terminal. We could also say that it is a voltage amplifier with a voltage gain of +1.0. This OPAMP acts as what is called a “buffer” between the first OPAMP and the load. In Sec. 2.3.4 in the text you will find that the input resistance of an ideal voltage follower is infinite. For a real OPAMP, the value is of course finite, and one of the tasks of this project is to find a value for that input resistance, as you do your measurements in the lab. Note that the ability of capacitor C1 to hold the charge that measures the peak input voltage is now determined by a time constant given by C1 and the input resistance of OPAMP A2. This time constant can have a very large value, and thus C1 needs only a very small current (through D1 as in CIRCUIT A) to keep its charge. The advantage of circuit B is that it can “hold” a particular peak value, that has been detected, for a long time. 2.2. Hand calculations You should first produce an approximate design with hand calculations. You can proceed with this as follows: Assume a circuit such as shown in Figure 1A (CIRCUIT A). From the discussion above and in the text, you can assume that the output voltage will be very close to the peak value of the input voltage. You need to determine the value of capacitor C1 in order to make sure that you meet the specification for the maximum ripple voltage, Vr. The ripple voltage is defined as a peak-to-peak value. The above constitutes the design ECE 323: Project 1, Fall 2007 6 element of this task. The calculation is similar to the one performed in the text in Sec. 3.5.4. Once you have found Vr you can also calculate the approximate value of the peak diode current and the time interval, Δt, during which the diode conducts in each period. This part of the calculation is different from the one in the text. This is because the OPAMP will very quickly reach its maximum current as the differential input voltage goes slightly negative. Check the spec. sheets for the 741 OPAMP and the 1N914 diode posted on the web site to find the maximum currents they can sustain. You can assume that the maximum current is limited by the OPAMP. Then perform a calculation guided by the one in Sedra and Smith, but with the above important assumption. You do not need to do any hand calculations for CIRCUIT B. (1) Give the value you obtained for capacitor C1. Also turn in a discussion with a maximum length of one page of how you did your design, and how you estimated the ripple voltage, thea hand maximum diode current and theAB, diode conductionabove. interval, Δt. Also Also do calculation for CIRCUIT as described explain briefly how CIRCUIT A produces an accurate output voltage . (2) Write an explanation (about half a page) in your own words for how CIRCUIT B works. Note the boxes in each project description which summarize what you actually need to include in your report! 2.3. SPICE simulation of the circuits 2.3.1. CIRCUIT A. Set up the circuit you designed in the schematics editor of PSPICE. You can use the PSPICE model for the diode, and also the PSPICE model for the uA741 OPAMP (find them in the “eval” library). Remember to power the OPAMP with correct polarities! Run (‘analyze’) the simulation using the ‘transient’ option under ‘Setup’. You will need to set the ‘print step’ small enough that you obtain smooth curves (points off if you don’t!). Also, it is important to include a value for the item ‘step ceiling’. Using the same value as the print step works. When you do your simulations, note that you need to run them for a sufficient time interval that the initial transients have died down. For example, you may find that the ripple shows alternating peaks that are not of the same height. If that happens, run for a longer time. You don’t need to print the entire time interval, only a few periods until the circuit has reached steady state. ECE 323: Project 1, Fall 2007 7 (3) (a) Turn in the circuit from PSPICE’s schematic editor. It is very important that your name is included as part of the file name for the circuit as well as all PROBE plots specified below! Also turn in (b) A PROBE plot of the output voltage for about 50 ms, starting at time = 0 (c) Another plot covering about 10ms, starting after the initial transient has died down, and showing that the ripple specification is met (i.e. mark the peak-to-peak ripple clearly in your plot!). (d) Compare the value for the ripple obtainedB in handand calculations 2.2.2. CIRCUIT B. Sinusoidal input.voltage Set upyou CIRCUIT in your PSPICE run the with the one from (c) above. simulation, again using the transient calculation. (e) A PROBE plot of the output voltage from the OPAMP (pin 6) for the same time interval as in (c). Discuss and explain this plot briefly. (f) A plot of the peak current through D1 for a time interval of about 0.2 ms around the diode current peak (at a time after steady state has been reached). Compare the simulated peak current and the diode conduction interval with the ones you hand calculated in Sec. 2.2. (note that the diode current may not be as constant as assumed in your hand calculations – in that case estimate the time interval based on the average simulated current). Discuss any differences in your “simple” hand-calculated values and those obtained by PSPICE. 2.3.2. Circuit B. Set up and simulate CIRCUIT B in PSPICE. (4) Turn in the following: (a) The circuit from PSPICE’s schematic editor (b) A PROBE plot of the output voltage from time 1ms to time 2000 ms. The circuit may take up to one second to settle down in this case, whereupon it shows a small ripple. The initial slow decrease from an “over-shoot” of a few mV toward 1.000 V is difficult to explain with our simple models – assume that it is due to some higher order effects in the OPAMPS that PSPICE includes, since PSPICE uses quite a complicated model for the 741. Comment on this plot, i.e. is the ripple now less than for CIRCUIT A, or larger? Explain in a few sentences why the ripple has changed. (c) A PROBE plot of the output voltage from OPAMP A (pin 6) for a time of 2 ms to 20 ms. This plot should demonstrate that this OPAMP no longer saturates. Discuss and explain this plot briefly. Specifically, explain if and why the DC level has shifted relative to the input voltage. ECE 323: Project 1, Fall 2007 8 Always keep a copy of your documentation for use in the lab.!!! 3.0. Design Prototyping and Test 3.1. Construction of the peak voltage detectors Construct the peak detectors on the breadboard, using the function generator as your AC source. Set the function generator to the required input voltage and for sinusoidal output at 400 Hz, and then check it with an oscilloscope. Build the circuit in steps, i.e. first CIRCUIT A, and then CIRCUIT B, The OPAMPS should be supplied from the +/- 15 V supplies, that can be adjusted down to 5 V with a potentiometer, as you watch the voltage on the multimeter. Measure the DC voltage output from the peak detector circuits with the multimeter, and the ripple with the oscilloscope. Be careful to insert the diodes and the capacitor in the correct direction! When you have inserted the capacitor and the load, you can start to measure DC voltages with the multimeter. 3.2. Measurements on CIRCUIT A Perform the following measurements: Measure the DC output voltage. Measure the ripple on the output voltage with an oscilloscope in its AC mode. Change the function generator to output a triangular wave form, and check that your circuit still detects its peak value. Change the frequency of the function generator to 60 Hz and qualitatively note the change in the ripple voltage Measure the output voltage from the OPAMP (pin 6) on an oscilloscope and compare with your simulations. Fill in your measured data in APPENDIX I. Also draw a diagram of the circuits exactly as you built them. In this circuit diagram note values for all components. Show the TA or the Instructor the results for the items specified in Appendix I. ECE 323: Project 1, Fall 2007 9 3.3. Measurements on CIRCUIT B Set up CIRCUIT B. Measure the DC output voltage with the multimeter for a 1V peak sinusoid input. Check the ripple with the oscilloscope. Measure the output voltage from OPAMP A1 (pin 6) on an oscilloscope and compare with your simulations. Measure the voltages at both inputs of OPAMP A1 with an oscilloscope and compare them. Finally, measure the output voltage of CIRCUIT B with the multimeter as a function of time after you have turned down the amplitude of the function generator (define this time as t=0). The output should change slowly enough that you will be able to record values every few seconds. Read the times on your watch (or the second hand of the clock in the lab) and make a table of output voltage versus time. Plot these values on a lin-log plot and determine the time-constant from the plot. Calculate an estimate of the OPAMP input resistance from the measured time constant. ECE 323: Project 1, Fall 2007 APPENDIX I - IN-LAB REPORT OF MEASURED DATA (TURN THIS IN AFTER COMPLETING THE LAB!) (1) Circuit diagram for the peak detectors exactly as you built and measured them Give values for all components. 10 ECE 323: Project 1, Fall 2007 11 (2) Measurements on CIRCUIT A DC output voltage ………………………………………………………………………V Measured ripple voltage, p-p………………………………………………………… mV TA or Instructor checks the output voltage and the ripple Brief comments on the result on the ripple of changing the frequency of the function generator to 60 Hz Brief comments on measuring the output voltage when the input is a triangle wave Brief comments on measuring the output voltage from the OPAMP (pin 6) on an oscilloscope and comparing with your simulations. 3) Measurements on CIRCUIT B DC output voltage ………………………………………………………………………V Measured ripple voltage, p-p………………………………………………………… mV TA or Instructor checks the output voltage and the ripple ECE 323: Project 1, Fall 2007 12 Brief comments on measuring the output voltage from the OPAMP (pin 6) on an oscilloscope and comparing with your simulations. Plot the decaying output voltage as a function of time on a separate sheet, appended with the report. Calculate the following: Time constant ………………………………………………………………………….s Estimated input resistance of the OPAMP……………………………………………MΩ Show your calculations below: