BERBAGILAH DALAM HAL KEBAIKAN TERMASUK ILMU WALAU CUMA SETITIK....

6/28/2011

8-bit Digital to Analog converter(DAC)

Overview
This article aims to introduce to beginners and intermediate readers a simple solution to build a
digital to analog converter, based on the famous r/2r resistors network. This tutorial also
discuss a problem encourted by many amateurs while trying to build their own DAC, and propses a
very simple solution to that problem.
         
We are going to build an 8-bit digital to analog conveter with parallel input. If you don't know
what this means, well its simply a circuit that will take as input a digital number from 0
(00000000) to 255 (11111111), and output the relative value on a scale from 0 to 5v. if you know
nothing about binary numbers, bits, and op-amps, i suggest you learn some basic electronics
first.
The math for this process is very simple, an 8 bit converter will divide the 5 volts into 255
steps, each step having a value of:
5/255 = 0.019 V
Then the output voltage for the converter should be equal to the binary input multiplied by the
step value, e.g. for an input of 129 (1000 0001 in binary) the output voltage should be:
129 X 0.019 = 2.451V
Here is a simplified functional diagram of an 8-bit DAC.

               

The R/2R resistor network.
The digital data entring thought the 8 lines (D0 to D7) are going to be converted to an
equivalent analog voltage (V out) by the mean of the R/2R resistor network. Actually most of the
comercial Digital to Analog converter ICs are based on this same principle. The R/2R network is
build by a set of resistors of 2 values, with one of them double the other (example 10K
Follow the colors on the schematic and on the description text respectively, it can help!
and 20K), in on of my circuits I used 1M ohm and 470K ohm resistors, wich is quite near to the
R/2R ratio, and this small difference didn't cause any detectable errors in most applications.
However, if you want to build a very precise DAC, be precise when chosing the values of the
resistors that will exactly match the R/2R ratio.
    
One last note here, you can build a DAC with any number of bits you want, simple by enlarging the
resistor network, by adding more R/2R branches (like the one shaded in green), BUT you must keep
the 2R resistance connected to groud (shaded in light red)
Going through the mathematical proof for the operation of this converter can be a pain for some
of us, and I am only intending to keep things simple.

Now, in order to use this Resistor Network (also called R/2R Ladder) for real applications, you
will have to build a very simple voltage buffer circuit, which will be explained in the next
section.
 The applied circuit



Follow the colors on the schematic and on the description text respectively, it can help!
All the components are labeled on the circuit, so i'll start directly to explain how it works. to
simplify this task, i'll split the circuit into 2 main stages: the Digital to analog converter
and the Voltage buffer stage.
 Stage 1: the Digital to analog converter (The R/2R network)
This part have been explained in detail in the previous section, its purpose is to create the
voltage V1 which is equivalent to the weight of the binary number on the lines (D0 to D7). Now
that this is a resistor network, if we apply any load on the output of the first stage, this load
will be considered as an additional resistor in the network, and thus will disturb the network
which will no longer provide the correct & desired output voltage. Therefore, to overcome this
problem, we need a voltage buffer, here is where the next stage comes...
 Stage 2: the voltage buffer
This stage will isolate the point V1 from the final output V2, while allways keeping the voltage
V2 at the exact same value of V1. This is what we call a voltage buffer. for the voltage buffer
we use an opamp with the ouput connected to the inverting input (this special configuration of
the Op Amp is also called Voltage Follower). The most imortant things to note are:

1.  No current (almost 0A) will flow from the point V1 into the opamp, so we wont be disturbing
    the resistor network configuration
2.  V2 will allways equal V1 (theoretically, see the rest of this document)
3.  The current going out from the point V2 to any other stage is sourced from from the power
     supply of the OpAmp.
 The most encourted problem & some solutions
A quick look on those 2 graphs can be sufficient to understand the problem: the output of the
op-amp is not linear on the full 0-to-Vcc scale. actually an OpAmp, depending on its type, will
deliver a maximum voltage of (Vcc - 0.5V), where Vcc is the supply voltage of the OpAmp. So, in
our application, the OpAmp will only deliver 4.5V even if theoretically it should deliver 5V.

Some of you may think this caused by the resistor network, but it's not! this is a limitation in
the op-amp itself.
Lets get a litle deeper into the problem, the actual output curve in red should be linear, but
actually it begins loosing its linearity beginning from 3.9 volt. (Again this depends on the type
of OpAmp, those results a based on my own tests on a LM350 OpAmp) The red 'Error zone' is where
the output of the DAC no longer math the relative binary input.

This is the error we will be trying to overcome in the next part, through 2 very simple
solutions.             
 Solution 1 :


The first solutions - shown in the red shading - is to increase the supply votage of the Op-Amp,
as shown in the schematic. this will totally solve the problem, and, wether you are supplying 6.5
volts or more, you will get neat linear ouput from 0V to 5V.
 Solution 2 :


The second solutions - shown in the red shading - is to reduce the range of the input to [0 to
127] from the original range of [o to 255]. This will result on a voltage swing of 0 to 2.5 volt
at the output, which will be in the linear operating area of the Op-Amp (this done by attaching
the MSB line to ground, this way you only control the 7 other lines, and a 7 bit value can swing
from 0 to 127).
Finally with what you should have learnt in this introduction, you should be able to build
reliable DACs to suit any application like generating all kind of wave-forms.
Share

No comments:

Post a Comment