# Determining DC gain of single supply op-amp (no AC component)

I'm building a homebrew PIC programmer, and want to support devices with varying Vpp voltages, so I'm using the DAC output of a PIC16F1825. But the PIC is supplied with a +5V Vdd, so that's the maximum output of the DAC. I can use an opamp to increase that voltage with an available +12V rail using the following circuit (DAC buffer opamp stage not shown):

simulate this circuit – Schematic created using CircuitLab

What has me mystified is how to determine the voltage gain in this circuit apart from trial and error with R1 and R2 values. Ideally, in this case, I'd like a gain of about 2.5 with signals referenced to ground (the real ground, not a virtual one as is typical in single supply AC amplifiers).

For normal dual-supply AC amps, I have a formula of 1+(R2/R1), but that doesn't seem to be valid here.

So my question is: is there a formula to determine the gain produced with a given R1 and R2 or, conversely, to determine R1 and R2 to produce a given gain?

(I could probably accomplish this with a simple transistor, but since I need the DAC buffer anyway, I have a spare opamp available)

## 1 Answer

I have a formula of 1+(R2/R1), but that doesn't seem to be valid here.

It's perfectly valid; $\dfrac{V_O}{V_I} = 1+\dfrac{R_2}{R_1}$

Think about how an op-amp works when negative feedback is applied; the output, via R2 and R1 sets the inverting input to equal the voltage on the non-inverting input. In doing so the output must be higher because of the potential dividing effect of R1 and R2.

The op-amp is like a servo system. You set a target voltage on Vin and the output finds a level to make -Vin almost exactly match +Vin. Ignoring DC offset errors (a mV or so) the closeness that the output pushes the two inputs together is determined by open-loop gain which, for an op-amp is generally about 1,000,000 (this can be more or it can be less depending on the op-amp chosen).

If R2 is 5 times bigger than R1 then Vout is 6 times bigger than -Vin. If +Vin is 1 volt then the output is 6 volts in order to maintain the two inputs at the same voltage (with an error because of small dc offsets and the op-amp gain not being infinite).

• Thanks. It turns out I had been making assumptions in my test circuit that weren't valid. I had R2=4.7K and R1=3K and measured 8.9V with what I thought was 2.5V in. That 2.5V turned out to be 3.5V. With the real Vin, Vout is now what the formula predicts. – AndrewTPhoto Mar 28 '15 at 17:44