Op-Amps 2: Hitting the Rails

by gaussmarkov

Water FaucetA first step in understanding op-amps, and amplification generally, is to see that op-amps are like a water faucet that controls the water pressure in a garden hose. In the simplest setups, the faucet alternates between completely closed and wide open. As a result, the output of the op-amp is either the lowest or the highest available voltage, in analogy with no water pressure or maximum water pressure in the hose.

An example of this idea is to tie the input with a minus sign, called the inverting input, to ground and to feed the input with a positive sign, called the non-inverting input, a sine wave. In the LTSpice simulation shown here, the non-inverting input is connected to an AC source with a 1V 800Hz sine wave. The op-amp is supplied by a 9V DC source with the positive terminal connected to the positive power pin and ground connected to the negative power pin.

Op Amp Comparator Circuit

Just to be sure it’s clear, this schematic is equivalent to the next one, with a connection running explicitly from the power supply to the op-amp.

Alternative Comparator Schematic

The V+ label on both the 9V power supply V2 and the op-amp positive power pin take the place of running a connection. The ground symbols do the same thing. Such labels simplify a schematic by reducing the number lines that appear.

Here is a plot of the input in+ and the output out signals for this simulation:

Comparator Simulation Plot

As indicated, the green curve is the in+ sine wave with a 1V amplitude and an 800Hz frequency. The blue plot is the signal at out which jumps between 0V (ground) and 9V, the two polar values of the power supply to the op-amp. Whenever the sine wave voltage is negative, or below ground, the output is 0V, and whenever the sine wave voltage is positive then the output is 9V.

This occurs in part because an op-amp responds only to the difference in the voltages at the two inputs. The difference is calculated by subtracting the inverting input voltage from the non-inverting input voltage. In the present case the inverting input voltage is connected to ground so that the difference in voltages simplifies to be the non-inverting input voltage alone.

So if we reversed the input connections, hooking the sine wave to the inverting input and ground to the non-inverting input, the op-amp would be responding to the negative value of the sine wave and the square wave would be inverted: when the sine wave voltage is positive then the output voltage would be 0V and when the sine wave is negative then the output voltage would be 9V.

The other reason for this square-wave output is that the op-amp has an extremely sensitive output “faucet.” A very small positive difference in input voltages “turns the faucet” to the maximum voltage. And the opposite is also true: a very small negative difference in input voltages “turns the faucet” to the minimum voltage.

Dual Polarity Power Supply

In the first example the minimum is 0V but things are symmetric if we introduce a dual polarity (or bipolar or split) power supply:

Op Amp with Bipolar Power Supply

Plot of Op Amp with Bipolar Power Supply

When the minimum voltage available is -9V then a negative voltage difference on the inputs produces an output of -9V. So the analogy with a water faucet does not extend to this case. Turning the faucet in opposite directions does not produce opposite directions of water pressure.

Again, switching the inputs inverts the output:

Inverting Comparator Schematic

Virtual Ground

It is possible to create a similar relationship with the original single-supply circuit. One creates a virtual ground between actual ground and the positive voltage supply at the inputs of the op-amp.

Single-Supply Schematic

Vr is the virtual ground in this circuit. A voltage divider places Vr at half the supply voltage V+. A 10uF decoupling capacitor (C2) assists in keeping Vr steady. The capacitor C1 and the resistor R1 pull the signal up from alternating around ground to alternating around the virtual ground. C1 acts as a coupling capacitor and preserves any difference in DC levels between the signal source and the non-inverting input. R1 sets the DC voltage level approximately at Vr. Here are the results:

Single-Supply Plot

The source signal (blue) is cycling around ground as before but the non-inverting input (green) is cycling around Vr (red). The inverting input is connected to Vr instead of ground.

As a result, the voltage difference across the inputs is the same as the signal source. Now the output signal is on the positive power rail when the green sine wave is above the red line and on the ground power rail when the green sine wave is below the red line. The red line at 4.5V is playing the same role as ground in the bipolar supply circuit above.

This virtual ground will be useful in the next post, which discusses output that stays between the power rails.

In all of the circuits in this post, the output is on one power rail or the other. Such op-amp circuits are called comparators because the output indicates whether one input voltage is greater than the other. That is, one voltage is compared to another and the output is high for one outcome and low for the other.

« Back to Op-Amps 1: Description | Up to Op-Amps Topic |
Trackback URL for this post: right-click and copy

5 Responses to “Op-Amps 2: Hitting the Rails”

  1. Sander de Groot (Asfastasdark) said:

    Wow, what an amazing site. I’m learning a ton from all this stuff, I really didn’t know that this stuff worked like this! Thanks so much!

    Posted 06.09.2008 at 6:34 pm

  2. E said:

    thank you for this great site very well explained and graphs were perfect, this
    is one of the best i have studied

    Posted 24.01.2009 at 5:52 pm

  3. Bryan Ribas said:

    Thanks For the amazing site.

    Posted 11.03.2009 at 6:11 am

  4. Glen said:

    good explanations thanks!

    Posted 21.04.2009 at 7:51 pm

  5. Kevin said:

    If your sine wave was vary say from your current 1volt pk-pk to say 5 volts pk-pk would this circuit still give the same 9 volt pk-pk square wave out.

    Posted 19.04.2011 at 7:38 pm