EE1000, Lecture 12

Volt Meter – A/D converters, Comparators

ADC:

One application of digital circuits that has become popular over the past few decades is digital signal processing. Typically this involves processing a real-world signal (such as the sound carried to a microphone) in the digital realm. To do this, the real-world signal must first be converted to an analog electrical signal using a microphone, sensor, transducer, etc. From there, the signal must be converted to binary (or two’s complement) with enough bits to provide the needed precision. This conversion is accomplished with a device called an Analog to Digital Converter(also known as an A/D Converter or ADC). The output of the ADC is then fed directly to the digital processing circuit.

The number of data bits that an ADC generates is called its resolution. Most ADCs have 8 to 12 bits of resolution, but 18-bit ADCs are available. Some ADCs generate bits continuously, while others produce valid data only after a conversion process. Some ADCs have multiple analog inputs that can be selected; others do not. The reference voltage is the maximum value that the ADC can convert. Our example 8-bit ADC can convert values from 0V to the reference voltage.

(Assume that the reference voltage is 1 volt.)

Comparator:

Sometimes, we only need to know whether or not a real-world signal has exceeded some limit or threshold. For example, suppose a digital circuit has the job of opening a refrigeration valve if the temperature is too warm and it’s not in a defrost cycle. We can convert the temperature to digital with an ADC and compare it to a set-point digitally, but it’s not necessary to know the temperature, only that it is too warm. A simpler approach is use a comparator, a device that compares two analog signals and generates a digital result. The figure below shows a simple comparator circuit with an adjustable setpoint. If the analog voltage reaches the threshold voltage set by the potentiometer (variable resistor) R1, the output of the comparator will be high. Otherwise, it will be low. Resistor R2 is often necessary because many comparators are only capable of driving the signal low (much like the switches and phototransistors discussed earlier).

Input Voltage / C3.5 / C2.5 / C1.5 / C0.5
0.0<Vin<0.5 / 0 / 0 / 0 / 0
0.5<Vin<1.5 / 0 / 0 / 0 / 1
1.5<Vin<2.5 / 0 / 0 / 1 / 1
2.5<Vin<3.5 / 0 / 1 / 1 / 1
3.5<Vin / 1 / 1 / 1 / 1

Converting an Analog Signal to DigitalComparator Outputs Based on Input Voltage

Voltage divider (to provide reference voltages):

Binary conversion

C3.5 / C2.5 / C1.5 / C0.5 / B2 / B1 / B0 / Display
0 / 0 / 0 / 0 / 0 / 0 / 0 / 0
0 / 0 / 0 / 1 / 0 / 0 / 1 / 1
0 / 0 / 1 / 1 / 0 / 1 / 0 / 2
0 / 1 / 1 / 1 / 0 / 1 / 1 / 3
1 / 1 / 1 / 1 / 1 / 0 / 0 / 4

Comparator Outputs Based on Input Voltage

EE1000 Project 4

Digital Volt Meter

Overview

In this project, we make a device that can measure voltages in the range of 0 to 4 Volts with one digit of accuracy. The input is an analog voltage and the output is a single 7-segment digit that tells us what that input voltage is to the nearest volt.

Design

Recall that when we are faced with a design problem, we need to follow these design steps:

  1. Understand the concept.
  2. Understand or create an algorithm to do the job – We’ll discuss this, below.
  3. If the problem is too complicated, subdivide and repeat, otherwise, design it.
  4. Test.

Approach (Algorithm)

One way to make (implement) this project is:

  1. Convert the analog signal to digital.
  2. Convert the digital data into binary data.
  3. Decode the binary data for the 7-segment display.

This algorithm can be illustrated by a block diagram (See Figure 1).

Figure 1 – Block Diagram

Recall that the arrows between the blocks represent information, not necessarily wires.

We will want to subdivide this design into 3 parts: (a) the digital conversion, (b) the binary conversion and (c) the 7-segment decoder and display.

Digital Conversion

The easiest way to convert an analog signal to digital is to use a comparator. A comparator takes two input voltages (labeled + and -) and outputs a high digital signal if the (+) input has a higher voltage than the (-) input, otherwise it outputs a low signal. We will need 4 comparators to compare the input to 0.5V, 1.5V, 2.5V and 3.5V as shown in Figure 2. The outputs of these comparators are digital signals we will call C0.5, C1.5, C2.5 and C3.5 respectively.

For this project, we will be using the MCP6544 quad comparator (4 comparators per chip). A pin diagram is included at the end of this document. Based on the input voltage, Vin, the output signals will respond as shown in Figure 3.

Input Voltage / C3.5 / C2.5 / C1.5 / C0.5
0.0<Vin<0.5 / 0 / 0 / 0 / 0
0.5<Vin<1.5 / 0 / 0 / 0 / 1
1.5<Vin<2.5 / 0 / 0 / 1 / 1
2.5<Vin<3.5 / 0 / 1 / 1 / 1
3.5<Vin / 1 / 1 / 1 / 1

Figure 3 – Comparator Outputs Based on Input Voltage

All that remains is to generate the fixed input voltages (0.5V through 3.5V). The easiest way to do this is by means of a Voltage Divider. A voltage divider is simply a bank of series resistors designed to produce one or more specific voltages. Since we have a regulated 5 Volt supply, we will use that for the Voltage Divider as shown in Figure 4.

The rule for the voltage divider is that the ratio of a resistor to the total resistance equals the ratio of the voltage across that resistor to the supply voltage. In other words,

In this case, Vtotal = 5V and Rtotal = 10K. If you work out the math, the voltage across the 1KΩ resistor is 0.5V, the voltage across each 2KΩ resistor is 1.0V and the voltage across the 3KΩ resistor is 1.5V. These voltage drops give us the various fixed voltages we need for the comparators. Notice that the resistor values can be scaled by any factor (e.g. doubled or halved) without affecting the voltages that are produced.

Conversion to Binary

Since the voltages we wish to display are in the range 0-4, it will be necessary for us to use a
3-bit signal to represent the voltage. We will call those bits B2, B1 and B0, with B0 being least significant (i.e. the 1’s bit). The binary signal needs to be generated based on the inputs C0.5, C1.5, C2.5 and C3.5 as shown in Figure 5.

C3.5 / C2.5 / C1.5 / C0.5 / B2 / B1 / B0 / Display
0 / 0 / 0 / 0 / 0 / 0 / 0 / 0
0 / 0 / 0 / 1 / 0 / 0 / 1 / 1
0 / 0 / 1 / 1 / 0 / 1 / 0 / 2
0 / 1 / 1 / 1 / 0 / 1 / 1 / 3
1 / 1 / 1 / 1 / 1 / 0 / 0 / 4

Figure 5 – Comparator Outputs Based on Input Voltage

The simplified logic equations for the 3-bit binary signals are:

You will need to design a logic circuit (much as you did in Project 3) to implement these equations. Your inputs and outputs are active high. (If active low inputs are desired, you can exchange the + and – inputs in Figure 2.)

7-Segment Decoder and Display

Decoding binary data for 7-segment displays is much like decoding binary data for the dice pips in Project 3, and we can certainly decode each of the segments with NAND and NOR gates, but fortunately an integrated circuit (IC) is available that can decode all 7 segments at once. The part number for that IC is 74LS47. The 74LS47 takes a 4-bit binary number as input. (Since we have only 3 bits, we will need to connect the 4th input to ground.). It also has a ripple blanking input (RBI) and a LED test (LT) inputs, both of which must be high (e.g. connected to Vcc) for the device to function properly. The 74LS47 has seven outputs labeled a-g, all active low, to drive the seven segments of the display. A typical circuit using the 74LS47 is shown in Figure 6.Pin diagrams for the 74LS74 and the display are available at the end of this document.

Figure 5 – 7-Segment Decoder and Display

Testing

Use one channel of the power supply to provide power to your circuit through the 5V regulator. Connect another power supply to Vin. Be very careful not to drive Vin over 5 Volts or under 0 Volts, as this may damage the comparator.

Vary the voltage on Vin from 0 to 4V and verify that the display shows the voltage (to the nearest volt). Note that minor errors can occur because the resistors you used to make the voltage divider have a tolerance of 5%.

Pin Diagrams


MCP6544 /
SA56-11SRWA

74LS47

I am in the Noon class Late afternoon class

EE1000 HW#12Name:

  1. What does ADC stand for?

______

  1. (true/false) Most ADCs generate a binary output.
  2. (true/false) The resolution of an ADC is specified by the number of bits it produces.
  1. An 8-bit ADC uses a 5.12 Volt reference. What is its step size (in Volts)?
  1. (true/false) A comparator has two digital inputs and an analog output.
  1. Draw a resistor divider circuit that has an output voltage of 1, 2, 3, and 4 volts. Assume Vcc = 5V.
  1. Draw a circuit that uses a comparator to output a high signal when its input is greater than 2.0 V and a low signal when its input is less than 2.0V. Again, assume Vcc is 5V. You may use your voltage divider from Problem 6.