PDA

View Full Version : Discussion Add Two Voltages With Op-amp


Richard Ingram
Jun 14, 2008, 01:05 PM
I want to add two small voltages with an op-amp. Both voltages will be less than 1 volt. I have looked at the LM358 since is uses a single supply vs. the dual supply. There is an example in the LM358 datasheet for a summing amp. For some reason it didn't work for me when I threw it together.

JohnMuchow
Jun 14, 2008, 04:35 PM
It can definitely be used to sum voltages. Not much we can help with unless you tell us how you hooked it up. :)
Post the schematic and we'll take a look.

Richard Ingram
Jun 14, 2008, 08:23 PM
Here's the circuit I am using. I am applying voltage to V1 and V2 via pots across the Vdd line. I must be missing something here because this is really simple stuff. So far no addition of voltages that I can see. Where am I screwing this up ?

Thanks

mjsas
Jun 14, 2008, 09:41 PM
The voltage at pin 3 is not quite V1 + V2. Since the current into pin 3 is very small the circuit is just a three resistor network between V1, V2 and ground. If the resistor to ground was about 100 ohm it would be close to an adder.
To make it work you will need three amps, one to add V1 and V2, one to invert the V1 +V2 signal and the third to subtract V3 and V4.

JohnMuchow
Jun 14, 2008, 10:33 PM
Yup, that's a classic adder-subtractor. The data sheet mentions that you need to keep (V1 +V2) > (V3 + V4) in order to have Vo >0. What are your voltages at V3 and V4?

Do you have any voltage at all at the output?

What are you doing with the other half of the LM358? Don't just ground the inputs, it can go nuts. Set it up as a basic voltage follower with an input to any convenient voltage you have laying around between Vdd and GND. Or just use two more 10K res. to create a voltage divider to the input.

The TI handbook of Operational Amplifier Applications has some great info and more circuits for classic inverting adders (unless you need a adder-subtractor) and even a non-inverting adder. Document SBOA092A.

Richard Ingram
Jun 15, 2008, 08:56 AM
I do not have an input to V3 and V4. The second half of the LM358 is not connected. It looked like they were independent of each other. Vout is definitely not V1 + V2 and I can't make sense of what going on. Using two pot (10K) across Vdd to Gnd as the input to V1 and V2 should be fine, right ?

JohnMuchow
Jun 15, 2008, 09:22 AM
OK, that could definitely be the problem.
You can never have unconnected inputs on an op-amp. It can cause all sorts of trouble as the input "floats" and rises/falls to all kinds of different voltages.
Definitely put voltages on V3 and V4 and connect the second op-amp as I described earlier. From there you'll be able to explore what the different voltages do at each of the pins.

And add a 0.1uF ceramic decoupling capacitor, with its leads cut as short as possible, directly connecting the Vdd and GND leads of the LM358.

I'm assuming that you have triple-checked that your Vdd is within the range that the LM358's specs, that GND is actually at GND, and the the supply is pretty "quiet" (electrically). Lots of trouble can be caused if your supply isn't set up correctly.

If all of the above fails, try another LM358.

John

slipstick
Jun 15, 2008, 10:20 AM
The two halves of the LM358 are reasonably independent though it's still safer to have the other half connected up to some sensible setting.

However V3 and V4 in your circuit MUST have voltages on them. Unconnected inputs will float to random levels. If you want them to subtract zero from the total output then connect them directly to 0V (i.e. ground).

Steve

Richard Ingram
Jun 15, 2008, 06:17 PM
If V3 and V4 are not needed is it permissible to connect the minus input directly to ground without the resistors ?

vintage1
Jun 15, 2008, 06:38 PM
Holy :censored:

One guy is talking about two independent opamps in a package, and the other about two inputs of a differential amplifer..

If you want to use ground referencing, don't use a single rail op-amp. Use +ve and -ve supplies..

Anyway, if you want to add to voltages together and both are positive, that circuit should work.

Connect V3 and V4 to ground and don't mess with the resistor values.

vintage1
Jun 15, 2008, 06:41 PM
..how did that double post? oh well

Dan Baldwin
Jun 15, 2008, 09:01 PM
I think that if you ground V3 and V4 you will see V1 and V2 added at the output.

Dan

jeffs555
Jun 15, 2008, 10:31 PM
The big question is what gain do you need? The three resistors on the positive input form a divide by 3 voltage divider. If you leave V3 and V4 open, the op amp will work fine but will have a gain of 1 and the output will be 1/3*V1 + 1/3*V2. If you connect V3 and V4 to ground, the op amp will have a gain of 3 and the output will be V1 +V2. The other thing is that the source impedance also becomes part of the input voltage divider. If you are using high value pots to get the input voltages that could be your problem. With 10k resistors, the source impedance would have to be less than 1k just to get 10% accuracy. You could raise the value of all resistors to work with higher source impedance.

PS If you just need to sum 2 voltages you can eliminate the resistor to ground and eliminate the V4 resistor.

Richard Ingram
Jun 16, 2008, 03:44 PM
What I need is to input a voltage between 0 and 1 volt on V1 and a fixed voltage of say 0.2 volts on V2 and the output would be the sum of those two voltages. I don't need V3 or V4. So is that a gain of 1 ?

I am using 10K pots right now to derive V1 and V2 from Vdd so maybe I need to go to 1K pots.

Dan Baldwin
Jun 16, 2008, 04:13 PM
What I need is to input a voltage between 0 and 1 volt on V1 and a fixed voltage of say 0.2 volts on V2 and the output would be the sum of those two voltages. I don't need V3 or V4. So is that a gain of 1 ?

I am using 10K pots right now to derive V1 and V2 from Vdd so maybe I need to go to 1K pots.

If you don't use V3 anv V4, you have to ground them. You can't just let them float. You could replace the resistors on V3 and V4 with a 5K resistor to ground.

Dan

jeffs555
Jun 16, 2008, 06:04 PM
What I need is to input a voltage between 0 and 1 volt on V1 and a fixed voltage of say 0.2 volts on V2 and the output would be the sum of those two voltages. I don't need V3 or V4. So is that a gain of 1 ?

To understand the circuit you can separate it into two parts.

The first part is the three resistors connected to the positive input form a resistive summing network. You have 3 equal resistors with one end of each conected together. If you call the ends of the resistors Va,Vb,Vc then the equation for the center point is 1/3*Va + 1/3*Vb + 1/3*Vc. This works for any number of resistors. Two resistors would be 1/2*Va + 1/2*Vb, and four resistors would be 1/4*Va + 1/4*Vb + 1/4*Vc +1/4*Vd. In your case, since one resistor is grounded(ie 0) you have 1/3*Va + 1/3*Vb +1/3*0.

The second part is the op amp which does two things. It amplifies the voltage and also isolates the resistive adder from any effects of the load. An op amp has a gain on the order of 10,000 or more, but you only need a gain of three. You apply negative feedback to set the gain on an op amp. For a non-inverting amp this is normally a resistor from the output to the negative input and a resistor from the negative input to ground. If you call these resistors Rf and Rg then the output is the voltage applied to the pos input multiplied by (Rf+Rg)/Rg.

In your circuit Rg if V3 and V4 are connected to ground, Rg is equal to two 10k resistors in parallel(ie 5k). The the gain is (10k+5k)/5k = 3. This multiplies the 1/3*V1 + 1/3*V2 by 3 to give an output of V1+V2.



If you don't use V3 anv V4, you have to ground them. You can't just let them float.
V3 and V4 will not float. If V3 and V4 are not connected to anything, the negative input to the op amp will still be connected to the output of the op amp through a resistor. Like I said, that connects the op amp as a unity gain amplifier. If the V3 and V4 are not connected, they are effectively infinite resistance, and the gain equation becomes (infinity+10k)/infinity which equals 1.

JohnMuchow
Jun 16, 2008, 06:09 PM
V3 and V4 will not float. If V3 and V4 are not connected to anything, the negative input to the op amp will still be connected to the output of the op amp through a resistor.Ah!! I totally missed that when I replied. :o Thanks for pointing that out!