300 likes | 484 Views
Lecture #6 EGR 262 – Fundamental Circuits Lab. EGR 262 Fundamental Circuits Lab Presentation for Lab #6 Analog-to-Digital Conversion - Hardware. Instructor: Paul Gordy Office: H-115 Phone: 822-7175 Email: PGordy@tcc.edu. Analog Output. MicroStamp11. D/A Converter.
E N D
Lecture #6 EGR 262 – Fundamental Circuits Lab EGR 262 Fundamental Circuits Lab Presentation for Lab #6 Analog-to-Digital Conversion - Hardware Instructor: Paul Gordy Office: H-115 Phone: 822-7175 Email: PGordy@tcc.edu
Analog Output MicroStamp11 D/A Converter Digital Output from MicroStamp11 (or Digital Input to D/A Converter) Analog Input A/D Converter MicroStamp11 Digital Output from A/D Converter (or Digital Input to MicroStamp11) Lecture #6 EGR 262 – Fundamental Circuits Lab Digital-to-Analog Conversion In order to control analog outputs, digital outputs must first be converted to analog form using a digital-to-analog converter (also referred to as a DAC or D/A converter). Note: Labs 5 & 9 deal with digital-to-analog conversion. Analog-to-Digital Conversion In order to read analog inputs, the analog inputs must first be converted to digital form using a an analog-to-digital converter (also referred to as a ADC or A/D converter). Note: Labs 6 & 7 deal with analog-to-digital conversion.
Lecture #6 EGR 262 – Fundamental Circuits Lab • Analog-to-Digital Conversion • There are several methods of performing analog-to-digital conversion, including: • Simultaneous A/D converter – this method uses 2N comparators and an N-bit priority encoder to produce an N-bit output. • Stairstep-ramp A/D converter – this method uses a D/A converter and a counter. As the binary count advances, it is converted to an analog signal and compared to the analog input. • Tracking A/D converter – similar to the stairstep-ramp A/D converter, but uses an UP/DOWN counter so that each successive conversion starts with the last digital value and counts up or down until the new analog input value is detected. • Single-slope A/D converter – instead of using D/A converter like the previous two methods, this method uses a linear ramp generator to produce a constant-slope reference voltage. A counter is synchronized with the slope of the ramp. • Dual-slope A/D converter – similar to the single-slope A/D converter, but the input charges a capacitor linearly, producing a negative, variable-slope ramp. The capacitor then discharges linearly with a positive slope. A counter runs as the capacitor discharges, yielding a count proportional to the voltage. This method is commonly used with voltmeters and other test equipment. • Successive-approximation A/D converter – this is perhaps the most widely used method and is used in Labs 6-7. It has a much shorter conversion time than most other methods and the conversion time is the same for any analog input.
Lecture #6 EGR 262 – Fundamental Circuits Lab • Successive-approximation A/D converter • The successive-approximation A/D converter consists of: • D/A converter • Comparator • Success-approximation register (or processing using the MicroStamp11) • Operation of the successive-approximation A/D converter: • The bits of the D/A converter are enabled one at a time, starting with the MSB. • As each bit is enabled, the comparator produces an output that indicates whether the analog input voltage is greater or less than the output of the D/A converter. If the D/A output is greater than the analog input, the comparator output is LOW and the bit is set LOW. If the D/A output is less than the analog input, the comparator output is HIGH and the bit is set HIGH. • This process is repeated for each bit. • See the example on the following page.
Lecture #6 EGR 262 – Fundamental Circuits Lab Example: 4-bit successive approximation A/D converter Note that this generic example is not based on the MicroStamp11. In Labs 6-7, the SAR (successive-approximation register) is essentially replaced by the Microstamp11.
Lecture #6 EGR 262 – Fundamental Circuits Lab Generic 4-bit successive- approximation A/D converter 3-bit successive-approximation A/D converter using the MicroStamp11 • Notes: • The SAR (successive-approximation register) is replaced by the MicroStamp11. • A buffering amplifier is added to control the input to the comparator. • A clamp circuit is added to insure that appropriate digital inputs are generated for the MicroStamp11.
Lecture #6 EGR 262 – Fundamental Circuits Lab • Circuit Background Information • In order to understand the A/D circuit to be built, a few topics will first be introduced, including: • Operational amplifiers (including buffering circuits) • Comparators • Clamping Circuits Operational Amplifiers Operational amplifiers (or op amps) were covered in some detail in EGR 260, but a few points are reviewed here.
Lecture #6 EGR 262 – Fundamental Circuits Lab Operational Amplifiers Operational amplifiers (or op amps) were covered in some detail in EGR 260, but a few points are reviewed here. Refer to Chapter 5 in Electric Circuits, 7th Edition, by Nilsson for additional information. Operational Amplifier - An operational amplifier (op amp) is a high gain differential amplifier with nearly ideal external characteristics. Internally the op amp is constructed using many transistors. Terminology: V+ = non-inverting input voltage V- = inverting input voltage Vo = output voltage Io = output current I+ = non-inverting input current I- = inverting input current VDC = positive and negative DC supply voltages used to power the op amp (typically 5V to 30V) V = V+ - V- = difference voltage Note: Sometimes the supply voltage connections are not shown
Lecture #6 EGR 262 – Fundamental Circuits Lab • Closed-loop: • Most commonly used • Some sort of feedback from output to input exists • The input voltage, Vin, is defined according to the application • An op amp circuit can be easily analyzed using the following ideal assumptions. • Ideal op-amp assumptions: • Assume that V = 0, so V+ = V- • Assume the input resistance is infinite, so I+ = I- = 0 • Realize the all voltages defined above are node voltages w.r.t. a common ground (as illustrated below)
Lecture #6 EGR 262 – Fundamental Circuits Lab Example: Determine an expression for Vo in the inverting amplifier shown below. Discuss limitations to the output based on the supply voltages. Discuss saturating the op amp.
_ Vo + Vin Lecture #6 EGR 262 – Fundamental Circuits Lab Example: Determine an expression for Vo in the unity-gain buffer shown below. Discuss loading problems that occur in circuits.
MicroStamp11 MicroStamp11 PA3 PA3 2R 2R R R PD0 PD0 2R 2R R R PD1 PD1 2R 2R 2R 2R Lecture #6 EGR 262 – Fundamental Circuits Lab Discuss how the buffer might be used to eliminate loading at the output from the R-2R ladder network used in the D/A converter from Lab #5.
Vin + _ Vref +15V Vin + + V _ _ Vref -15V Lecture #6 EGR 262 – Fundamental Circuits Lab Comparators A comparator is a circuit that compares an input voltage to a fixed reference voltage and indicates whether the input is larger or smaller than the reference voltage. Although specific comparator IC’s can be purchases, an operational amplifier in the open-loop configuration (no feedback connection) can easily function as a comparator. If is a circuit that compares an input voltage to a fixed reference voltage and indicates whether the input is larger or smaller than the reference voltage.
+9V Vin + LMC660 _ Vref 0V Lecture #6 EGR 262 – Fundamental Circuits Lab LMC660 In lab we will use the LMC660 quad op amp (quad indicates 4 op amps per IC). If we use supply voltages of 0V and 9V, the circuit will function as follows: Pinout for the LMC660:
turn slot or wheel to adjust turn knob to adjust turn to adjust wiper wiper wiper Lecture #6 EGR 262 – Fundamental Circuits Lab Potentiometers Three styles of potentiometers are shown below. The center lead in each style is referred to as the “wiper.” Potentiometers are also sometimes called “pots” or “trim pots.” Potentiometer symbols wiper
Lecture #6 EGR 262 – Fundamental Circuits Lab Uses of potentiometers Potentiometers have two key uses: 1) Adjustable resistors (or rheostats) In this case, only two leads are required. Use the center lead (wiper) and either end lead. Symbol: 2) Voltage dividers (or potentiometers) In this case, all three leads are used as the potentiometer acts like a voltage divider. A 10k potentiometer can be thought of as two series resistors, where the sum of the two resistors is always 10k. Adjusting the wiper changes the value of R1 and R2 (R2 = 10k – R1). R2 R1 Symbol: wiper R1 + R2 = 10k (for a 10k potentiometer)
Vsource R1 R1 + Vsource _ + R2 R2 _ turn slot or wheel to adjust V2 from 0V to 10V 10V V2 Lecture #6 EGR 262 – Fundamental Circuits Lab Connecting a potentiometer as a voltage divider
+9V Vin + LMC660 _ 5V 0V Vref 10 k pot Vref varies from 0V to 5V as the potentiometer is adjusted Lecture #6 EGR 262 – Fundamental Circuits Lab Using a potentiometer to provide a reference voltage for a comparator
Lecture #6 EGR 262 – Fundamental Circuits Lab • Clamping Circuit – In Lab 6 a diode is used in a clamping circuit. Before discussing clamping circuits, let’s quickly review diodes: • Diode Characteristics • Diodes act somewhat like voltage-controlled switches where: • The switch is closed when a positive voltage is placed across the diode • The switch is open when a negative voltage is placed across the diode • The characteristics of an ideal diode are shown below: Ideal Diode Characteristics I Forward biased diode - diode acts like a short (OV, any current) V Reverse biased diode - diode is an open (OA, any voltage < 0)
Lecture #6 EGR 262 – Fundamental Circuits Lab Actual Diode Characteristics Actual diodes typically require a small amount of voltage, Vo, before they act essentially like closed switches (short circuits). In most applications, the breakdown region is simply something to be avoided. This will not concern us as the diode used in lab will have breakdown voltages of around 1000 V. Actual Diode Characteristics I Vo is typically 0.6 – 0.7V for many diodes, but may be higher for an LED Breakdown region V Vo Reverse biased region (open) Forward biased region (approx. short)
Lecture #6 EGR 262 – Fundamental Circuits Lab • Diode Models • Diodes models are often used to analyze circuits containing diodes. The characteristics of a common diode model are shown below. • The diode acts like a 0.7V source when forward-biased. • The diode acts like an open circuit when reverse-biased. + V _ + V _ Common Diode Model If V < 0.7V reverse-biased diode open-circuit I V + V _ 0.7V + _ 0.7 V If V > 0.7V forward-biased diode 0.7V source
Lecture #6 EGR 262 – Fundamental Circuits Lab Clamping Circuits Since a diode acts like a 0.7V source, it can be used to clamp any output of 0.7V or greater to 0.7V. Similarly, if a voltage source of value Vx is added in series with the diode, a voltage can be easily clamped to Vx + 0.7V. Example 1: Output is clamped to 0.7 V Vin Vin Vout + Vin _ + Vout _ 10V 10V t t t -10V -10V -10V Example 2: Output is clamped to 0.7 V Vout + Vin _ + Vout _ 5.7V + _ 5V t -10V
Lecture #6 EGR 262 – Fundamental Circuits Lab Clamping Circuit used in Lab 6 The output of the comparator will produce either 0V or 9V. This needs to be converted to 0V or 5V so that it is a suitable input for the MicroStamp11 in Lab 7. We can use a diode and our 5V supply to clamp the comparator output to 5.7V. Then a final adjustment potentiometer can be added to adjust the 5.7V to 5.0V. The circuit is shown below. Vcomp Vclamp Rlimit 1N4007 10 k pot Vout • Discuss the operation of this circuit. • The output current of an op amp is typically in the mA range and the op amp can be destroyed if the output current is too large. If we want the output current to be around 1mA, what value of Rlimit should be used? (Hint: What are the node voltages on either side of the resistor?) +5V
Lecture #6 EGR 262 – Fundamental Circuits Lab Discuss Note that Lab #6 involves no programming! It does, however, use the circuit and program from Lab #5, so do not take the circuit apart. Lab #6 deals only with the hardware portion of the A/D circuit. We will deal with the software issues in Lab #7 and will then have a fully functioning A/D converter.
Decrement Button switch Increment Button switch Lecture #6 EGR 262 – Fundamental Circuits Lab Final Schematic: +5V O1 PD0 1 20 220 O7 PD1 a 2 19 a +5V O2 O6 b 3 18 O3 c 4 17 f b g O0 O4 d 5 16 O5 e 6 15 e c I7 f 7 14 d I6 g 8 13 220 9 12 10 k 10 11 Common-anode 7-segment display (see data sheet for pinout) MicroStamp11 +5V +9V +9V _ Vin LMC660 + Vbuffer Vclamp VDAC PA3 + LMC660 Vcomp Vref _ 0V Rlimit 2R 10 k 0V R +5V Buffer PD0 1N4007 Vo 10 k pot 2R 10 k pot R PD1 +5V 2R Comparator Clamp Circuit 2R R-2R Ladder Network (D/A Converter)
Lecture #6 EGR 262 – Fundamental Circuits Lab 4.1. Pre-lab Tasks: (1) Draw the schematic of a unity-gain buffer. Explain how the circuit works. Write an expression for the output voltage. (2) Draw the schematic of a comparator circuit that compares a reference voltage (0-9V) generated by a 10 kΩ potentiometer to the input voltage generated by your buffer circuit. Your circuit should generate a voltage that is either 0 or 9 volts. Explain how the circuit works. Write an expression for the output voltage. (3) Draw the schematic of a clamp circuit that clamps the comparator’s voltage to either zero or five volts. Explain how the circuit works. Write an expression for the output voltage. (4) Show the calculation for the resistance in the clamp circuit so that the maximum current drawn from the source is around 1 mA. (5) Show a complete schematic including the MicroStamp11, R2R ladder network, buffer, comparator, and clamp circuit. (6) Draw the breadboard layout for the schematic above.
Lecture #6 EGR 262 – Fundamental Circuits Lab • 4.2. In-lab Tasks: • (1) Note: It is best to build and test one circuit at a time rather than building the entire circuit. • Build the buffer circuit and connect it to the DAC you built earlier. Test your circuit by measuring the buffer output voltage versus the buffer input voltage from the DAC for all 8 possible cases. See sample table on following slides. • Build the comparator circuit and connect it to the buffer. Test your circuit by measuring the comparator’s output voltage as a function of at least 10 different reference voltage levels between 0 and 9 volts. Repeat this test for each of the 8 possible voltages that can be generated by your DAC (80 total measured values). See sample table on following slides. • Build the clamp circuit and connect it to the comparator. (The thumbwheel potentiometer seems to work best here.) Adjust the potentiometer on the output of the clamp circuit to exactly 5V when the output of the comparator circuit is 9V and then put a piece of tape on the potentiometer so that it will not be accidentally changed. Test your circuit by measuring the clamp’s output as a function of at least 10 different reference voltage levels. Repeat this test for each of the 8 possible voltages that can be generated by your DAC (80 total measured values). See sample table on following slides. • (4) Measure the threshold voltage where the comparator/clamp circuit transitions from zero to 5 volts as a function of the reference voltage for each of the 8 possible DAC voltages. See sample table on following slides. • (5) Describe what happened in the lab. • (6) Demonstrate your circuit to the instructor. The instructor will double check the correctness of your results and completeness of your lab book, sign off on the book and let you move on to the next lab. You may be asked to redo some of the tasks if they are not correct or complete.
Lecture #6 EGR 262 – Fundamental Circuits Lab 1) Buffer output versus buffer input (Buffer Input = DAC Output)
Lecture #6 EGR 262 – Fundamental Circuits Lab 2) Comparator output versus input from DAC for 8 reference voltages Graphing this data: In the Post-Lab you will need to graph this data. This can be done with either 10 graphs (one for Vref = 0.0, one for Vref = 0.5, etc) or a single 3D column chart. 3) Clamping circuit output versus input from DAC for 8 reference voltages
Lecture #6 EGR 262 – Fundamental Circuits Lab 4) Buffer output versus buffer input (Buffer Input = DAC Output) 4.3. Post-Lab Tasks: (1) Plot the buffer output voltage and input buffer voltage for each of the 8 cases. Assess how well the buffer works. (2) Plot the experimental data for the comparator circuit. Note: Use either 8 graphs of Vcomp vs. Vref (1 for each DAC input) or else use one 3D graph (80 points total). Assess how well the comparator circuit works. (3) Plot the experimental data for the clamp circuit. Note: Use either 8 graphs of Vclamp vs. Vref (1 for each DAC input) or else use one 3D graph (80 points total). Assess how well the clamp circuit works.