Showing posts with label Opamp. Show all posts
Showing posts with label Opamp. Show all posts

Opamp Configurations - Integrator Circuit schematic with explanation

Opamp Configurations - Integrator

If you replace the feedback resistor with a capacitor, you get an integrating amplifier.

In math, an integration operation is basically the area under a curve. If we have a voltage vs time graph, and the voltage remains constant, the integral of that will be the voltage times the time it stays at that level. As you can see, the longer the time the voltage remains constant, the higher the integral will be.

Back to our integrator, as the input voltage is applied to the inverting input via an input resistor that creates an input current. The Opamp will try to compensate the current by creating a voltage across the feedback element enough to make a current flow equal to that at the input to conform to the current rule: the inputs draw virtually no current.

In the simple inverting amplifier, the feedback resistor developed a constant current at a constant voltage at the output with respect to the inverting input, tied to ground. This time however, the feedback element is a capacitor; an element that can store charge, charge that eventually develops a voltage across it as it gets more and more charged.

If we apply a constant voltage at the input, a current flows through the input resistor. This current the opamp tries to compensate by creating a voltage at the capacitor to induce a current equal to that of the input. If the capacitor is initially completely discharged, the voltage across it is 0v, and its "resistance" is infinite since it is effectively insulating both sides so no current flows.

The gain is initially infinite, since Rfb/Rin tends to infinity by action of Rfb being infinity. This makes the output voltage go down quickly in a small amount of time (remember that the opamp is acting in an inverting configuration). As the capacitor starts charging, the charges entering the out plate of the capacitor push the charges on the other side, effectively creating a current across the capacitor, enough to counteract the input current.

As the charges build up inside the capacitor, a voltage develops across it in opposition of the output voltage, making it seem as if less voltage is applied to it, slowing down the amount of charges getting into the capacitor.

Less new charges going into the capacitor causes less charges being pushed out at the other plate. The Opamp tries to compensate by further lowering the voltage.

As you can see, the charges keep building up and the opamp is always trying to compensate by lowering the output voltage. At one point, the opamp will not be able to lower the output voltage, at which point it is said to be saturated.

The rate of charge of the capacitor depends on the current that is applied to it, and the current depends on the voltage and resistor at the input by ohms law I = V/R. The higher the voltage, the faster the capacitor charges and the output going lower, and the lower the input resistor the more current flows, charging the capacitor faster and resulting in the same faster lower output.

This action is the same as in the integration operation: the higher the value of the graph the higher the integral will be in the same amount of time.

Also if the input goes negative, the capacitor starts discharging and the output will go higher to compensate. If at any point the input goes to 0, the current through the input resistor will be zero, and the opamp will compensate by setting the output voltage at the same level as the capacitor voltage, in order to stop it from being charged or discharged.

Similar to what happens in an integration: if the graph crosses 0 and stays there, the integral will be the sum of areas up until that point and stay there for as long as the graph stays at zero. Also, if the graph goes lower than 0 then the integral will go lower because the area will be negative relative to 0.

Opamp Configurations - Differentiator Circuit schematic with explanation

Opamp Configurations - Differentiator

The inverse function to integration is differentiation, in other words finding the derivative, which the opamp can also perform. The derivative is defined as the rate at which the function changes.

By using an input capacitor instead of a resistor, we can accomplish the same thing. If you remember, a capacitor stores charges in its plates, when one of them starts accumulating charges, the same charges will be pushed out from the other plate, as if current was flowing through the capacitor despite the intrinsic insulating layer.

The capacitor's charges start building up and creating a voltage across itself in opposition to the charging voltage, thus slowing down the incoming charges, slowing down the charging process in general. When enough charges have accumulated, the charges inside the capacitor completely push away the charges coming from the source, no more charges enter the capacitor, and because of this no more charges are pushed out on the other side of the capacitor, so no more apparent flow of current across the capacitor.

When used as input for a signal, if the signal does not change (like a DC input), the capacitor will have an initial apparent current through it as the voltage across it builds up due to incoming charges, and since the input of the amplifier tries to not draw any current, it will create a voltage at its output so that the current through the feedback resistor is the same as the apparent current through the capacitor.

Since the capacitor charges very quickly due to the voltage applied to it and the fact that there's no current limiting component like a resistor, the apparent current through the capacitor falls very quickly as the voltage across it in opposition rises as quickly; the falling current is also causes the opamp to drive the output voltage less, since there's less current to compensate for.

Applying a DC input to the differentiator thus creates a spike in input as well as in output as the capacitor's initial charge is developed, and then goes back to 0v as there's no more apparent current to compensate for; Similar to the operation of finding a constant's derivative, which is always 0.

The fact that there's an initial spike can be mathematically modeled as a period in which there's a function that rises at a very high rate (which actually happens, the voltage doesn't just jump from 0v to the DC input voltage, it rises very rapidly towards it), so its rate of change is very high for a brief period of time; hence the spike.

As the input voltage stabilizes, its rate of change slows down very rapidly as well, going towards zero when fully stabilized; this is reflected in the opamp's output by the fact that as the voltage stabilizes, the output spike goes down very rapidly towards zero and stays there.

Now instead of applying a constant input, you can replace it with a constantly changing input.

If the input is increasing at a constant rate, there will be a constant apparent flow of current through the capacitor, since the voltage buildup across the capacitor is compensated by the increase in input signal. Since there's a constant apparent flow of current through the capacitor, the opamp compensated by setting the output voltage at a level that will make the feedback resistor draw the same amount of current, so that the opamp input does not draw it.

Since the amount of apparent current is constant, a constant output voltage is enough to keep the feedback resistor drawing the current, and the opamp keeps a constant output at the output.

This mode is very similar to using a resistor with constant dc as the input.

The same is true for a constantly decreasing input voltage; the output will just be of reversed polarity. To compare with the mathematical definition of the derivative of a linear variable, the derivative will be a constant.

This can be expanded to other functions, one of the most widely used being the sine function. Since the mathematical derivative of the sin(x) function is cos(x), which is a shifted version of sin(x) by 90 degrees, when you input a sine input at the differentiator amplifier, the output will be the same function shifted 90 degrees, in essence, a cosine function.

Opamp Configurations - Comparator circuit Circuit schematic with explanation


One of the main reasons for using opamps as active devices in circuits is that their internal gain is so high, that even if we reduce it to a tiny fraction, it will still be enough for practical purposes. This particular configuration depends on the very high gain of the opamp to swing the output to one of the extremes; the sign of which tells us which input is more positive than the other.

By connecting the non inverting input to a voltage source, we are setting the reference point of the comparator. Remember that since there's no feedback, and because internally the opamp is just a very high gain difference amplifier, the output will be the non inverting input voltage minus the inverting input voltage, multiplied by the internal gain (in the 100k's).

This means that a difference of just millivolts will drive the output into saturation; if the difference is positive it will swing to full positive, limited by the supply. If the difference is negative, it will swing to full negative, again limited only by the supply.

On most amplifier circuits it is not advisable to drive the opamp into saturation because it clips the signal from going any further on both ends, but in this case we are not so much interested in the signal itself but on the relationship between the signal and a reference, so this circuit serves its purpose.

The Operational Amplifier OpAmp

The Operational Amplifier OpAmp

The operational amplifier is perhaps the most versatile of amplifier circuits, used many different applications as a gain component due to high stability, gain and input impedance, as well as the fact that very little external components are needed for operation.

Internally, the OpAmp is based around a transistorized differential amplifier; two transistors connected to the same emitter resistor, where one of the inputs is inverted and added to the other to essentially subtract one from the other, the difference amplified by a certain factor and fed as the output.

The basic opamp is a simple differential amplifier. Most commercially available opamps have extra internal circuitry to compensate for temperature change, different voltage source values and compensation to get an exact 0v when both inputs are disconnected.

There are two characteristics that make opamps so versatile: The voltage difference across its inputs will be very close to 0v, and its inputs draw virtually no current. This characteristics are only valid only under Negative Feedback.

Opamp Configurations - Window comparator

Opamp Configurations - Window comparator

The simple comparator circuit has one inherent problem: it can only tell us if one of the input voltages is higher than the other.

But what if you needed a circuit that tells us if a signal is within a range of values? you would need a circuit that tells you if the signal is higher than a minimum and if it also is lower than the maximum. The problem itself hints at the solution.

For a window comparator, we need one simple comparator set up just like the previous circuit: use the non inverting as reference and the inverting input as the signal entry. This comparator will set the maximum; if the signal goes higher than the reference the output will go negative, signaling an out of range (if we consider positive to be in range).

Another comparator is set by switching the reference and signal inputs, connecting the reference to the inverting input and the signal to the non inverting. If the signal is lower than the reference, the output will go negative, again indicating an out of range; this comparator sets the minimum.

When both opamp outputs go positive, it means that the signal is below the maximum and above the minimum, in other words, the signal is within the window of voltages you have defined.

There's one thing to consider with this configuration, when the signal is out of range, one of the opamps will go full negative (virtual connection to negative supply) and the other will be full positive (virtual connection to positive supply). This causes a short circuit condition that needs to be avoided as it could cause damage to the circuit or the supplies.

One way to protect from this condition is use diodes configured as the logic AND gate. This simply means to connect two diodes at the opamp outputs, connect both their anodes together and to the positive supply via a high value resistor.

What this does is that only when both opamps are at full positive (diodes' conduction blocked, basically disconnecting the opamps from the rest of the circuit) will the output be positive, held by the high value resistor.

When either opamp goes negative, the diode connected to it will be forward biased, basically connecting the output to ground; the other opamp is blocked from connecting to the output by the reverse biased diode (positive opamp output connected to cathode, negative to anode) and no short circuit condition occurs.

Opamp Configurations - Difference Amplifier

Opamp Configurations - Difference Amplifier

Difference Amplifier

So far you've learned about how to make an opamp add an inverted (negative) voltage to a reference, and to add a positive voltage by setting the reference.

Since the opamp has two inputs, one inverting and one non inverting, it should be possible to use both at the same time to add them to one another, and since one will be inverted, the effect will be a difference of voltages.

This one is a bit trickier to derive equations for, since, as you already know, the voltage that will be applied to the non inverting input will also appear at the inverting input via the opamp trying to compensate.

Since we are using resistor ratios in the voltage divider to set the voltage at the non inverting input, the voltage at the inverting one will be in terms of those resistors as well, otherwise the equations are derived the same as for the inverting amplifier.

Lets start with the inverting amplifier equations
    Vrin = Vin - Vinv
    IinRin = Vin - Vinv => Iin = (Vin - Vinv)/Rin
Same as last time, except Vinv is non zero, set by the voltage divider. Applying the current rule:
    Iin = Ifb, Ifb is the feedback current.
    Ifb = (Vinv - Vout)/Rfb
Vinv is not tied to ground, so it can't be simplified more at this point. We also have
    Iin = Ifb => (Vin - Vinv)/Rin = (Vinv - Vout)/Rfb
Expressed in terms of Vout, this becomes
    (Vin - Vinv) (Rfb/Rin) = Vinv - Vout
    (Vin - Vinv) (Rfb/Rin) - Vinv = - Vout
Multiply both sides by -1
    (-1)[(Vin - Vinv) (Rfb/Rin) - Vinv] = (-1)(- Vout)
    - (Vin - Vinv) (Rfb/Rin) + Vinv = Vout
    Vinv - (Vin - Vinv) (Rfb/Rin) = Vout
Now, since Vinv is in terms of the non inverting voltage, we have
    Vninv = Vin2 R2 / (R1+R2)
And
    Vinv  = Vninv => Vinv = Vin2 R2 / (R1+R2)
So we can rewrite our Vout equation now in terms of both input voltages
    Vinv - (Vin - Vinv) (Rfb/Rin) = Vout
    [Vin2 R2 / (R1+R2)] - (Vin - [Vin2 R2 / (R1+R2)]) [Rfb/Rin] = Vout
This seems complicated enough as it is, so from here we are going to simplify by making some assumptions. Lets make all resistors equal.
    R = R1 = R2 = Rfb = Rin
The equation then becomes
    [Vin2 R/2R] - (Vin - [Vin2 R/2R] [R/R] = Vout
    Vin2 (1/2) - (Vin - [Vin2 (1/2)] [ 1/1 ] = Vout
    Vin2 (1/2) - (Vin - [Vin2 (1/2)] = Vout
    Vin2 (1/2) - (Vin - [Vin2 (1/2)] = Vout
    Vin2 (1/2) - Vin + Vin2 (1/2) = Vout
    Vin2 - Vin = Vout
As you can see, with our assumption of equal resistors, the output will be equal to the difference of voltages applied, the applied at the non inverting minus the one applied at the inverting. In practice if you use the same ratios of resistors, the relation holds. You could also use equal ratios (not precisely 1:1) to set the gain; if you use different ratios you will get a weighted difference.

Advertisement