# Switching gains on a precision operational amplifier using a microcontroller

I need to be able to switch between gain values on a precision opamp in the microvolt region using a MCU. What is the best method to do this? Noise is critical.

• On a specific measurement & logging project, I used a non-inv amplifier (A = 1 + R1/R2) having different low-side resistors (R2s) tied to individual MOSFETs. The maximum acceptable error was 100uV. The opamp was one of TI's very-low-Vos (under 10uV) ones. It was working without any problems. Sep 21, 2020 at 10:37
• Resistor noise, or switching noise from control feedthrough is critical? I'm sure you will have already looked at CMOS switches like 4052 for selecting gain controlling resistors, what specifications don't they meet? Sep 21, 2020 at 10:38
• Using an analog switch ADGxxx, maybe? Sep 21, 2020 at 10:41
• Schematic please. Sep 21, 2020 at 11:22
• Well showing that is better than me/someone guessing everything. I mean you don't mention the op-amp, nor the signal levels, nor the power rails, nor where the output connects, nor any gain values, nuthing! Not even close to anything. Sep 21, 2020 at 16:12

Analog Devices recommend to use solid state relays to make a variable gain amplifier.

There are also integrated variable/programmable gain amplifiers:

Low noise is the goal.

Assume a 62 ohm total of all the front end noise sources.

That produces 1.0 nanoVolts per rtHz noise density.

I suggest you have a low_noise first_stage, followed by a switched_gain second_stage.

Most important is what is the BANDWIDTH? If 100Hertz (actually 100 /(pi/2)), then the total input_referred_noise will be 1nanoVolt /rtHz * sqrt(100) = 10 nanoVolts RMS (or about 60 nanoVolts PeakPeak at the 1ppm level).

Thus 10 nanoVolts RMS, in 100Hz bandwidth, is about the lowest you can reasonly do.

Notice the switching_gain burden is NOT in the first stage, but the 2nd stage.

For gain_switching, you have numerous choices, because of the gain of the first stage provides a Gain_1 * Gain_1 advantage. Thus Gain_1 of 10 will reduce the impact of Stage_2 noise by factor of 10 * 10.

But how serious about low_noise must you be?

=======================

If you want DC_stability (low DC drift), then designing the PCB, with thermal_shorts and thermal_opens, becomes a easy learning curve.

At the 10 nanoVolt floor, you need to block or design_out incoming interferers from

• electric fields, coupling onto ALL circuit nodes

• magnetic fields (60Hz; spikes on 60Hz; switch_reg transients at 100 nanosecond that are minimally attenuated by copper foils)

• VDD trash and even VDD as a feedback path for sustaining oscillation

• Ground Plane coupling from OUTPUT back to INPUT, this causing echoes and thus settling time degradation; also any 1mA currents thru 2 squares of standard thickness copper foil will produce [1mA * 0.001 ohm == 1 microvolt error]

You can easily have a millivolt or 10 milliVolts of HFI or EFI.

Miniature mechanical latching relays are good for this application, and are used in most high end commercial test equipment. They have very low resistance when on, very low leakage when off and don't add any significant noise (including low-frequency noise such as thermal EMFs) when not switching.

You can also use a good analog switch and change taps on a voltage divider in the feedback circuit.

Or have dual parallel amplifier paths and ignore the one that might be saturated (mux after the amplifiers).

using a decent DAC?

The only other possibility is in my opinion to fake a dac with PWM

https://www.ti.com/lit/an/slaa497/slaa497.pdf

• I think this was downvoted because you'd need a "multiplying DAC", which this PWM approach does not accomplish. Also, PWM and "Noise is critical" don't go well together. Sep 21, 2020 at 19:21
• Well yes and no. you can get a PWM based DAC as good as you want. Problem is the effort will rise infinite... But I just offered the solution, if you only have one pin left on your µC this is a possible way to go Sep 21, 2020 at 19:28
• Sure, since the OP didn't mention signal frequency and MCU clock. So that aside, what filtering & gain multiplier would go with the OPs accuracy? Sep 21, 2020 at 20:18