# How to calculate resistor values for a VGA DAC

I have an FPGA and want it to drive a VGA monitor. I want more than 3 bits of color so I need a DAC of some sort. So I want to make a resistor dac. My plan is to have 3 bits per subcolor. So total of 9 bits per pixel. I know VGA monitors have an impedance of 75 ohm that I need to take into account, and I know they need 0 for black, and 0.7v for white.(per subpixel)

Problem is I don't know how to continue with this info, I believe I need to use algebra for this, but I'm still learning that and therefore have some issues calculating the correct resistor values.

So first I think I need to figure out what resistor value I need to get 0.7 v taking into account the 75 ohm to ground. Which wounds like a resistor divider to me, if I'm correct, when I use 3.3v as input, I'd need a 280 ohm resistor to approximately get 0.7v.(I used the formula on the wikipedia page for resistor dividers) But I don't know how to continue from here. How do I know what 3 resistor values I need that would give me the correct voltages?(Also, bit 2 needs to give more voltage than bit 0)

Can anyone help me with that? And also explain what you are doing to get me the values so I can learn it too?

In case I do need to use algebra, I only know the basics like solving 3x+3=2x+7 so a little help there would be appreciated.

Thanks!

The simplest thing to do is to build a 3-bit "R-2R" DAC for each channel, using 75Ω resistors. The cool thing about this kind of DAC is that its output impedance is simply "R", which means that you can connect it directly to 75Ω coax with no termination issues.

If you build a 4-bit DAC, but tie the MSB to ground, you'll get close to the voltage range you need: simulate this circuit – Schematic created using CircuitLab

The Thevenin source voltage is reduced by the voltage divider created by the Thevenin source resistance and the monitor termination resistance, resulting in a range of 0.00V to 0.72V on the line.

The worst-case load on any of the FPGA outputs is approximately 3.3V / 225 Ω = 15 mA.

• Of course he needs 0.75 ohm switches (or something moderately low). Aug 17, 2019 at 17:41
• Using only 75ohm resistors? How would that work? Won't that make the output like too low or soemthing? Aug 17, 2019 at 20:18
• I estimate with 75 ohm resistors the output voltage for a R2R DAC fed with 3.3V will be 1.65V when terminated into monitor. That's too high when target is 0.7V. Also the voltages being equally spaced linear voltages do not appear as equally spaced linear brightnesses; this is due to monitor gamma correction. Aug 17, 2019 at 21:55
• @Justme: See edit above. With only 8 levels per color channel, I'm not going to worry about gamma correction. Aug 18, 2019 at 1:56

The simplest solution is a binary weighted summing circuit like this:- simulate this circuit – Schematic created using CircuitLab

Now to calculate the resistor values. We want an output voltage of 0.7V when all inputs are high, and we also want the output impedance to be 75Ω. To simplify initial calculations the parallel combination of R1 to R3 we will call Rx, and R4 in parallel with the 75Ω monitor termination we will call Ry.

Rx and Ry form a voltage divider where 0.7V = 3.3V * Ry/(Rx+Ry). The terminated output resistance is 75Ω/2 = 37.5 = Rx|Ry = 1/(1/Rx+1/Ry). Rearranging these formulae we get Ry = Rx/((3.3/0.7)-1) and Ry = 37.5*Rx/(Rx-37.5). Solving the simultaneous equations we get Rx = 37.5+(3.3/0.7)-1)*37.5 = 176.8Ω. Now we can calculate R4. Rx|R4|75 = 37.5Ω, therefore R4 = 1/(1/176.8+1/75-1/37.5) = 130.3Ω.

Finally, we split Rx into 3 resistors with values increasing by powers of 2. Rx = R1|R2|R3 so 1/Rx = 1/R1+1/(R1*2)+1/(R1*4), and R1 = Rx+(Rx/2)+(Rx/4) = 176.8+88.4+44.2 = 309.4Ω. R2 = R1*2 = 619Ω, and R3 = R1*4 = 1238Ω.

One thing we haven't taken into account in our calculations is the impedance of the FPGA outputs. For best results you should subtract this from the values of R1, R2, and R3. However with only 8 levels the difference may not be noticeable. Use nearest 1% resistor values for accuracy, or 5% if you are not worried about getting exact colors.

• Thanks for your answer! his might be a stupid question, but how do you know what to multiply or divide with what? Is tehre like a wiki page about that I can read up on? Aug 18, 2019 at 11:20
• It's just basic algebra, stuff you should have learned at school (though if you are old like me it may take a while to recall some of the more advanced techniques). I also used a spreadsheet and LTspice simulation to check my calculations. Math is Fun: Algebra Resistors in Series and Parallel Aug 18, 2019 at 20:06
• Ah ok, thanks. I'm actually still in school and we have only covered the very basics of algebra and I'm not that good in it yet. Maybe I'll learn more soon to understand it better. Thanks for your help! Aug 19, 2019 at 17:03