# Resistor DAC and buffer for VGA output

I'm in the process of designing a very simple binary weighted resistor DAC for an output stage of a RGB VGA driver. There will be 3 bits for R and G components and 2 for B. The output signal is analog voltage, from 0 (black) to 0.7 V (full brightness). The input bits (D0-2) will be driven by an ARM Cortex-M microcontroller, now tied to Vcc for simulation purposes.

VGA output was chosen for overall cost, so a cheap analog output buffer is desirable. I was thinking about three op-amps in non-inverted follower configuration and this is refected in the schematic, but I have NO practical knowledge whatsoever on implementing op amps in real life.

So I'd need any advice on:

1) The application itself. Am I choosing the right resistor values (current and voltage divider to 0.7p) having in mind that they will be handled by a MCU?

2) Op-Amp connection and IC part (single supply I think, three/four op-amps in a single IC desirable): Should I need a resistor in the feedback loop? What IC part would your recommend for this application?

3) A VGA cable 75 ohm impedance match on the analog output is desirable. is the schematic ok in this respect?

• Sorry for my intrusion, but have you implemented my answer? If you did, did it work as expected? or not? – Harry Svensson May 28 '18 at 21:08
• Hello @HarrySvensson, pcbs are already being fabricated. I'll let you know when I try your answer. Thanks! – conejoroy May 31 '18 at 20:16
• Hi @HarrySvensson, I'm very sorry I'm still not able to test it. Unfortunately the PCB coupons made to test your suggestion among others went wrong and I never got them. However I can confirm the technique used on the nexys boards "worked", but this was nothing new. – conejoroy Nov 19 '18 at 18:35

In your setup, you need to be very certain about the following things:

• That your 4.99 kΩ is 5 kΩ
• That your 10 kΩ is 10 kΩ
• That your 20 kΩ is 20 kΩ
• That your 768 Ω is 768 Ω

It looks like you will need 4 resistors and 4 potentiometers acting as rheostats for fine calibration.

I propose an R2R ladder setup.

• The upper half of the image is your DAC, the bottom half is the R2R ladder that I'm proposing you to use.

• The "H" is a logic high 3.3 V.

• The "L" is a logic low 0 V

Sure, there are more resistors, but look at their values. If you buy resistors in a batch, then the resistors will probably be very close to each others values, so if the 2 kΩ are actually 2200 Ω, then that's fine. Because the errors will even out. You can make the 1 kΩ resistor by putting two 2 kΩ resistors in parallel.

The 320 Ω is either done with only a potentiometer acting as a rheostat or a 330 Ω resistor with a potentiometer acting as a rheostat in parallel.

All in all, it's just one potentiometer acting as a rheostat, one resistor to calibrate, compared to yours that probably needs 4.

Now.. with that out of the way...

1) The application itself. Am I choosing the right resistor values (current and voltage divider to 0.7p) having in mind that they will be handled by a MCU?

Since you are going to work in the MHz range, then you will want to use smaller resistors so you can reduce the RC constant due to all the parasitic capacitances. In my opinion 10 and 20 kΩ are way too large for the high speed that you need.

2) Op-Amp connection and IC part (single supply I think, three/four op-amps in a single IC desirable): Should I need a resistor in the feedback loop? What IC part would your recommend for this application?

Sure, 4 op-amps in a single package sounds good. The pixel frequency appears to be 25.175 MHz. So I'd use a quad op-amp with a unity gain bandwidth of around 50 MHz. It's always good with margin. I can't recommend an exact IC because I'm not an expert on VGA => don't know how the rest of the schematic you're working with looks like.

You will indeed want a resistor in the feedback loop. It should have the same value as the total resistance that is seen from the + input of the op-amp.

So with the 5 kΩ, 10 kΩ, 20 kΩ, 768 Ω (that I do not recommend), you would use a feedback resistance of 605 Ω (5k//10k//20k//768 = 605).

With the R2R ladder that uses the 2 kΩ, 1 kΩ, 320 Ω (that I do recommend), you would use a feedback resistance of 242 Ω (1k//320 = 242).

And this feedback value is used due to the input bias current. With two equal resistances the offsets due to the bias currents will more or less cancel each other out.

3) A VGA cable 75 ohm impedance match on the analog output is desirable. is the schematic ok in this respect?

From the wiki link I made previously, it can be seen that the VGA system uses 75 ohm double-terminated impedance (18.7 mA, 13 mW).

And yes, your series termination placement makes sense. Just make sure that it can handle 13 mW.

Regarding the selection for your op-amp, here's several important parameters that will help you decide in finding the right one:

• It doesn't have to be rail-to-rail, it just needs to reach 0 V and 0.7 V. And many rail-to-rail that are fed 0 V and 5 V can't even reach 0 V and 5 V. So the low 0.7 V is easily reached with an op-amp that is not rail-to-rail with a 3.3 V supply. For the 0 V you will probably have to give a -1 or -2 or even -5 V supply for. Whatever is easiest to make.

• The unity gain bandwidth has to be above 25.175 MHz, add some extra for margin.

• You want 4 op-amps per capsule. You could go with one op-amp per capsule, but this doesn't really matter. It's just a taste of preference. I'd personally go for 4 op-amps per capsule because it's usually cheaper, though I am a cheap skate.

• The input bias current won't matter if you match the feedback resistor with the output impedance seen by the + input.

• The input voltage offset matters a little bit, but since you will most likely use a potentiometer anyways, the input voltage offset will be negligible.

So with the above parameters, this digikey search is available.

## Edit due to comments

I got inspired by you, conejoroy, for trying to solve it without an op-amp. So I found some solutions without it.

I usually don't show mega sized schematics on this site. But I'll make an exception.

• The 3 top circuits are made with your style.
• The 2 bottom circuits are made with the R2R style.
• Double click the transmission line and change it from 75 Ω to 60 Ω or 90 Ω to see how the real world will treat the signal. MMmm nice reflections. Tasty.

I believe you can see in the image above that you don't want 400 mV at the input of the other side of the transmission line. You want 200 mV there. The 75 Ω series termination resistance and the 75 Ω parallel termination resistance forms a voltage divider with a ratio of 2:1. So it will expect half the voltage, not the entire voltage.

Another thing that is worth noticing is that according to the VGA standard, you should have 75 Ω series termination resistance, the top one has 288 Ω. So you are not conforming to standards. Since you are disobeying standards, it's something I can't recommend. But then again, it is already double terminated, so if the sending side has some other output resistance than 75 Ω, then the termination resistance on the receiving side will handle it. In other words, your top circuit might work if you lower the 400 mV to 200 mV on the receiving side.

The second schematic has 75 Ω output impedance which matches the VGA standard. But the voltage is messed up, so this one is equally as wrong as the top circuit, so you'd need a fourth resistor somewhere to fix the output voltage... I don't really have enough time to calculate it, you can do that if you want.

The third schematic is what you first proposed in your question, and sure. Looks nice. I'm showing it to you to show you that the receiver expects 200 mV, not 400 mV, when the MSB = 1.

The fourth schematic has 75 Ω output impedance and correct voltage at the receiving end. The problem with that schematic is that the resistances are probably difficult to get. You could probably use 620 Ω resistors for the 618 Ω resistors and 2x 620 Ω resistors in parallel for the 309.4 Ω resistors. This way you will be conforming to the standard.

The fifth schematic is the same as the third schematic. Just R2R style.

This way you won't have to pay for an expensive op-amp.

• Excellent answer! your high-value resistor vs speed achievable is correct and I'll take your advice, but traces are short and (I think) the op-amp imput is not a capacitive load. Anyway.. yesterday I found that evaluation kits like the Nexys 4 DDR are using the 75 ohm parallel resistance on the monitors end as the 768 ohm resistance in my schematic and resizing the other series values accordingly tinyurl.com/ycfef3cs I couldn't believe my eyes. It doesn't seem "the right way to do it" but it do work nicely. – conejoroy Apr 12 '18 at 11:45
• For the prototype PCB I'll be using both paths for experimenting: the Nexys 4 hack for one and your suggestion (R-2R ladder with your values) with an MCP664; three rail-to-rail op-amps that seem to work right for my application (I understand it could handle 0-0.7v unity-gain with a single 3.3v supply). The op-amp is not cheap.. but I'm interested in measuring if there's any real-world advantage on using this approach. – conejoroy Apr 12 '18 at 12:01
• About your new edit: I think we have a winner! 619 and 309 ohm 1% resistors are widely available and very cheap. Since I already tried the Nexys style on their boards and it simply "works" along with several monitors and VGA to HDMI converters, for my project I'll be testing your new cheap R2R and my not so cheap op-amp. Answer accepted, thanks! – conejoroy Apr 13 '18 at 18:09
• Just a side note: while I'll be using a VGA "physical interconnection", the actual resolution will be standard HDTV 1280x720@60 Hz (720p) with h&v resolutions divided by 4 (pixel and line doubling). Nowadays, implementing a VGA controller is cheap and simple enough, but 720p and 16:9 extremely common enough to avoid using traditional 4:3 VGA modes. – conejoroy Apr 13 '18 at 18:23

Based on Mr. Svensson's answer.

## Finding the resistor values for a generalized R2R ladder DAC with matched impedance.

Known variables:

$$\{Z \mid\text{ desired impedance (e.g. 75 Ω)}\}$$ $$\{V_{dig} \mid\text{ digital I/O in volts (e.g. 3.3v)}\}$$ $$\{V_{max} \mid \text{ maximum output of the R2R DAC (see below)}\}$$ $$\{Bits \mid \text{ number of digital I/Os used (e.g. 3, 5, 8...)}\}$$ $$\{V_{pp} \mid \text{ analog signal swing (e.g. 0.7v)}\}$$

Variables we need:

$$\{R_{dac} \mid \text{ resistor to use for the R2R ladder}\}$$ $$\{R_{div} \mid \text{ resistor for the last voltage divider} \mid \text{impedance match}\}$$

Equations:

$$$$V_{max} = \frac{V_{dig}}{2^{Bits}}*2^{Bits}-1$$$$ $$$$V_{pp} = \frac{V_{max}}{R_{dac}+R_{div}}*R_{div}$$$$ $$$$Z = \frac{R_{dac}*R_{div}}{R_{dac}+R_{div}}$$$$

Examples:

3.3v digital I/O, 3 Bits, 75 ohm impedance and 0.7 Vpp

$$$$V_{max} = \frac{3.3}{2^{3}}*2^{3}-1=\frac{3.3}{8}*7= 2.8875v$$$$ $$$$0.7 = \frac{2.8875}{R_{dac} * R_{div}}$$$$ $$$$75 = \frac{R_{dac}*R_{div}}{R_{dac}+R_{div}}$$$$ Solving the equations, it yields:

$$\{R_{dac} = 309.375 Ω \mid \text{ the R in R2R }\}$$ $$\{2R_{dac} = 618.75 Ω \mid \text{ the 2R }\}$$ $$\{R_{div} = 99 Ω \mid \text{ the bottom of the voltage divider }\}$$

5v digital I/O, 8 Bits, 75 ohm impedance and 0.7 Vpp $$$$V_{max} = \frac{5}{2^{8}}*2^{8}-1=\frac{5}{256}*255= 4.98046875v$$$$ $$$$0.7 = \frac{4.98046875}{R_{dac} * R_{div}}$$$$ $$$$75 = \frac{R_{dac}*R_{div}}{R_{dac}+R_{div}}$$$$

Solving the equations again, we arrive at:

$$\{R_{dac} = 533.62 Ω \mid \text{ the R in R2R }\}$$ $$\{2R_{dac} = 1067.24 Ω \mid \text{ the 2R }\}$$ $$\{R_{div} = 87.27 Ω \mid \text{ the bottom of the voltage divider }\}$$

And the simulation.