4
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ Add another constraint to your toolset: the opamp has enormous gain, and forces the Vin- to be the same as Vin+(within a few microVolts). This fact allows the two sides of the opamp inputs (the 4 resistors) to interact. \$\endgroup\$ – analogsystemsrf Nov 18 '18 at 5:14
4
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ Thank you for your answer! Thinking of the output as a linear combination is interesting. I have never seen it described that way. I tried to recombine the inputs on paper, but looking at the equation, I thought maybe I could have just added another feedback resistor going to the non-inverting input. After carrying out the math, I can see it doesn't really work out. In your first step, would you be able elaborate a little bit more on why I need to attenuate the input? \$\endgroup\$ – Kamil Jarosz Nov 17 '18 at 19:44
  • \$\begingroup\$ Try the circuit without the attenuation. See what the transfer function ends up being. \$\endgroup\$ – Reinderien Nov 18 '18 at 4:07
  • \$\begingroup\$ Hello @Reinderien, sorry for replying so late, school and work get in the way. Anyway, going over the transfer function, I ended up with Vo = (R2/R1)*(Vin2-Vin1) + Vin2, but that just gets me where I started in the first example. I can see that I have the difference amplified by R2/R1 and offset by Vin2, which is what I ended up incorporating into design 2. It worked, but I would never have guessed to feed Vin2 through a voltage divider to get the same effect, barring any other factors like in/out impedance. \$\endgroup\$ – Kamil Jarosz Nov 20 '18 at 2:38
  • 1
    \$\begingroup\$ Alrighty. I took a little bit to ponder this whole thing and eventually found an answer based on your information Too long to summarize in the comments, so I added it as an edit to the original question. Thank you! \$\endgroup\$ – Kamil Jarosz Nov 21 '18 at 17:28
1
\$\begingroup\$

Note that your solution is not “wrong” it is simply not the most efficient or the one with the most desirable input characteristics in some applications. As engineers we are often dealing with under-constrained problems and we have to make decisions that impose their own constraints.

If the problem had called for the “highest possible input impedance” (something that the solution you think is ‘better’ does not satisfy) it is very likely you would have come up with a very different solution. One with non-inverting amplifiers at the input.

As a matter of fact, your solution seems to be the exact opposite of what that could look like. Take a look at a common instrumentation amplifier configuration common instrumentation amplifier configuration. From Analog devices.

Which is not what instrumentation amplifiers traditionally look like] traditionally look like. From Wikipedia.

All different solutions to the same problem, each one of them with different design choices and constraints.

\$\endgroup\$
  • \$\begingroup\$ Thank you Edgar for your reply. I understand where you're coming from, but I'm not really sure if it answers my question per se. The problem given to me only asked for a differential amplifier that amplifies the difference by two. It's a contrived classroom example. Anyway, I'm not so much concerned to figure out how to get the best design. I'm only trying to figure out how I could have arrived at the design that I found online without resorting to randomly adding components until it worked. Sorry if I was being unclear. Thanks again! \$\endgroup\$ – Kamil Jarosz Nov 20 '18 at 2:44
  • \$\begingroup\$ @KamilJarosz The main difference between an expert and a novice is that the expert has failed many more times. What you are missing is the intuition that comes from experience. Nowadays I seldom write equations when coming up with a circuit, I can achieve most of the design just by doing "schematic algebra in my head." Moving sources around, doing Thevenin/Norton equivalents, estimating time constants, doing Miller transformations, and a bit of basic algebra is all that is needed. I only need the equations when it comes time to verify my intuitions. That can only be achieved with experience. \$\endgroup\$ – Edgar Brown Nov 21 '18 at 17:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.