Electronic – What step have I missed designing this differential amplifier

designdiff-ampoperational-amplifier

First time posting on EE.SE and I hope this question isn't too broad. This will be a long post. I should also point out: I'm asking the process and not the solution the problem. I've did create a circuit that works, but I also found a circuit online that is simpler and probably performs a lot better in real life. The core question here is: what path/thought process could I have taken to arrive at the more concise solution? I understand my design well, and it works, at least in LT Spice, but it uses more components to get there. I understand the math behind both solutions and why they both work, so I don't need that to be explained either. It's only the way/path to achieve the latter solution that eludes me.

The task: Design a circuit that will amplify the difference between two input voltages by two.

My procedure: I cracked open LT Spice, and immediately started of with an op-amp. First I wanted to find a working topology (I can work out the exact values later). I hooked up both input voltages to the two inputs and ran a feedback resistor to give me a gain of two.

enter image description here

Pardon the cluster of a circuit (just a prototype). The difference between Vin1 and Vin2 is about 1 V, but Vout is 3 V. That's obviously wrong, and I quickly realized why. Sure, the difference is amplified by 2, but it is subtracted from Vin2, which gives not 2 V, but 3 V (Vin2 = 5 V, so 5 V – 2 V = 3 V at Vout).

The first attempt made me realize a couple of things. My desired result does appear in this solution, but it is 1) inverted and 2) with respect to Vin2, not ground like I expected. Having analyzed it, it's now obvious, but it wasn't before (beginner brain, oh well). Since the non-inverting input seems to be the reference here, I figured I just have to set it to ground and then feed the difference between Vin1 and Vin2 into one of the inputs.

Combining the voltages is easy, but one of them needs to be inverted so that they cancel out via superposition. The only thing that would be left would be the difference, which can be fed into the amplifier stage. I decided to feed Vin1 through an inverter. The other voltage gets superimposed directly, and the difference is fed into an amplifier with gain 2, giving the circuit like so:

enter image description here

The simulation verifies that the circuit works as expected. The task requirements are satisfied.

After having gone through the design process by myself, I looked up a differential op-amp amplifier online and found this guy (from electronics-tutorials.ws):

enter image description here

What the heck! How did I miss that? This hasn't even crossed my mind! After failing with feeding Vin2 into the non-inverting input, I reworked my design based on my observations. I observed that Vout will be a voltage offset with respect to the non-inverting input, and following that, I arrived at a working solution. But this is also a working solution! What could have I possibly observed about my initial attempt that would have led me to discover the simpler solution presented on electronics-tutorials? I feel like there is a mindset here that is completely lost upon me, and I'm trying to find it. I'm hoping you guys who would have come up with a design like this right away can help by pointing me towards that missing link. Ya'll are much smarter than I. 🙂

EDIT: I took a couple of days to ponder this problem, and I think I figured out how to get there. As per Reinderien's suggestion, I've taken the initial circuit I had and figured out the transfer function:

$$V_{out}(t) = \frac{R_2}{R_1}(V_{in2}(t)-V_{in1}(t)) + V_{in2}(t)$$

Which is basically what I already expected from the simulation I ran in LT Spice. I get the difference between the two inputs, multiplied by the gain, and offset by the input at the non-inverting op-amp pin.

I started to think about how I could get rid of the offset Vin2. I needed to somehow get both Vin2 terms to cancel out to get just the difference. The method dawned on me when I remembered that this is kind of what you get if you calculate a Thevenin's equivalent circuit. For example, in a simple voltage divider circuit, we end up with the source voltage multiplied by a factor determined by the resistors. The current here isn't of particular importance since the ideal op-amp doesn't draw any current itself, so it does not load the equivalent network (yes, I understand that in the real world, the input impedance would matter considering the voltage source would then be loaded, but for the sake of argument, and considering it is a basic electronics class, assume the planets align just right). So, I got on with the algebra as follows (to simplify latex, Vin1(t) -> V1 and Vin2(t) -> V2):

$$\begin{eqnarray*}
\frac{R_2}{R_1}(V_2-V_1)&=&\frac{R_2}{R_1}(\alpha V_2 – V_1) + \alpha V_2\\
&=&\frac{R_2}{R_1}\alpha V_2 + \alpha V_2 – \frac{R_2}{R_1}V_1\\
&=&V_2 (\alpha \frac{R_2}{R_1}+\alpha ) – \frac{R_2}{R_1}V_1\\
&=&\frac{R_2}{R_1}\left[ V_2(\alpha +\frac{\alpha R_1}{R_2}) – V_1\right]
\end{eqnarray*}$$

The equation on the left and right are the same, except for the (a*R2/R1 + a) factor. On the left, the matching coefficient is 1. There is only one possibility. Whatever a is, that whole thing needs to work out to 1, so

$$\begin{eqnarray*}
1&=&\alpha + \frac{\alpha R_1}{R_2}\\
R_2&=&R_2\alpha + R_1\alpha\\
R_2&=&(R_2 + R_1)\alpha\\
\frac{R_2}{R_2 + R_1}&=&\alpha
\end{eqnarray*}$$

I think that's fairly satisfactory. When we attenuate Vin2 by the complementary ratio (for lack of a better word) of the gain, the sums work out just right.

Best Answer

You say you understand the math, so I won't (re)explain it to you. You say you want the process.

The process is -

  1. Start with a basic understanding of the theory. One single op-amp can produce an output that's a linear combination of the two inputs. Any resistive divider prior to the op-amp will attenuate its input; you need this behaviour in this case.
  2. Build a circuit with symbols instead of values, and calculate the expected output as a function of its inputs.
  3. Insert "reasonable values" for some unknown resistors until the solution is not underdetermined. In this case, "reasonable" may be 1k or 10k, for instance, but this also requires knowledge of the application, including the input impedance of the op-amp and output impedance of the prior stage.
  4. Solve for the remaining values.
  5. Simulate to confirm your circuit.

Quite honestly, after doing work in this field professionally for any length of time, most people memorize the common circuits and skip the first few steps automatically. Whereas professionals understand the theory, they usually don't need to reiterate it once they understand and remember the common solutions.