Archive Article

Op Amp Design Techniques

Analog Adventures

Op amps can play useful roles in circuit designs linking the real analog world to microcontrollers. Stuart shares techniques for using op amps and related devices like comparators to optimize your designs and improve precision.

By Stuart Ball

Connecting the real world to your microcontroller circuit is what makes it useful for something more than blinking an LED. This is a broad topic. And several years ago, I wrote a book specifically about this: Analog Interfacing to Embedded Microprocessor Systems . What I want to do here is describe a few techniques that may save you some time and grief when connecting things to your own designs.

Op amp Voltage References

— ADVERTISMENT—

Advertise Here

An op amp (Figure 1) is an amplifier that has an inverting input, a noninverting input and an output. The voltage difference between the noninverting input and inverting input is amplified by a high internal gain and presented to the output. Resistors or other components are connected between the output and (usually) the inverting input to produce a feedback circuit that controls the gain of the completed circuit.

Figure 1
Standard inverting amplifier with reference offset voltage. The reference is needed to level-shift the -2.5 V to 2.5 V input up to the 0 V to 5 V input needed by a microcontroller.

Generally, the rule of thumb is that, as long as the op amp is properly connected—not saturated, no floating inputs—the inverting and noninverting inputs will be at the same voltage. This is because the negative feedback loop will cause the op amp to drive the inverting input to a voltage that matches the noninverting input. If the op amp can’t drive the output so that the inputs are equal, the output will saturate in either the positive or negative direction.

The circuit in Figure 1 is a commonly used inverting amplifier circuit, and it is what you might use to convert a signal that swings from -2.5 V to 2.5 V to the 0 to 5 V input of a microcontroller’s analog-to-digital (ADC) converter. If your microcontroller had an ADC that could only handle inputs of 0 to 3.3 V or 0 to 2.5 V, the same principles would apply, but the component values would be different. The op amp pinout shown is typical of one half of an 8-pin, dual op amp.

The input signal might be the output of a device with a -2.5 V to 2.5 V range. Or it might just be a capacitor-coupled AC signal such as an audio waveform. Whatever the source, the -2.5 V to 2.5 V range is outside the range of your ADC input, so you have to shift the level so that it is within the range of the ADC.

The circuit shown is a typical inverting amplifier, which means that the output is 180 degrees out of phase with the input. When the input is at its maximum voltage, the output is at its minimum, and vice-versa. The gain of the amplifier is defined as RF/RI, which is a gain of 1 for this circuit since both resistors have the same value. For other applications you might need gain greater or less than one.

If you work through the math as shown in Figure 1, you can see that the output equation is (2REF – Input) or 2× the reference voltage (1.25 V) minus the input voltage (-2.5 V to
2.5 V). So, when the input is 2.5 V, the output is (1.25 × 2) – 2.5, or 0 V. When the input is -2.5 V, the output is (1.25 × 2) – (-2.5), or  5 V. So, the input is inverted and translated up 2.5 V to match the ADC input requirements at the op amp output.

Double Trouble

Now the potential problem: While the input voltage is multiplied by 1 (and level-shifted), the reference voltage is multiplied by 2. So, any noise or ripple on the reference voltage will show up doubled on the output. A 10 mV ripple signal will be 20 mV at the ADC input and will be combined with the input signal you are trying to measure.
A 50 mV DC error in the reference will translate to a 100 mV constant offset at the output.

Figure 2
A voltage divider provides a simple voltage reference but is subject to variation from ripple on the supply voltage, and the normal variation in the supply voltage. The supply voltage can vary with temperature, part tolerance and other factors.

Suppose that the reference voltage is generated as shown in Figure 2, with a pair of resistors to divide the 5 V supply down to 1.25 V. Using 1% resistors provides a reference voltage that is within about 01.7% of the intended value—provided the 5 V supply is exactly 5 V. However, this 5 V value can vary with temperature, with the input voltage and with the tolerance of the reference voltage inside the regulator circuit. The values of the resistors can also drift with temperature, although this effect is negligible in many applications.

— ADVERTISMENT—

Advertise Here

In addition to the variation in the 5 V supply DC voltage, any AC signal on the
5 V supply will be transmitted to the op amp reference and will be multiplied by two at the op amp output. . …

Read the full article in the July 336 issue of Circuit Cellar

Don’t miss out on upcoming issues of Circuit Cellar. Subscribe today!

Note: We’ve made the October 2017 issue of Circuit Cellar available as a free sample issue. In it, you’ll find a rich variety of the kinds of articles and information that exemplify a typical issue of the current magazine.
Keep up-to-date with our FREE Weekly Newsletter!

Don't miss out on upcoming issues of Circuit Cellar.


Note: We’ve made the Dec 2022 issue of Circuit Cellar available as a free sample issue. In it, you’ll find a rich variety of the kinds of articles and information that exemplify a typical issue of the current magazine.

Would you like to write for Circuit Cellar? We are always accepting articles/posts from the technical community. Get in touch with us and let's discuss your ideas.

Sponsor this Article
Website | + posts

Circuit Cellar's editorial team comprises professional engineers, technical editors, and digital media specialists. You can reach the Editorial Department at editorial@circuitcellar.com, @circuitcellar, and facebook.com/circuitcellar

Supporting Companies

Upcoming Events


Copyright © KCK Media Corp.
All Rights Reserved

Copyright © 2023 KCK Media Corp.

Op Amp Design Techniques

by Circuit Cellar Staff time to read: 4 min