Tutorial: Op Amps

<< Go Back to Other Tutorials

Need to amplify a small input voltage? Need to mix several voltage sources? Maybe you want to make an audio equalizer or signal generator? The Operational Amplifier is your man. We learned a lot about the Op Amp when building our iPod Preamplifier, and we thought it would be useful to share.

What is an Op Amp?

First, the symbol for an OpAmp:

Opamp_1

There are 5 terminals:

  • + and – are the inputs. An Op Amp reads the voltage applied to each of its input terminals and outputs the difference between them multiplied by a very large gain (A million or so).
  • The line at the right is the output. This terminal is where our amplified signal appears.
  • V+ is our voltage source – it powers the Amp and sets the maximum voltage output
  • V- can be thought of as ground – it sets them minimum voltage output.

Simple, right? Let's take a few examples:

  1. Let's apply the same voltage to both inputs. The Op Amp takes the difference between them (0) and multiplies it by the gain (1,000,000), and gets 0. So 0V is output.
  2. What if we apply 2V to one input and 1V to the other? The Op Amp takes the difference between them (1) and multiplies it by the gain (1,000,000) and gets 1,000,000. Because the maximum output is set by V+, the Op Amp outputs V+.

It's probably obvious that we need to reduce the gain to make the Op Amp more useful. We do that by feeding some of the output back into the input through a resistor. By changing the resistor values, we can control the gain level. Let's examine some basic Op Amp circuits used for audio and signal generation.

Using Op Amps

Non Inverting Amplifier

Let's say we have an audio source that swings 300mV, peak-to-peak, Let's amplify that signal with an Op Amp – first, connect the signal source to the + input. Then connect the – input to ground. The Op Amp will take the difference between the two terminals, multiply it by the gain (1,000,000), and output it.

Opamp_2

Probably too much gain, so we limit the gain by feeding part of the signal to the – terminal. Using a voltage divider, we keep the – terminal just a tiny bit lower than our + terminal. The gain is set by the ratio of (Rf / Rg) + 1. Increase Rf or lower Rg and you'll increase the gain.

Inverting Amplifier

The Inverting Amplifier works nearly the same was as a 'regular' amplifier, except the signal is inverted. When our source is going up 100mV, our output is going down 100mV * the gain. This might sound like a big difference, but for applications like audio we're really interested in the frequency, not the direction.

In the Inverting Amp, we ground the + terminal, and connect the input to the – terminal. By using a resistor to connect the Amp input and for feedback, we can control the gain. The gain is the ratio Rf / Rg.

Opamp_3

Practical considerations

Choosing Resistor Values
We have some flexibility when picking values for Rf and Rg. The main thing is that the ratio sets the gain. But you want to keep the values between 1k – 100k ohms, larger resistors have more internal noise.

Inverting or Non-Inverting
In some applications, you can decide between inverting and non-inverting circuits. Inverting circuits are better at rejecting common-mode noise (interference that appears on both the ground and signal lines). A downside is that inverting circuits give you less gain; Rf / Rg for an inverting circuit instead of Rf / Rg + 1 for a non-inverting circuit. There's also less control over the input impedance – it's set with Rg.

For audio, it's not so important whether we use Inverting or Non-Inverting, but we should use the same on every speaker.  If we reverse the phase on one speaker, it will make the final output sound scattered and off. You can try it with any stereo just by reversing the cables connected to one of the speakers.

Stability
The output of our Op Amp is feeds back in to the input, controlling the gain. When our load is purely resistive, the Amp has no problem changing the output voltage, but what if we connect the output to a capacitor? Remember that a capacitor resists a change in voltage, so when the Op Amp tries to change output voltage, it won't happen immediately. This delay causes instability in the Op Amp, causing it to overshoot the intended voltage level. Most Op Amps work better with higher gain – there's less overshoot with a 10x gain than 2x.

Other Uses

The amplifer is probably the most common application of Op Amps, but having two inputs opens up a lot of doors.

ADC

Remember that if we don't limit the gain on our Op Amp, When the + input is higher voltage than the – input, the amp outputs V+. Also, most microcontrollers can vary the voltage output of a pin through a 'duty cycle' mode and a capacitor to smooth the output.

Connect you duty cycle microcontroller output to the Op Amp's – input, then connect the microcontroller input pin to the Op Amp output. As you duty cycle the – input, watch the Op Amp output. As soon as it goes low, you know what voltage the + input of the Op Amp is at.Opamp_4

Signal Generation

Our Amplifier circuits take an input signal and magnify it, but an Op Amp can also be used to generate very high quality waveforms. First is a sine wave:Opamp_5

 

Or a square wave:

Opamp_6

Other waveforms are also possible.  There are a ton of circuits that use Op Amps, the examples above are just a few.

Supply Voltage

Most example circuits use three reference voltages: V+, V-, and Ground. They're assuming a 'Split' power supply, which means your circuit can provide a voltage that's above ground (V+) and below ground (V-). But most power supplies are 'single supply', meaning they only provide ground and V+.

The easiest way to use an Op Amp with a single supply is to split the power source. If you have a 5V power supply, you'll use 2.5V as your 'virtual' ground, the 5V from the supply as V+, and the ground from the power supply as V-. This way, V+ is 2.5V above 'ground', and V- is 2.5V below 'ground'. To split the power supply, you can use a voltage divider or a rail splitter IC like the TLE2426.

Choosing an Op Amp

Not all Op Amps are created equal! Datasheets provide a lot of measurements of the device, here are a few to keep an eye on;

1 – Bandwidth
As the frequency of the signal increases, an Op Amp will find it harder to keep up. For Audio, bandwidth of 100kHz is fine, but other applications may need more bandwidth

2 – Supply Range
What the voltage requirements and limits are for V+ and V-. Also keep in mind the Output – most Op Amps have a maximum voltage output that's 2-3 Volts less than the input voltages. Others are 'Rail-to-Rail' and can provide an output voltage that's equal to the inputs.

More Reading

There's a lot to Op Amps, and here are a few more resources to help you out;

Comments (0)Add Comment
Write comment
 
 
smaller | bigger
 

busy
 

Other Stuff

Cool Project