Programmable Gain Op Amps for Multifunction Sensors

By Jon Gabay

Contributed By Electronic Products

Op amps have proven their usefulness as highly functional building blocks in the designer’s arsenal. These common circuit elements can easily be turned into buffers, amplifiers, summers, inverters, integrators, differentiators, multipliers, and are useful for single-ended and differential signal conditioning.

In a sense, the ability to vary a feedback resistor allows all op amps to have a gain that is programmable. However, using fixed-feedback resistors makes this gain a static value. A dynamically-configurable gain stage is yet another permutation of the op amp that provides even more functionality and flexibility for analog and mixed-signal designs.

This article describes op amps with programmable gain stages and how they can be used to increase the performance and capabilities of sensor-based designs. For precision op amps to be used in complex sensor-based applications, designers need to look at multiple aspects to get the best combination of specs and performance, while balancing cost considerations. This article will examine methods for making your own programmable gain op amps, as well as “off-the-shelf” commercially available parts. Although there is no easy “one-size-fits-all” formula, the following examples show how op-amp selection can help achieve critical application objectives. All parts, datasheets, tutorials, and development kits mentioned are available online at Digi-Key’s website.

Low-cost sensing

While some more advanced and costly sensors are mixed signal systems unto themselves, lower cost applications will use transducers as sensors and op amps as signal conditioning and calibration elements. Transducers typically need to be calibrated, offset, and amplified to be useful here. In addition, the values of these transducers may drift as time and temperature take their toll.

For lower-accuracy applications, such as a programmable thermostat where a degree or so of error is not critical, fixed-gain stages will get you into the ballpark. However, when accuracy is a must, programmable gain stages with fine granularity let you extract more precision from your sensor system by allowing you to calibrate and offset, and even “zoom in” on, the specific range you want to detect whenever you need to take a measurement.

Let’s use a thermistor as an example of a transducer that will be used as a temperature sensor. As a simple variable resistor, it reflects the temperature change with change in resistances. As a simple low-cost sensor, there may be variations in the resistances at the same temperature from part to part even though the manufacturing process is first quality.

As a result, a microcontroller in your design will not only need to convert the value its A/D receives, but it should also compensate for these variations, as well as for the effects of cabling (which can be long runs in some designs).

You could add trimmers to you board and calibrate each unit. However, this adds cost and can still drift in time and with temperature. You could add look up tables to your firmware, but this also adds manufacturing steps and cost since more memory is needed to hold the look-up table and each unit must go through a calibration cycle.

Available options

A standard op amp and a simple analog switch can allow a calibrated offset and full-scale range adjustment (Figure 1). Here, a ground reference can be switched in to let the A/D converter know what the zero offset error is when the value read should be zero. The A/D value read by the micro can have firmware add or subtract the value needed to correct for this adjusted zero point.

A standard op amp

Figure 1: A standard op amp can be used with an analog switch to determine offset values for calibrating software. Full-scale values can be read in too, but to maximize the dynamic range, a gain/attenuation control is needed.

Alternatively, switching in a reference that represents what the value should be for full scale lets the micro know what the actual reading should be. The gain of the output op amp should be adjusted to reflect the value the micro should see at full scale, even compensating for IR drop in long cable runs. You can use a high-resolution digital trimpot, such as the Analog Devices AD5231BRUZ10, in the gain stage to accomplish this (Figure 2).

Adding a digital trimpot to the feedback

Figure 2: Adding a digital trimpot to the feedback of the op amp can provide a fine adjustable gain granularity to maximize the dynamic range of your transducer.

As you can see, the ability to adjust the gain stage dynamically adds another layer of control and functionality to your sensor design, and there are many ways to do it, depending on the resolution and range you need to support. If space is a concern and if reliability needs to be very high, monolithic adjustable-gain op amps may be the way to go if the gain steps are small enough to finely tune your signal. Fortunately, there are many suppliers and parts to choose from.

For higher-bandwidth signals, you may want to look at the Texas Instruments THS7002CPWP, a dual, high-bandwidth, adjustable gain op amp with a 100 MHz, –3 dB gain bandwidth (70 MHz unity gain bandwidth product). Its 3 bit digitally-controlled gain stage provides 6 dB steps with attenuation to gain endpoints at –22 to 20 dB (Figure 3). A low-noise voltage feedback pre amp helps assure that varying input impedances do not affect the gain stage and also can be used to implement filtering. The THS7001CPWP is a single op amp part also available from TI.

The digital address bit

Figure 3: The digital address bit selects the gain value desired and an independent voltage feedback pre amp supports anti-aliasing filtering.

An alternative to using address bits to select gain steps is to use a serial bus. For example, the MCP6S93T-E/UN is also a dual programmable gain op amp with eight programmable gain steps, but instead of using an addressing scheme, it uses an SPI port, which selects a pre-programmed setting using an internal resistor ladder (Figure 4). This 18 MHz rail-to-rail part has a 1% gain error, but only operates with a single-supply power source from 2.5 to 5.5 V, which makes it a good choice for analog signal conditioning that feeds the A/D of a microcontroller.

Serial bus interface

Figure 4: An alternative to address bits is a serial bus interface. This takes only a few wires, but can control more steps without more pins and a larger package.

Another SPI adjustable part of interest comes from Maxim, with its dual MAX9939AUB+ featuring a 2.15 MHz gain bandwidth product and 6 bit adjustable gain stage with programmable gains from .2 to 157 through the SPI port. A nice feature is the internal SPI adjustable offsets and the ability to measure offsets of the chip.

To do this, the op amp disconnects its inverting input from the external pin and shorts it to the non-inverting input. This allows the input common mode offset error to be read in and used as a calibration factor in software. An internal 4 bit offset voltage can be programmed to compensate for zero-point calibration. It also contains an internal VCC/2 reference for centering an AC waveform in a single-rail situation (Figure 5).

Adjustable offsets allow higher integration (click for full-size)

Figure 5: In addition to adjustable gain, adjustable offsets allow higher integration for calibration purposes since these functions do not need to be implemented externally. A VCC/2 reference is also provided for centering an AC signal in a single rail design.

As you may know, an op amp can be used to connect to transducers differentially, which all but eliminates common mode noise concerns, especially at the source of measurement where signal levels are the lowest. When a transducer and op amp are used together at a remote location, it may be desirable to send the op amps output differentially over a twisted pair to eliminate common mode noise from the op amp to the remote A/D converter. There are also programmable gain op amps with differential outputs readily available.

Take for example the National (now TI) LMP7312MA/NOPB digitally-programmable, variable-gain amplifier/attenuator with differential outputs (Figure 6). Controlled through an SPI port, the LMP7312 can amplify and pass up to 1 MHz transducer signals differentially from the transducer to the A/D, or can operate in a bipolar input to single-ended output mode. The attenuator is able to handle ±15 V signals and the gain stage provides six precision steps (defined in the datasheet) with an outstanding guaranteed 0.035 percent maximum gain error.

Any op amp supports differential inputs

Figure 6: Any op amp supports differential inputs, but some also provide differential outputs directly. This is useful for driving twisted pairs cabling for common-mode noise immunity.

A high-impedance mode is also selectable, which all but removes it from the circuit. It also features a null switch which allows reading the offset of the internal amplifier for calibration purposes.


Programmable-gain op amps provide a higher level of functional density, flexibility, and control when architecting mixed signal and sensor-based designs. A variety of parts, featuring accuracy, speed, offset adjustments, and calibration modes, gives us the best cost/performance points for reliable and accurate designs.

As with any good design practice, the first criteria always must be to achieve the system’s operational objectives for accuracy and performance, so low noise, low drift, and precision in high-gain scenarios will always be critical factors for success.

System designers are now able to choose from a widening range of precision op-amp alternatives that allow them to effectively meet even the most stringent performance and accuracy requirements. For more information on the products discussed in this article, please use the links provided to access product information pages on the Digi-Key website.

Disclaimer: The opinions, beliefs, and viewpoints expressed by the various authors and/or forum participants on this website do not necessarily reflect the opinions, beliefs, and viewpoints of Digi-Key Electronics or official policies of Digi-Key Electronics.

About this author

Jon Gabay

About this publisher

Electronic Products

Electronic Products magazine and serves engineers and engineering managers responsible for designing electronic equipment and systems.