Noob wants to know: How does gain work?

Started by sprog, April 12, 2008, 12:38:06 AM

Previous topic - Next topic

sprog

For some reason I can't understand gain. I know it is the difference between input & output voltage, but how can a bigger resistance make more gain? Seems to me that a bigger voltage drop would make less current flow, and less gain. What am I missing?

dxm1

Bigger resistance...where?  Can you quote the circuit that is confusing you?

bkanber

Resistors don't make gain; op-amps, transistors, and valves do. It is the circuit around these components that determines the value of the gain.

I would suggest looking up a simple op-amp circuit. For the simplest inverting op-amp circuit, it is the ratio of two resistors that determines the gain. This result isn't exactly intuitive, but if you apply nodal analysis and write out the equations, the ratio becomes clear as day. You get Vout = (R2/R1)Vin (or something like that). In that case, increasing R1 or decreasing R2 increases the gain.

Good luck
  Burak
Burak

sprog

Quote from: dxm1 on April 12, 2008, 12:45:06 AM
Bigger resistance...where?  Can you quote the circuit that is confusing you?

Well, no.. not really. I've been lurking here for awhile & have read hundreds of pages so far, but can't pinpoint a specific one. I've noticed a few that talk about using higher value pots to increase gain (or I guess better said the value of the gain?). I've tried reading basic electronics about this, but I can't seem to find anything that makes sense in respect to making a distortion pedal. The basic electronics stuff doesn't seem to mesh with the effects building aspect just yet in my tiny brain. I know I'm missing somehting really simple, but to me it's anything but simple.

Quote
Posted by: bkanber
Resistors don't make gain; op-amps, transistors, and valves do. It is the circuit around these components that determines the value of the gain.

I would suggest looking up a simple op-amp circuit. For the simplest inverting op-amp circuit, it is the ratio of two resistors that determines the gain. This result isn't exactly intuitive, but if you apply nodal analysis and write out the equations, the ratio becomes clear as day. You get Vout = (R2/R1)Vin (or something like that). In that case, increasing R1 or decreasing R2 increases the gain.

Good luck
  Burak
Thanks for the info. I'm pretty green - I'll have to google 'nodal analysis'.......  :icon_redface:

I'll sit down with some paper & a pencil & see if I can figure that out.


bkanber

Here's a few links to pages about op-amps. As I said, the simplest op-amp circuit is the inverting amp.

http://www.williamson-labs.com/480_opam.htm
http://ourworld.compuserve.com/homepages/Bill_Bowden/opamp.htm (some stuff about op amp filters)
http://en.wikipedia.org/wiki/Op-amp

There are a few rules to follow when analyzing op amp circuits:
1) The voltage between the inverting and non-inverting inputs are always the same (ideally)
2) No current flows into either op amp input (ideally)

Nodal analysis is just summing up the currents entering a node. The easiest way is to use Ohm's law (V=IR, or I = V/R)

Look at the inverting op amp circuit from the second link. An op amp and two resistors, Ra and Rb is all you need.
Following rule 1, the voltage at the -ve input is the same as the V at the +ve input. The +ve input is grounded, so Vpos_in = 0. Vneg_in = Vpos_in = 0.
The currents flowing into a node must add up to zero (thats the same as saying the currents flowing into a node equal the currents flowing out of a node).
Lets call the node between Ra and the -ve input node 1. The currents flowing through that node are (Vsignal - Vneg_in)/Ra and (Voutput - Vneg_in)/Rb. (Vsignal is the input signal on the left, Voutput is the amplified signal on the right). Vsignal-Vneg_in is the voltage drop between the input and the first node. Likewise, Voutput-Vneg_in is the voltage drop across the output and the first node. Those are the only two currents, because rule 2 says that none of the current flows into the op amp. Since currents need to add up to zero:

(Vsignal - Vneg_in)/Ra + (Voutput - Vneg_in)/Rb = 0

I'll substitute 0 for Vneg_in, because of Rule 1 (Vneg_in = Vpos_in, which is grounded, and thus 0V.. roughly). I'll also rearrange.

Vsignal/Ra = - Voutput/Rb

Multiply both sides by -Rb, and you get

Voutput = -(Rb/Ra) * Vinput.

Easy, right! You may want to practice this same analysis on the non-inverting op amp, and you'll see at the end that the result is similar, except without the negative sign. In this case, the gain is -(Rb/Ra). If you choose Rb=Ra, the gain is unity, except negative. So it'll take a positive voltage and give you the same voltage, but flipped. ie, if your signal is +3.3v, you'll get -3.3V. If you choose Rb/Ra = 3, then an input of +3.3V will give you an output of -10V. Note though, that op amp output can ONLY BE AS BIG AS THE SUPPLY VOLTAGE. If your supply voltage is only 9V, the biggest voltage you'll get at the output is 9V, no matter what the gain is.

If you still have any questions, just ask! This stuff is easy once you've done it a lot, but it takes a bit of practice, and a whole bunch of questions before you get there :)

Burak
Burak

sprog

Wow, thanks for taking the time to write all of that, Burak! That is quite a lot of info, I'll have to chew on it for awhile. I think a light bulb is trying to go off in my brain.....  :icon_biggrin:

If the noninverting (+) input is grounded, the input voltage & input current both equal zero because of the relationship between the input series resister & the feedback loop resistor? I'm confused in a different way now! I don't understand the zero input voltage part. Isn't the guitar signal considered a voltage? If so, wouldn't this give a voltage @ the input?

So, the output voltage can never be more than the power supplied to the opamp? If I were to make a circuit with 12v or 18v would it sound 'bigger' (I think it's called 'headroom'?) because of the higher output voltage? Or would it tear up other effects and/or my amp? If I had a schematic for a circuit that was using 9v & I wanted to redo it for 12v or 18v, I suppose I would have to change all of the component values around the opamp, the ones that control it? Or would I want the higher current? Geez, I hope I'm not getting in over my head.... :-[


Sorry for being so ignorant of all this.... at least I'm in the right place & I really want to learn.

I'll read & re-read the info you gave me.

bkanber

The simple answer is that op-amps are magic.

Rules 1 and 2 above are for the ideal case. There will be SOME voltage difference between the two op amp inputs, but the difference is entirely negligible. Also, there is SOME current flowing into the amp, but that's also negligible.

The guitar signal is a voltage, yes. But that doesn't necessarily mean that there's a voltage at the inverting input. If the non-inverting input is grounded, and there's Rule 1 which says there's no voltage difference between the non-inverting input and the inverting input, then you can sort of look at the +ve and the -ve op amp inputs as being connected to each other by a short. In this case, then, the -ve input shorts to the +ve input which shorts to ground.

So, now consider a guitar signal just going through a resistor to ground. Is there now a voltage at ground? Absolutely not. It's the same sort of thing for the op amp.

The reason I say op amps are magic though is this: I just said that because of Rule 1 (no voltage diff), you can see the two op amp inputs as being a short circuit. But now, because of Rule 2 (no current flows into the op amp), you can say that both the op amp inputs are open circuits! How can something be BOTH a short circuit AND an open circuit?! Magic, that's how.

There have been several hundred textbooks written about the internals of op amp operation. You can actually pull up a schematic of the innards of op amps, but it probably won't make sense to you unless you know hardcore TTL (transistor-transistor logic).

Quote from: sprog on April 12, 2008, 02:52:36 AM
So, the output voltage can never be more than the power supplied to the opamp? If I were to make a circuit with 12v or 18v would it sound 'bigger' (I think it's called 'headroom'?) because of the higher output voltage? Or would it tear up other effects and/or my amp? If I had a schematic for a circuit that was using 9v & I wanted to redo it for 12v or 18v, I suppose I would have to change all of the component values around the opamp, the ones that control it? Or would I want the higher current? Geez, I hope I'm not getting in over my head.... :-[


Sorry for being so ignorant of all this.... at least I'm in the right place & I really want to learn.

Right, the output can never be more than the supply voltage. Here's how a simple square synth MIGHT work (obviously would be more complicated than this):

A guitar signal comes in, say 1 V peak-to-peak (I just made up that number).
The guitar signal goes into an inverting op amp circuit, with Rb and Ra selected such that Rb/Ra = 50. Your gain is then 50 (inverting).
The op amp wants to amplify the guitar signal to 50V peak to peak, but it can't because the supply voltage is only 9V.
You can now imagine the guitar signal as a HUGE sine wave, +/- 50 volts. The derivative of the wave is pretty big (ie, the signal is steep in shape, because it has a lot of voltage to cover in a short time). Now, take that steep wave, which is going up to 50V on both sides, and just cut it off at 9V on both sides. That's what the op amp does because it doesn't have enough supply voltage.
The resulting signal has a very steep increase in voltage until it hits 9V, then it flattens out, then a very steep decrease until it hits 0V, then it flattens, etc. This wave looks like a square.

If you were to increase the chip's headroom, you'd get that hard clipping at a higher voltage, which means less square wave sound. If you increase the supply voltage to 50V, you'd get absolutely no square sound, just the original signal amplified like hell, and slightly noisy.

The same logic applies to regular op amp distortion. If you increase the headroom, you'll get less distortion at lower levels. Some people want that, and leave the rest of the circuit alone. If you want to increase the supply voltage AND keep the same amount of distortion, then yes you need to modify components to increase the gain.

The same thing happens to an amp when you send a big signal in. If the amp doesn't have enough supply voltage to fully amplify the signal, it'll clip and give you distortion. That's generally referred to as "overdrive" or "overdriving an amp" or, "overdriving your preamp". (The proper usage of the terms overdrive and distortion these days is pretty fuzzy.)

You can get away with powering your circuits up to 12V, in general. Sometimes even 15V, but at that point you need to make sure your circuit's components won't burn out.

Don't ever be sorry for not knowing something, as long as you're trying to learn it. We all start somewhere :)

Keep reading, and good luck! If you still have questions, keep asking.

Burak
Burak

earthtonesaudio

#7
A real simple way to look at it is just with a single transistor.

A one-transistor amplifier inverts the signal, and can provide gain.

Now imagine you have a resistor going from output (collector) to input (base).  If that resistor is very small (like zero ohms), then lots of the output goes back into the input.  The signal is inverted at the output, so the signal coming back into the input cancels the incoming signal... that equates to low gain, less than one.

The opposite case is where you have a huge value resistor (maybe 1 million ohms).  In this case you have very little output signal feeding back into the input (but it's still inverted, remember) and so the gain can be as high as the device will allow.  The gain could be 100, or 1000, or much more.  You could take away the resistor altogether, and have infinite gain in theory, but in reality it would not work because of noise/oscillations, etc.


But this is just sort of answering your original question about the resistance value being larger to achieve more gain.  I was assuming you have seen schematics that employ this type of negative feedback, as there are quite a lot of them.

sprog


frank_p

#9
Quote from: earthtonesaudio on April 13, 2008, 01:09:52 AM
I was assuming you have seen schematics that employ this type of negative feedback, as there are quite a lot of them.
And positive also from the emitter to base... (?)
That is a real question (!).
Beginner project.  Why I did not do that (?)
Wait till you understand more is my worse default in stompmpbox...
And why I stepped forwardin the main topics forum with you you guys.
I am willing to put my oscilloscope now on the beginner project !
...
Thanks Alex,  my dad gave me me some cork wine caps.  I'll put these on my breadboard-prototyping pots as a gift from you.
With Paul M. Ideas also.  (wow!)
This is a brotherhood blood link that I send you Alex !  ;)

dschwartz

#10
i would like to explain  extremely simple...

first you have to know that inverted waves from the same signal cancel each other.. if we have a wave "X" the inverted wave is (-1)*X=-X
so, when you sum both, the result is X-X=0...meaning silence (or a subtle noise in reality)

if one wave is amplified by a factor, like "B", the resulting wave is B*X...

if we have an input wave X and put it into the "+" input of an opamp, the output will be non inverted and multiplied by infinite
If the same wave is trough the "-" input, the wave will be inverted..and multiplied by infinite

what happens if we put simultaneosly the same wave trough both inputs??..the output is the sum of both inverted and non inverted signals..since they´re equal.. the output is ZERO, meaning gain factor = 0

but wait..what if we only enter the opamp trough the + input and wire the output to the - input?? That´s called "NEGATIVE FEEDBACK"
well.. in that case, the output would be (# sign meaning infinity):

X out= Xin*# - (Xin*# - Xin)= Xin 

what?? the same output? YES, it is a voltage follower or "buffer"..the output is not the input wave bypassed, is the  output of the opamp (feeded by the voltage rails) imitating the input..but since is fed by the supply voltage it has more power to drive next circuits..that´s why theyré used to interconnect effects or devices, so one can "drive" the next, and not be "loaded" (loss of power due to a not so friendly input on the next stage..read about "tone sucking")

now.. lets see...what if we put resistance to the negative feedback?   hmm ....putting a resistor alone just limits current, but does nothing about voltage (voltage= amplitude of the wave)..
so.. we make a VOLTAGE DIVIDER.. what´s this? is 2 resistors that divide the wave amplitude.(read about voltage dividers, is not NASA stuff)

the output voltage of a Divider is Vout=Vin*R2/(R1 +R2)  ....R2 goes to ground.. if we make both R equal, we have Vout= 1/2Vin

let´s put this voltage divider to the negative feedback...now: the output wave is:
(sorry for the math.. but is fun)
Xout= Xin*#-(Xout/2*# - Xin)=>  Xout+Xout/2*#=Xin*#+Xin=Xin(1+#)=Xout(1+#/2) yielding

Xout= Xin* (1+#)/(1+#/2)     = Xin*2(1+#)/(2+#)  .. since (1+#)/(2+#) tends to 1...

X out = 2 Xin... UFFF gain factor of  "2"!!!!!

NOW....what if we make one of the resistors of the divider variable?? YESS THAT WAY WE HAVE A VARIABLE GAIN!!!
You can put the pot as R1 (like tube screamers log pot) or as R2 (mxr style rev log PITA )

now that you understand gain..think about what happens if you put a capacitor, that let pass only certain frecuencies to the - input..hmm.. welcome to the world of active filters!!!!!!


man and i wanted to keep it simple...!!!! well..it was not that simple , but a lot of fun!!!!! (all of the above was intuition)

----------------------------------------------------------
Tubes are overrated!!

http://www.simplifieramp.com

Mark Hammer

When it comes to op-amps, here is the way I think of it.

Op-amps have an inherent desire to provide as much gain as is physically possible for them; in the thousands, or whatever is feasible at maximum supply voltage.  The way we normally use them is to harness that "urge" by providing negative feedback from the output.  Think of the output signal as "stepping on the brakes" so that the vehicle does not crash.

The more negative feedback is applied, the harder you are stepping on the brakes.

Now, in the case of a non-inverting op-amp (input signal goes to + pin), the feedback resistor and the resistor that goes from the - pin to ground act like a voltage divider (more commonly thought of as volume pot).  Remember that with a volume pot, the output signal at the wiper is a function of how much larger the resistance leading up to the wiper is, compared to the resistance leading from the wiper to ground.  You can make the voltage at the wiper smaller by either making the resistance to ground smaller, or by making the resistance leading up to the wiper larger...or both.

Let's apply that logic to the op-amp.  Assume the - pin is kind of like the wiper of a pot, and the feedback resistance is like the resistor leading up to the wiper, and the resistor to ground is like the other half of the volume pot.  Now, if the chip wants to go full speed ahead, and the only way to harness that is to provide negative feedback (a bit like yelling in the basement "Hey, you kids!  Settle down in there!!"), then whatever provides more negative feedback at the "wiper" will reduce the gain. 

We can turn the gain up by applying less negative feedback, and turn the gain down by applying more of it.  The textbook scenario for minimum negative feedback (=maximum gain) is to have simply NO path from output back to input, right?  Conversely, the textbook scenario fo applying maximum negative feedback is to conserve every last drop it.  Remember all those schematics you've seen where there is a "straight wire connection" from output to input, and no connection from the - pin to ground?  Those are unity gain (gain = 1), precisely because there is no loss of negative feedback at all.

In between those two extremes, you can bleed off or waste some of that negative feedback, by having a lower resistance path to ground from the wiper, than the path from output  to our virtual wiper.  So, if I have a 100k feedback resistor, and a 10k resistor to ground (from the - pin), as a sort of volume control, it is attenuating a lot of the potential negative feedback I could be providing at the wiper (- pin) because I'm losing it out the 10k resistor,  Certainly not most of it, but still a lot.  The gain there = 11 ( or [100k+10k]/10k ).  If I made the 100k larger or the 10k smaller, I would bleed even more of the negative feedback.  So, if the 100k went up to 220k (10k held constant), the gain would be = [220k+10k]/10k = 23.  If the 100k were held constant but the 10k dropped down to 2k2, the gain would be = [100k+2k2]/2k2 = 46.6.

In the case of inverting op-amps (+ pin goes to ground, signal goes to - pin), the principle of applying more and less negative feedback also works, except that now the input resistor is part of the equation.  If the input resistor is much smaller than the feedback resistor, you get less negative feedback applied, and consequently more gain.  Just like the non-inverting instance, you can provide more (or less) negative feedback by working with the value of either the feedback resistor OR the input resistor OR both.

Hope that helps to clarify.

frank_p

#12
Quote from: Mark Hammer on April 16, 2008, 11:01:26 AM
Hope that helps to clarify.

Thanks Mark and Daniel.

sprog

#13
Quote from: frank_p on April 16, 2008, 01:30:17 PM
Quote from: Mark Hammer on April 16, 2008, 11:01:26 AM
Hope that helps to clarify.

Thanks Mark and Daniel.

+1

thanks you guys!

Edited to say: Wow! I got it! Mark's explanation made the light go on for me. I REALLY appreciate it!!


brett

QuoteThe more negative feedback is applied, the harder you are stepping on the brakes.

Good analogy, Mark.  Gimme a physical model over maths any day.
Brett Robinson
Let a hundred flowers bloom, let a hundred schools of thought contend. (Mao Zedong)

grolschie

I recommend GaussMarkov's OpAmp tutoral. Actually, all of the tutorials. They are very good reading. :)

frank_p

Also,this book is great and at 2,39$ (used) for 500 hundreds pages on opamps, it's hard to beat.
- Operational Amplifiers and Linear Integrated Circuits (Boyce)

http://www.amazon.com/Operational-Amplifiers-Integrated-Circuits-Technology/dp/0534914721/ref=sr_1_10?ie=UTF8&s=books&qid=1208453446&sr=8-10

dschwartz

Quote from: brett on April 17, 2008, 01:57:37 AM
QuoteThe more negative feedback is applied, the harder you are stepping on the brakes.

Good analogy, Mark.  Gimme a physical model over maths any day.

c'mon my mathematical explanation was pretty good.. even I understood it!!!
----------------------------------------------------------
Tubes are overrated!!

http://www.simplifieramp.com

Mark Hammer

Well of course it was good.  I just figured that if someone not so mathematically inclined wanted to understand the same concepts, I'd tackle it another way.  Even the hopelessly naive and underinformed deserve an explanation! :icon_wink:

dschwartz

Quote from: Mark Hammer on April 17, 2008, 02:39:36 PM
Well of course it was good.  I just figured that if someone not so mathematically inclined wanted to understand the same concepts, I'd tackle it another way.  Even the hopelessly naive and underinformed deserve an explanation! :icon_wink:
+1
youre right..

i still use the water flow analogy for most of my circuit analysis.
----------------------------------------------------------
Tubes are overrated!!

http://www.simplifieramp.com