1 / 22

Instructor: Paul Gordy Office: H-115 Phone: 822-7175 Email: PGordy@tcc.edu

Lecture #7 EGR 262 – Fundamental Circuits Lab. 1. EGR 262 Fundamental Circuits Lab Presentation for Lab #7 Successive Approximation A/D Converter. Instructor: Paul Gordy Office: H-115 Phone: 822-7175 Email: PGordy@tcc.edu. Lecture #7 EGR 262 – Fundamental Circuits Lab.

naida
Download Presentation

Instructor: Paul Gordy Office: H-115 Phone: 822-7175 Email: PGordy@tcc.edu

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lecture #7 EGR 262 – Fundamental Circuits Lab 1 EGR 262 Fundamental Circuits Lab Presentation for Lab #7 Successive Approximation A/D Converter Instructor: Paul Gordy Office: H-115 Phone: 822-7175 Email: PGordy@tcc.edu

  2. Lecture #7 EGR 262 – Fundamental Circuits Lab 2 Analog Output Arduino UNO D/A Converter Digital Output from Arduino UNO (or Digital Input to D/A Converter) Analog Input A/D Converter Arduino UNO Digital Output from A/D Converter (or Digital Input to Arduino UNO 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 4 & 6 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 7 & 8 deal with analog-to-digital conversion.

  3. Lecture #7 EGR 262 – Fundamental Circuits Lab 3 • 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 this lab. It has a much shorter conversion time than most other methods and the conversion time is the same for any analog input. In the following lab we will also see that the Arduino UNO has a built-in successive-approximation ADC.

  4. Lecture #7 EGR 262 – Fundamental Circuits Lab 4 • Successive-approximation ADC • The successive-approximation ADC consists of: • DAC (such as the R-2R ladder network) • Comparator • Success-approximation register (or processing using the Arduino UNO) • Operation of the successive-approximation A/D converter: • The bits of the DAC 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 DAC. If the analog input is greater than the DAC output, the comparator output is HIGH and the bit is Reset (LOW). If the analog input is less than the DAC output, the comparator output is LOW, and we will Keep the bit (HIGH). • This process is repeated for each bit. • See the example on the following page.

  5. Lecture #7 EGR 262 – Fundamental Circuits Lab 5 Example: 4-bit successive approximation A/D converter Trace through Steps 1-4 below: Note: A 4-bit DAC is used where the analog output is 0-15V for digital inputs 0000 – 1111 • Step 1: • Set the MSB, so SAR output = 1000 • DAC is 8V • 8V > 4.9V input, so Reset the bit to 0 4.9V • Step 2: • Set the next bit, so SAR output = 0100 • DAC is 4V • 4V < 4.9V input, so Keep the bit Note: The SAR makes the decision when to Reset or Keep a bit. In this lab we will write a program for the Arduino UNO to replace the SAR. 4.9V • Step 3: • Set the next bit, so SAR output = 0110 • DAC is 6V • 6V > 4.9V input, so Reset the bit to 0 4.9V Result: Analog input 4.9 V was converted to digital output 0101 • Step 4: • Set the next bit, so SAR output = 0101 • DAC is 5V • 5V < 4.9V input, so Keep the bit 4.9V

  6. Lecture #7 EGR 262 – Fundamental Circuits Lab 6 Generic 4-bit successive- approximation ADC 4.9V Arduino UNO 3-bit successive-approximation ADC using the Arduino UNO Digital Output (0 – 7 or 000 to 111) • Notes: • The SAR (successive-approximation register) is replaced by the Arduino UNO. • A comparator is added to compare the output of the DAC to the analog input (output will be 5V if the input is greater than the DAC output and 0V if not). • The Arduino UNO will read the output of the comparator to decide which bits to Reset or Keep as in the previous example. DAC (R-2R ladder network) Comparator + _ Analog Input (0-5V)

  7. Lecture #7 EGR 262 – Fundamental Circuits Lab 7 Detailed ADC Schematic Digital Output (0 – 7, or 000 – 111 in binary) Arduino UNO +5V 220  D2 D3 D4 D5 D6 D7 D8 D13 D12 D11 D9 a a b c f b g d e e c D10 d f DAC Output g 4.4k +5V 2.2k + _ 4.4k Comparator 2.2k +5V 4.4k Analog Input (0-5V) 10k 4.4k

  8. Lecture #7 EGR 262 – Fundamental Circuits Lab 8 • Operational Amplifiers • Operational amplifiers (or op amps) were covered in detail in EGR 271, but a few points are reviewed here. Refer to Chapter 5 in Electric Circuits, 9thEdition, by Nilsson for additional information. • Closed-loop versus open loop • Closed-loop configuration • Includes nearly all op amp examples in EGR 271 • A feedback resistor is used • Most common configuration with many applications • ACL, closed-loop gain, is often calculated and is typically small (|ACL| <10) • Open-loop configuration • No feedback resistor is used • AOL, open-loop gain, is huge. Typical value: 100,000 (manufacturer spec) • Op amp output is typically equal to one of the supply voltages (saturated) • Key application: comparators or related circuits

  9. Lecture #7 EGR 262 – Fundamental Circuits Lab 9 _ V Vo + • Open-loop configuration: • Rarely used, but is useful for comparators • No feedback resistor used • Open-loop gain, AOL, used (typical value: AOL = 100,000) • Closed-loop configuration: • Most commonly used • Feedback resistor used • Closed-loop gain, ACL, used Rfeedback VDC1 Other components _ + _ Vin Vo + + _ VDC2

  10. Lecture #7 EGR 262 – Fundamental Circuits Lab 10 Example (closed-loop configuration) Determine an expression for Vofor the inverting amplifier shown below. Also find the closed-loop gain, ACL. 40 k 10 k _ Vo + _ Vin = 2V +

  11. Lecture #7 EGR 262 – Fundamental Circuits Lab 11 _ _ V V Vo Vo + + Comparator An op amp in the open-loop configuration can be easily used to determine which is the larger of two inputs. Such a circuit is called a comparator. To illustrate how a comparator works, suppose that V+ is slightly larger than V-: 2.499 V 2.501 V +12V +12V _ _ 2.500 V 2.500 V Now suppose that V+ is slightly less than V-: + + -12V -12V So the comparator indicates which input is larger:

  12. Lecture #7 EGR 262 – Fundamental Circuits Lab 12 + + Vo Vo _ _ V- Analog Input Comparator - continued For digital circuits, it is useful to use 0V and 5V for the supply voltages as shown below: V+ We will use the LMC 660 op amp in lab. Recall that the successive-approximation ADC compares the DAC output with the analog input. 5V 5V DAC Output 0V 0V Pinout for the LMC660:

  13. Lecture #7 EGR 262 – Fundamental Circuits Lab 13 Rotate knob on potentiometer to adjust Analog Input from 0V to 5V 5V Analog Input Connecting a potentiometer as a voltage divider (review) Vsource R1 R1 + Vsource _ + R2 R2 _

  14. Lecture #7 EGR 262 – Fundamental Circuits Lab 14 Using a potentiometer to adjust the Analog Input We will use a potentiometer to simulate an Analog Input (to be converted to a digital value) as shown below. 5V DAC Output + LMC660 _ 5V 0V Analog Input 10 k pot Analog Input varies from 0V to 5V as the potentiometer is adjusted

  15. Lecture #7 EGR 262 – Fundamental Circuits Lab 15 Detailed ADC Schematic Digital Output (0 – 7, or 000 – 111 in binary) Arduino UNO +5V 220  D2 D3 D4 D5 D6 D7 D8 D13 D12 D11 a a b c f b g d e e c D10 d f DAC Output g 4.4k +5V 2.2k + _ 4.4k Comparator 2.2k +5V 4.4k Analog Input (0-5V) 10k 4.4k

  16. Lecture #7 EGR 262 – Fundamental Circuits Lab 16 Writing a program to complete the ADC The design for the ADC will be completed by adding software that will make a series of guesses in order to determine the binary value that represents the analog input. Guessing Game Consider the following game. The instructor will pick a number from 0 to 100. You try to guess the number as quickly as possible. Strategy: Each time guess as closely as possible to the midpoint of the remaining range after each guess. Example: Let’s try it (instructor writes a number on the board behind the screen).

  17. Lecture #7 EGR 262 – Fundamental Circuits Lab 17 Read Value Display Guess for I = 1 to N Guess > Value? Now let’s modify the game to use binary values. We can guess an N-bit number using N guesses. For example, a 4-bit number can be guessed using 4 guesses. Example: Try using the flowchart for: Value = 3 Upper = 2N Flowchart – Guessing Game with Binary Values Lower = 0 Guess = (Upper + Lower)/2 T Upper = Guess F Lower = Guess Guess = (Upper + Lower)/2

  18. Lecture #7 EGR 262 – Fundamental Circuits Lab 18 Binary Search The guessing game is an example of a binary search. A/D converters based on a binary search are called successive approximation A/D converters. We begin by assuming that some input analog voltage is applied and we would like to convert it to a digital value. For our 3-bit A/D converter, we will assume that the input is between 0V and 5V and we wish to convert it to a binary value as shown below (using the table from the last lab):

  19. Lecture #7 EGR 262 – Fundamental Circuits Lab 19 Example: Trace through the ADC schematic for an analog input of 3.5V. Add binary values and voltages to the schematic. Digital Output (0 – 7, or 000 – 111 in binary) Arduino UNO +5V 220  D2 D3 D4 D5 D6 D7 D8 D13 D12 D11 a a b c f b g d e e c D10 d f DAC Output g 4.4k +5V 2.2k + _ Result: 3.5V converted to 5 = 101 4.4k Comparator 2.2k +5V 4.4k Analog Input (0-5V) 10k 4.4k

  20. Lecture #7 EGR 262 – Fundamental Circuits Lab 20 Example: Trace through the ADC schematic for an analog input of 0.8V. . Add binary values and voltages to the schematic. Digital Output (0 – 7, or 000 – 111 in binary) Arduino UNO +5V 220  D2 D3 D4 D5 D6 D7 D8 D13 D12 D11 a a b c f b g d e e c D10 d f DAC Output g 4.4k +5V 2.2k + _ Result: 0.8V converted to ________ 4.4k Comparator 2.2k +5V 4.4k Analog Input (0-5V) 10k 4.4k

  21. Lecture #7 EGR 262 – Fundamental Circuits Lab 21 • Pre-lab Task: • Write a C++ program for the Arduino UNO to use a binary search to implement a successive-approximation ADC where: • The 3-bit binary guess will be output to an R-2R ladder network using the function R2R( ) from Lab 4. • The value of the binary guess will be displayed on a 7-segment display using the function display_digit( ) from Labs 3-4. • No buttons are required, so the functions for debouncing button inputs are not needed. • An outline of the program might look as follows (see next slide):

  22. Lecture #7 EGR 262 – Fundamental Circuits Lab 22 void setup( ) { // Define input and output pins } void loop( ) { // Assign initial values to upper, lower and N // guess = (upper + lower)/2 // for i = 1 to N { // Call R2R( ) to send guess to output pins // Read comparatorInput on D10 if(comparatorInput == 1) // guess > analog input upper = guess else lower = guess // guess = (upper + lower)/2 } // display guess on 7-segment display } void display_digit(int N) { // Use code from Lab #3 (do not make any changes) } void R2R(int N) { // Use code from Lab #4

More Related