An operational amplifier is an analog circuit with very high gain that compares two voltages and generates an output based on that difference. With a few resistors around it, we can compare, amplify, filter, or adapt signals with considerable precision.
We are entering the most classic part of analog electronics. So far, we have worked a lot with discrete states, but here we begin to manipulate continuous signals and make them behave as we want.
Its name comes from old analog computers, where it was used to perform mathematical operations such as addition, subtraction, differentiation, or integration. Today we use them for everything: conditioning sensors, filtering audio, comparing levels, and amplifying weak signals.
In this article, we will look at the four configurations that solve a large part of analog problems.
What is an OpAmp?
An OpAmp is a high-gain device with two inputs and one output.
- Non-inverting input (V₊): Marked with a
+. - Inverting input (V₋): Marked with a
-. - Output (
): The result.
The fundamental equation governing its basic behavior is:
Where A is the open-loop gain. This value is enormous (typically 100,000 or 1 million).
This means the OpAmp massively amplifies the difference between its inputs. So much so, that if there is the slightest difference, the output shoots towards the positive or negative supply rail.
In practice, this output cannot grow without limit. Eventually, it becomes stuck at the supply limits, which is called saturation. This saturation is exactly what we take advantage of when using the OpAmp as a comparator.
The Comparator (Open Loop)
This is the simplest configuration: no feedback (we do not connect the output to the input).
We exploit that wild gain to make decisions.
- If
, the output goes to the maximum positive (Vcc). - If
, the output goes to the minimum (GND or -Vcc).
A Classic Comparator: LM393
The LM393 is the quintessential comparator in the maker world. You will see it in almost all analog sensor modules with a blue potentiometer and a digital pin D0.
It compares the voltage of the analog sensor with a reference voltage set by the potentiometer.
- When the output transistor is open, the pull-up resistor drives the signal to
HIGH. - When the transistor conducts, the output goes to
LOW.
This way, we convert a complex analog signal into a simple digital one.
The Concept of Negative Feedback
To use the OpAmp as an amplifier and not just in open loop, we apply negative feedback.
We connect a portion of the output back to the Inverting Input (V₋). This is called Negative Feedback.
In an ideal analysis, with negative feedback and no saturation, we use two approximations:
- No current enters the input pins (Infinite impedance).
- The OpAmp will adjust its output to make the voltage at V₊ and V₋ EQUAL.
This second rule (“virtual short circuit”) is what allows us to design circuits with astonishing mathematical ease.
The Voltage Follower (Buffer)
In this configuration, we directly connect the output to the inverting input (V₋). The signal enters through V₊.
Applying the rule, the OpAmp wants V₋ = V₊. Since
Gain = 1.
What is it for if it doesn’t amplify? It serves to match impedances.
- It has high input impedance and loads the sensor little.
- It has low output impedance, within the current limit of the device.
It is the “bodyguard” of the signal. If you have a weak sensor and connect a heavy load to it, the voltage will drop. If you put a Buffer in between, the sensor “sees” an infinite wall (it doesn’t get tired) and the Buffer takes care of delivering the energy to the load.
Non-Inverting Amplifier
The signal enters through V₊. We place a voltage divider in the feedback path to V₋.
Since the OpAmp forces
The gain formula is:
Characteristics:
- The output signal has the same phase as the input (if the input rises, the output rises).
- The gain is always greater than or equal to 1.
- It has high input impedance, making it ideal for sensors.
Inverting Amplifier
The signal enters through V₋ via a resistor. The input V₊ is connected to ground (GND).
Since V₊ is at 0V, the OpAmp will do everything possible to make V₋ also 0V. This point is called a virtual ground.
The formula is:
Characteristics:
- Inverts the signal (negative sign). If +1V goes in, -2V comes out (if the gain is 2).
- Can attenuate if
. - Its input impedance depends on
.
Note on Power Supply: To have actual negative voltages at the output, you need a Dual Supply (+12V and -12V). If you use an Arduino with a single supply (0V and 5V), the OpAmp cannot go below 0V, so the inverting configuration requires additional tricks (offset) to work.
Common Formulas
| Configuration | Output Formula | Main Use |
|---|---|---|
| Comparator | Vcc or GND | Digitizing analog signals (thermostats, sensors). |
| Follower | Impedance matching, protecting weak signals. | |
| Non-inverting | Amplifying sensors without phase inversion. | |
| Inverting | Audio mixers, mathematical operations. |