Analog-to-Digital Conversioninfohost.nmt.edu/~jaltig/ADC.pdf · Analog-to-Digital Conversion In...

13
CHEM 411L Instrumental Analysis Laboratory Revision 1.0 Analog-to-Digital Conversion In this laboratory exercise we will construct an Analog-to-Digital Converter (ADC) using the staircase technique. In today's world ADC's can be obtained as Integrated Circuits on a single chip. Instead of simply purchasing a pre-packaged ADC, we will instead construct an ADC from more fundamental components so as to better understand how these circuits operate. This will illustrate the issues associated with interfacing instrumentation with digital computers. www.mouser.com The output of most analytical instrumentation is an analog signal. To process this signal using a digital computer requires that we convert this analog output into a digital input for a computer or digital storage device. An ADC operates by periodically querying the output voltage of am instrument, converting the numeric voltage level to its binary equivalent and then presenting this binary equivalent as output. The ADC's output is then connected to an appropriate data port of a computer. Working in tandem, the computer will query its data port and latch the output of the ADC into a buffer from where it can be retrieved and then processed into the computer's memory. The computer is then ready for another signal from the ADC.

Transcript of Analog-to-Digital Conversioninfohost.nmt.edu/~jaltig/ADC.pdf · Analog-to-Digital Conversion In...

Page 1: Analog-to-Digital Conversioninfohost.nmt.edu/~jaltig/ADC.pdf · Analog-to-Digital Conversion In this laboratory exercise we will construct an Analog-to-Digital Converter ... with

CHEM 411L

Instrumental Analysis Laboratory

Revision 1.0

Analog-to-Digital Conversion

In this laboratory exercise we will construct an Analog-to-Digital Converter (ADC) using the

staircase technique. In today's world ADC's can be obtained as Integrated Circuits on a single

chip. Instead of simply purchasing a pre-packaged ADC, we will instead construct an ADC from

more fundamental components so as to better understand how these circuits operate. This will

illustrate the issues associated with interfacing instrumentation with digital computers.

www.mouser.com

The output of most analytical instrumentation is an analog signal. To process this signal using a

digital computer requires that we convert this analog output into a digital input for a computer or

digital storage device.

An ADC operates by periodically querying the output voltage of am instrument, converting the

numeric voltage level to its binary equivalent and then presenting this binary equivalent as

output. The ADC's output is then connected to an appropriate data port of a computer. Working

in tandem, the computer will query its data port and latch the output of the ADC into a buffer

from where it can be retrieved and then processed into the computer's memory. The computer is

then ready for another signal from the ADC.

Page 2: Analog-to-Digital Conversioninfohost.nmt.edu/~jaltig/ADC.pdf · Analog-to-Digital Conversion In this laboratory exercise we will construct an Analog-to-Digital Converter ... with

P a g e | 2

Sprott explains:

… circuits in which the voltages and currents are allowed to have only two rather different

values … are called digital circuits. With digital circuits, the exact values of the voltages are of

no consequence so long as one can unambiguously determine which of the two states the circuit is

in. The two states are variously referred to as on/off, true/false, yes/no, high/low, or one/zero.

Digital circuits are inherently more reliable and less prone to noise and interference than analog

circuits.

Digital circuits lend themselves rather naturally to performing arithmetic with binary numbers. A

binary number is a number composed of the two binary digits (called bits), 0 and 1. With a

decimal number, such as 931, the decimal digits represent successive powers of ten:

93110 = 1 x 100 + 3 x 10

1 + 9 x 10

2

Similarly, a binary number such as 10110 can be expressed as successive powers of two:

101102 = 0 x 20 + 1 x 2

1 + 1 x 2

2 + 0 x 2

3 + 1 x 2

4 = 2210

J.C. Sprott

Introduction to Modern Electronics

The binary representation of the decimal numbers from 0 to 10 are listed below:

Decimal Binary

0 0000

1 0001

2 0010

3 0011

4 0100

5 0101

6 0110

7 0111

8 1000

9 1001

10 1010

Now; to how a Staircase ADC is constructed. ADC construction is considered relatively

difficult. Digital-to-Analog Converters, by comparison, are fairly easy to construct. ADCs using

Page 3: Analog-to-Digital Conversioninfohost.nmt.edu/~jaltig/ADC.pdf · Analog-to-Digital Conversion In this laboratory exercise we will construct an Analog-to-Digital Converter ... with

P a g e | 3

either a Staircase or Succesive-Approximation technique are popular. We will use the Staircase

technique because it is more intuitive. Sprott provides us with the basic circuit diagram:

The key components are the Comparator, Counter and DAC.

The first major circuit element of this ADC is the comparator. This is nothing more than

an Op Amp configured as pictured. In this configuration, the Op Amp's output will

switch from "1" to "0" when V+ goes from being V+ < V- to V+ > V-; hence the name

comparator.

The output of the comparator is connected, via a logic Gate, to a Counter. When the

comparator's output is high, the counter will "count". The counter operates as its name

implies. An Oscillator acts as a "clock" for the counter; its output oscillates between "1"

and "0" on a regular basis. With each clock "tick", oscillation from "0" to "1", of the

oscillator will ratchet the counter's count up by 1:

reset counter 0000

tick 0001

tick 0010

tick 0011

tick 0100

etc …

When the comparator's output goes low, because V- exceeds V+, the counter will cease

"counting".

The DAC converts the binary "count" of the counter into an analog signal. This signal is

then fed into V- of the Op Amp where it is compared with V+. V+ takes as its value the

input signal to the ADC.

So, let's assume the input to the ADC is set at + 5 V. The counter has just been reset; so,

it reads 0000 (for a 4-bit counter). The DAC converts this binary reading to 0 V. Now,

V- of the comparator is 0 V, which is less than the input voltage 5 V. So, the

comparator's output remains high. On the next tick of the oscillator, because the

Page 4: Analog-to-Digital Conversioninfohost.nmt.edu/~jaltig/ADC.pdf · Analog-to-Digital Conversion In this laboratory exercise we will construct an Analog-to-Digital Converter ... with

P a g e | 4

comparator's output is high, the counter ratchets up to 0001, which is then converted to a

1 V analog signal by the DAC. This is still less than V+ of the comparator. So the

comparator's output remains high, meaning that on the next "clock" tick, the counter will

ratchet to 0010. This will continue until the counter's count reaches 0101, whereupon the

DAC's output will be 5 V. At this point V+ is no longer less than V-. This will cause the

comparator's output to go low, shutting off the counter. The counter will then hold this

value until it is reset. Before the counter is reset, the output of the ADC, 0101, can be

read by a computer's input port.

This is as pictured below. The reason why this circuit is called a "staircase" ADC should

be obvious.

It should be noted that the precision of the conversion is limited by the precision of the

DAC. The more precise is the output of the DAC, the more precisely the comparator will

discriminate V+ and V-. This staircasing process is rather slow and so may require a very

fast oscillator; some operate with frequencies as high as 100 MHz. Finally, the input

voltage must remain fairly constant while the ADC is sampling this signal.

Each of the above circuit elements can be purchased as Integrated Circuits in a typical

DIP package. Wiring PIN diagrams are provided by the manufacturers. So, we will wire

together each circuit element and then test the ADC by examining the circuit's binary

output when a given input voltage is supplied.

Page 5: Analog-to-Digital Conversioninfohost.nmt.edu/~jaltig/ADC.pdf · Analog-to-Digital Conversion In this laboratory exercise we will construct an Analog-to-Digital Converter ... with

P a g e | 5

Procedure

Now to the fun part, putting all of this together. We will do this in steps, ensuring that each

piece of the puzzle is working before moving on to the next step.

1. Powering the ICs. As usual, each IC used in our circuit needs to be powered. So, obtain a

Breadboard and three DC Power Supplies capable of going from 0 - 15 V. Set one at +5 V

and the other two at + 15 V. Note which lead is the GND.

Now use the Hobby Leads to connect the Power Supplies to the Power Rails on the

Breadboard. This is as:

Make sure all the Power Supplies are working off a common ground. Note that we have

switched the GND and power leads of one of the +15 V Power Supplies to create a -15 V

Power Rail. For the purposes of driving the logic gates, we will take the +5 V supply as

"High" and GND as "Low". Be sure to check the voltages at all the Power Rails using a

voltmeter.

2. Now obtain the IC's that comprise our desired circuit elements:

1 7400 Quad NAND Gate

2 74LS169 4-bit Binary Up/Down Counters

1 MC1408 8-bit DAC

1 LM311 Voltage Comparator

Place each IC on the Breadboard, across the central notch according to the following

schematic. Make sure each IC is seated snuggly on the board.

Page 6: Analog-to-Digital Conversioninfohost.nmt.edu/~jaltig/ADC.pdf · Analog-to-Digital Conversion In this laboratory exercise we will construct an Analog-to-Digital Converter ... with

P a g e | 6

Now we will wire-up each IC and test them individually.

3. We will start with the NAND Gate, which is a logic chip that will serve as a switch for

turning Clocking and turning On and Off the Counters. The NAND Gate is a not And logic

device. Symbolically it is represented as:

This device has two inputs "A" and "B", which will take voltages of "1" or "0". The output

will be according to the not And truth table:

"A" "B" Vo = "Y"

1 1 0

1 0 1

0 1 1

0 0 1

One input will come from the Comparator and the other from the Clock (Oscillator). The

output will drive the Counters. When the Comparator is telling the Counter to "counter",

its output will be "1". When the Clock's output goes from "0" to "1", the NAND Gate will

output low and the Counter will increment its "count". When the Comparator wants to

signal that its Input voltage and the voltage from the DAC are equal, its output will pull to

"0", the NAND Gate will pull to "1" and the Counter will no longer be able to "count".

The 7400 chip contains four NAND Gates. We will use one. Wire-up the number one

NAND gate. The pin diagram is as below:

Page 7: Analog-to-Digital Conversioninfohost.nmt.edu/~jaltig/ADC.pdf · Analog-to-Digital Conversion In this laboratory exercise we will construct an Analog-to-Digital Converter ... with

P a g e | 7

Start by wiring in the power. VCC goes to +5 V and GND to …. Then set both 1A and 1B

to "1" and use a Logic Probe to test the output. Is it is as expected? Finish testing the rest

of the truth table for this device.

Now, for testing purposes we will wire one input to "high". This is the input that would

normally come from the Comparator. We will put into place an open wire to the other

input. This can then be connected to the Clock.

4. Now to wiring the Counters. Our DAC will take an 8-bit input and these Counters have a

4-bit output. So, we will cascade two Counters together to give us the desired 8-bit output.

The pin diagram is given.

We will wire and test each Counter separately. Start by connecting the power to the Chip.

The U/ needs to be set "high" to signal the Counter to count up. The and pins

must be set "low" in order to enable the Counter to count. We will not use the input pins

(A, B, C, D) or the . These all need to be set "high". Now connect the CLK to the

output of the NAND Gate.

Test the chip by using a Function Generator set to output a square wave ~ 5V in amplitude

and less than ~1 Hz in frequency. Use the Logic Probe to test the output pins. QA is the

Least Significant Bit (LSB) and QD is the Most Significant Bit (MSB). You should see the

Counter ratchet through the sequence:

MSB 0000 LSB

0001

0010

0011

…..

Test both Counters independently.

Now to a detail, when the lower Counter reaches 1111 you want to signal to the higher

Counter that a Carry-Over is about to happen. In other words, you want the following

sequence of things to happen.

Page 8: Analog-to-Digital Conversioninfohost.nmt.edu/~jaltig/ADC.pdf · Analog-to-Digital Conversion In this laboratory exercise we will construct an Analog-to-Digital Converter ... with

P a g e | 8

Counter #1 Counter #2

1111 0000

Carry = pulse

0000 00001

0001 00001

0010 00001

… …

To accomplish this, RCO of the lower Counter must be tied to of the higher Counter.

5. Now to wiring the DAC. The pin diagram is:

Start by powering the chip; VCC and GND.

Now we have several things to do.

First, pins 5-8 and 9-12 take a binary input that will be converted to an analog output at pin

4. These input pins should be connected to the binary output of the Counter. Do this last.

Wire the remaining pins according to:

Page 9: Analog-to-Digital Conversioninfohost.nmt.edu/~jaltig/ADC.pdf · Analog-to-Digital Conversion In this laboratory exercise we will construct an Analog-to-Digital Converter ... with

P a g e | 9

Digital to Analog and Analog to Digital Conversion

Physics 623, University of Wisconsin-Madison

A couple of notes:

i) VEE is part of the power system for the chip.

ii) Vref+ and Vref- set the range of the DAC output. Varying the 7.5k resistor will change

the range over which the DAC will output a voltage. As configured, the DAC will take

a binary input in the range 00000000 to 11111111 and convert it to an output voltage in

the range of 0V to -4V. (We could adjust this, but for now we will take it as a given.)

Once the DAC circuit is built, use the Function Generator to drive the Counter's clock and

watch the voltage at the DAC's output with a voltmeter. Is the system behaving as

expected?

6. Finally, the Comparator should be placed in the circuit. The pin diagram for the LM311 is:

The Comparator's circuit should be as:

Page 10: Analog-to-Digital Conversioninfohost.nmt.edu/~jaltig/ADC.pdf · Analog-to-Digital Conversion In this laboratory exercise we will construct an Analog-to-Digital Converter ... with

P a g e | 10

Digital to Analog and Analog to Digital Conversion

Physics 623, University of Wisconsin-Madison

7. Obtain a DC Source to act as Vin; 0 to -4 V. Connect it to the input of the Comparator. Set

you ADC circuit in motion by clocking the Counter with the Function Generator. Once the

output rof the Comparator goes "low" (You can check the Comparator's output with a

Logic Probe.), check the output pins of the Counter. This is your "converted" binary

output. Is it what you expected?

Page 11: Analog-to-Digital Conversioninfohost.nmt.edu/~jaltig/ADC.pdf · Analog-to-Digital Conversion In this laboratory exercise we will construct an Analog-to-Digital Converter ... with

P a g e | 11

Data Analysis

You should submit a Memo Style report of your findings.

1. Describe the behavior of your ADC circuit. Did everything work as expected? If not, why

not? How did the binary output of the circuit compare with the analog input?

2. We used this circuit to converter a single analog input to a single binary output. How

might the circuit be modified to handle a continuous analog input such as a sinewave from

a Function Generator.

3. What issues concerning Analog-to-Digital Conversion have we not specified?

Page 12: Analog-to-Digital Conversioninfohost.nmt.edu/~jaltig/ADC.pdf · Analog-to-Digital Conversion In this laboratory exercise we will construct an Analog-to-Digital Converter ... with

P a g e | 12

Appendix

Breadboard Configuration

The following schematic is taken from http://tymkrs.tumblr.com/post/6386624174/how-to-use-a-

breadboard.

Page 13: Analog-to-Digital Conversioninfohost.nmt.edu/~jaltig/ADC.pdf · Analog-to-Digital Conversion In this laboratory exercise we will construct an Analog-to-Digital Converter ... with

P a g e | 13

References

"Digital to Analog and Analog to Digital Conversion" Physics 623 (Electronic Aids to

Measurement), University of Wisconsin-Madison, http://www-

old.physics.wisc.edu/undergrads/courses/fall2011/623/ , accessed September 19, 2013.

Skoog, Douglas A., Holler, F. James and Crouch, Stanley R. (2007) " Principles of Instrumental

Analysis, 6th

Ed. Thomson, Belmont, California.

Sprott, Julien C. (1981) "Introduction to Modern Electronics" John Wiley & Sons, New York.