last updated: 03/12/19
Beginning with this chapter we will come across many "Just do it" tasks. These tasks have to be carried out and have to be documented thoroughly!
Your marks will depend on the documentation!
To better understand parts of this module, first work through the module electronics fundamentals.
Song of this chapter: Imran Khan > Unforgettable > Amplifier
An operational amplifier (op-amp or op-amp) is a very versatile building block (a differential amplifier build with transistors and resistors in an integrated circuit) used in analog circuits. Op-amps are among the most widely used electronic devices because their characteristics (gain, impedances, bandwidth, ...) can be changed with external components. Their characteristics change only slightly with temperature or internal component tolerance.
With Op-amps we can build amplifier among others: amplifier (differential, inverting and non-inverting), buffer, voltage comparators (e.g. used in Flash ADCs), voltage and current regulators, differentiators and integrators, analog calculators, precision rectifiers, precision peak detectors, active filters, Schmitt trigger, oscillators and waveform generators, ADC's, DAC's, .
Op-amps had their origins in analog calculators or computers!
Here a picture of an analog computing machine at the Lewis Flight Propulsion Laboratory circa 1949 (NASA):
We will not study op-amps in depth, but only so far that we can use them. In this module we need op-amps mainly to amplify voltages from analog sensors, so that microcontroller can work with the data.
The Op-amp is a voltage amplifier with a differential input (output is single-ended) and a a very high gain (about 100000), meaning the differential input voltage is amplified by a factor
Differential amplifiers means we have two inputs, and amplify the difference between the inputs. The input impedance (impedance is the AC equivalent of the resistance, used for DC) is very high, meaning the op-amp has very little impact on whatever is connected to its inputs, because the current drain is negligible.
The output impedance is low (like the inner resistance of a battery), and the op-amp is able to supply a significant current to its load.
The energy for the op-amp is provided mostly from a bipolar voltage power supply, from ±2 V to ± 18V (often ± 15V). Op-amps with unipolar power supply are more rarely used.
A very old and known general-purpose op-amp is the
741. There exist many modern and slightly changed (improved) versions of this chip (often cheaper and better than the original). Here some versions (always check the data sheet; thanks to Peter J. Vis):
LM741CN (bipolar), CA3140E (MOSFET), TL031CP (EJFET, low power, low offset), TL051CP (EJFET, low offset), TL061CN (JFET, low power), TL071CP (JFET, low noise), TL081CN (JFET), LF351N or LF356N (JFET), MC3317N, MCP601 or MCP603 (low voltage 2.7-6 V), OPA602 (high speed and precision).
Here is the DIL or DIP package for all these op-amps:
We need five terminals to connect the bipolar voltage, the differential input and the output. Mostly the first symbol without the terminals for power is used, because of it's simplicity. The actual symbol (third symbol, DIN EN 60617) is seldom used in schematics.
An op-amp without feedback and external components can't be used as amplifier. Even with a small voltage, the output voltage will be equal to or greater than the supply voltage. Such a situation is called the saturation of the amplifier.
But a comparator needs this behavior!
If we hold the inverting input to ground (0 V) the voltage Uin applied to the positive input will saturate the op-amp and the the output will be maximum positive. With a negative Uin the output will be maximum negative.
Let's test the comparator by building a battery driven polarity tester with an TL081. In wich voltage range this op-amp can work? Check the data sheet. How can we get the bipolar voltage with two 9 V batteries? Draw the circuit (Tip: Check the Ohm chapter in ELEFU).
We need two resistors (R1, R2) for the LED's. Calculate their values and document the calculations. Test the circuit. Measure and document the voltages on your batteries and the output voltages for positive and negative input voltage.
The maximum output current can't be found in the data sheet, but the data sheet mentions that the output has a short-circuit protection. So let's measure the shorted output current. Calculate the internal output resistance from your measurement.
Do you remember the parallel comparator (Flash) ADC in our last chapter of MICSY? There were 7 comparators engaged. Enhance the circuit from above to toggle at 3 V instead of 0 V. Draw the circuit. Determine the two resistances from the needed voltage divider and test the circuit.
The operational amplifier has a
- and a
+ input called the inverting (-) and non-inverting input. To key to using op-amps as amplifiers is to feed the output back to the input. To use the op-amp as amplifier the feedback will normally go to the inverting input to reduce the input voltage an with this the overall gain (a part of the output voltage is subtracted from the input voltage an so reduces the input voltage). A positive feedback to the non-inverting input enforces the difference and can be used to get a faster comparator.
For an inverting op-amp we feed the output back to the inverting input through R2 and apply the input signal through R1 to the inverting input. The non-inverting input is connected to ground.
As the input voltage between the two inputs is very small (near 0 V) and the positive input is tied to ground we get a virtual ground (0 V) on the negative input. Uout lies over R2 to virtual ground and Uin lies over R1 to virtual ground. With the high impedance of the op-amp the current into the op-amp is near 0 A, so the only current flows through the two resistors. With Kirchhoff's second (voltage) law we get:
Uin·R1 = -Uout·R2 respectively the gain
GU = -R2/R1.
To get a non-inverting amplifier we have to feed the input voltage to the non-inverting input. With the same thinking as above we get:
Uin·R1 = Uout·(R2 + R1). So the gain of the non-inverting op-amp is always greater than one. With two similar resistors we get a gain of two.
Let's measure the current drawn by our rover. For this we add a 200 mΩ resistor (shunt) into the ground line and measure the voltage corresponding to the current. Calculate the voltage to be expected (see ELEFU exercises) and dimension an amplifier to get a maximum voltage of about 2 V (abs. max. is 3.3 V) for the analog input of our ESP32. Document your calculations and draw the circuit.
Test the circuit on a breadboard with the help of multimeter and a power supply. Document your measurements.
Test the circuit on a breadboard by adding the MH-ET LIVE D1 mini ESP32. Use ADC input pin 34 to read the shunt voltage. Write and document your program. Document the measured current with a screenshot of the serial monitor.
Add a voltage divider to your drawing to measure the overall battery voltage. Use the ADC input pin 35. Document your calculations.
Built the circuit on a PCB and mount it to your rover. Add an LED and modify your rover program to measure the voltage and signalise if the voltage drops under 5 V. Document everything.
A very interesting circuit is the voltage follower. It is a non-inverting amplifier with R2 = 0 and R1 = ∞, witch gives us a gain of 1. The word amplifier is not really appropriate so
voltage follower or
buffer are better.
The voltage follower does not change the signal. It's advantage is the high input impedance and the low output impedance to isolate (buffer) a signal. The input signal will be unaffected by the circuit it is driving. We have already seen a good example in the chapter about DAC's. An R-2R ladder will function only if no current is drawn from the circuit. To use the output signal (get a current) we need to use a buffer circuit:
By adding resistances to the inverting input of an inverting amplifier we can create a summing amplifier. The currents are added in the node (junction) at the inverting input. Because there is practically no current entering the op-amp, the sum of the currents pass through R2. If all resistors have the same value (R), we get:
Uout = -R·(Uin1/R) + (Uin2/R) respectively
Uout = -(Uin1 + Uin2). With different values for the resistances we get a weighted sum. With three resistances we can add 3 voltages etc..
In our oscilloscope picture the output is already inverted!
An interesting option is to make the resistors adjustable.
With the differential amplifier we are able to calculate the difference between two voltages. Often we use
R1 = R2 and
R3 = R4 reducing the formula to:
Uout = R2/R1·(Uin2 - Uin1). For good results the resistances must be very precise.
In our example all resistors are equal, so we get
Uout = Uin2 - Uin1.
Changing resistances with capacitors can build an inverting differentiator (left) or integrator circuit (right). They can be used as a low-pass electronic filter or a high-pass electronic filter. Other uses will be as controller in control and feedback systems (D and I controller).
In a practical application one encounters difficulties (drift of the voltage) with this simple circuits. They have to be enhanced with further components.
Filters are very important in electronics and are used in a variety of manners in circuits. In electronics fundamentals (ELEFU) we have seen how to build filters with a resistor and a capacitor. These passive filters are often simple, inexpensive and need no power supply. To build more complex filter (higher order) with passive components can get very challenging and expensive because of the needed inductances. Op-amps with especially their high input impedance (voltage follower) help to isolate the different stages of a filter and have a gain that helps to adjust the signal and to compensate the losses. A filter including active elements like op-amps is called an active filter. A drawback of active filters could be the limited bandwidth.
There are much more circuits that could be realised with op-amps. Examples are a Wien bridge oscillator, inductance gyrator, precision rectifier, logarithmic amplifier, exponential amplifier etc..