하드웨어 > The R-2R resistor network

TODAY684 TOTAL2,229,242
사이트 이용안내
Login▼/회원가입
최신글보기 질문게시판 기술자료 동영상강좌

아두이노 센서 ATMEGA128 PWM LED 초음파 AVR 블루투스 LCD UART 모터 적외선


BASIC4MCU | 하드웨어 | OPAMP | The R-2R resistor network

페이지 정보

작성자 키트 작성일2017-08-25 11:00 조회1,472회 댓글0건

본문

8-bit Digital to Analog converter(DAC)

Using R/2R resistor network

By Ibrahim Kamal 
Last update: 5/5/08
Learn how to build an Analog to digital converter using the same simple technique explained in this page. click here.

 

3660040649_8SaYH41P_o2.gifOverview
3660040649_6qwGetgA_line2.gif
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 article also discuss a problem encountered by many beginners while trying to build their own DAC, and proposes some very simple solutions to that problem.
3660040649_dYerXGVn_adc08.jpg

Through this article, I am going to explain how to build an 8-bit digital to analog converter with parallel input. If you don't know what this means, well its simply a circuit that will take as input a digital 8-bit number from 0 (00000000) to 255 (11111111), and output the relative value on a scale from 0 to 5v. 

The maths that describe 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.
3660040649_0s27fDoF_dac08_2.jpg
3660040649_G27nqWaw_p3.gifSome vocabulary
DAC: Digital to Analog converter
D0, D1, D..:
 Data lines
Analog: Continuous electrical signals
Digital: Method of representing information using "1" and "0" (usually 5v and 0V)
LSB: Less significant bit.
MSB: Most significant bit.


3660040649_8SaYH41P_o2.gifThe R/2R resistor network. 
3660040649_6qwGetgA_line2.gif
The digital data entering thought the 8 lines (D0 toD7) are going to be converted to an equivalent analog voltage (V out) by the mean of the R/2R resistor network. Actually a lot of commercial 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 and 20K), in on of my circuits I used 1M ohm and 470K ohm resistors, which is quite near to the R/2R ratio, and this small difference didn't cause any detectable
3660040649_yKnMs2I0_r2r2520.jpg
Follow the colors on the schematic and on the description text respectively, it can help!
errors in most applications. However, if you want to build a very precise DAC, be precise when choosing the values of the resistors that will exactly match the R/2R ratio.

Note that you can build a DAC with any number of bits you want, simply 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 ground (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.


3660040649_8SaYH41P_o2.gif The applied circuit 
3660040649_6qwGetgA_line2.gif
3660040649_N2mXq5rU_8bitdac.jpg
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.

3660040649_98rKYUmP_p1.gifStage 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...

3660040649_98rKYUmP_p1.gifStage 2: the voltage buffer
This stage will isolate the point V1 from the final output V2, while always 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 output connected to the inverting input (this special configuration of the Op Amp is also called Voltage Follower). The most important things to note are:

13660040649_G27nqWaw_p3.gif
 No current (almost 0A) will flow from the point V1 into the opamp, so we wont be disturbing the resistor network configuration
23660040649_G27nqWaw_p3.gif V2 will always equal V1 (theoretically, see the rest of this document)
33660040649_G27nqWaw_p3.gif The current going out from the point V2
 to any other stage is sourced from from the power supply of the OpAmp. 



3660040649_8SaYH41P_o2.gifThe most encourted problem & some solutions 
3660040649_6qwGetgA_line2.gif
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.

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 little deeper into the problem, the actual output curve in redshould 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.
3660040649_ikFYO0ze_adc_error.jpg
3660040649_98rKYUmP_p1.gifSolution 1 :
3660040649_VGSwX9HN_8bitdac_2.jpg 
The first solutions - shown in the red shading - is to increase the supply voltage of the Op-Amp, as shown in the schematic. this will totally solve the problem, and, whether you are supplying 6.5 volts or more, you will get neat linear output from 0V to 5V.

3660040649_98rKYUmP_p1.gifSolution 2 :
3660040649_sbpHkTKQ_8bitdac_3.jpg
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 [0 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).

I hope this introduction was interesting, and that it will help you to build simple but reliable DACs to suit your application.

댓글 0

조회수 1,472

등록된 댓글이 없습니다.

하드웨어HOME > 하드웨어 > OPAMP 목록

게시물 검색

2022년 1월 2월 3월 4월 5월 6월 7월 8월 9월 10월 11월 12월
2021년 1월 2월 3월 4월 5월 6월 7월 8월 9월 10월 11월 12월
2020년 1월 2월 3월 4월 5월 6월 7월 8월 9월 10월 11월 12월
2019년 1월 2월 3월 4월 5월 6월 7월 8월 9월 10월 11월 12월
2018년 1월 2월 3월 4월 5월 6월 7월 8월 9월 10월 11월 12월
Privacy Policy
MCU BASIC ⓒ 2020
모바일버전으로보기